Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated plot with sharex=True and wrap with a mode 'constant' #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexlib
Copy link

@alexlib alexlib commented Dec 25, 2022

new matplotlib requires explicit sharex=True and sharey=True
scikit-image wrap changed to constant (nearest does not exist anymore)

@rfezzani
Copy link
Owner

rfezzani commented Jan 2, 2023

Hello @alexlib, and sorry for my too late answer 🙏.
Thank you for this contribution, I will try to find some time to review and merge your PR 😉

Copy link
Owner

@rfezzani rfezzani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you again @alexlib for this contribution, I just recommend using edge instead of constant, otherwise my other comments are optional 😉

@@ -36,7 +36,7 @@

y, x = np.meshgrid(np.arange(nl), np.arange(nc), indexing='ij')

wI1 = warp(I1, np.array([y+v, x+u]), mode='nearest')
wI1 = warp(I1, np.array([y+v, x+u]), mode='constant')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wI1 = warp(I1, np.array([y+v, x+u]), mode='constant')
wI1 = warp(I1, np.array([y+v, x+u]), mode='edge')

Thank you for spotting this 😉. Instead of the constant mode, I would recommend the edge mode: the constant mode will in most cases introduce high gradient values on the image border, and thus create artifacts 😕

@@ -74,7 +74,7 @@ def _tvl1(I0, I1, u0, v0, dt, lambda_, tau, nwarp, niter, tol, prefilter):
u = ndi.filters.median_filter(u, 3)
v = ndi.filters.median_filter(v, 3)

wI1 = warp(I1, np.array([y+v, x+u]), mode='nearest')
wI1 = warp(I1, np.array([y+v, x+u]), mode='constant')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wI1 = warp(I1, np.array([y+v, x+u]), mode='constant')
wI1 = warp(I1, np.array([y+v, x+u]), mode='edge')

@@ -238,7 +238,7 @@ def _ilk(I0, I1, u0, v0, rad, nwarp, gaussian, prefilter):
u = ndi.filters.median_filter(u, 3)
v = ndi.filters.median_filter(v, 3)

wI1 = warp(I1, np.array([y+v, x+u]), mode='nearest')
wI1 = warp(I1, np.array([y+v, x+u]), mode='constant')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wI1 = warp(I1, np.array([y+v, x+u]), mode='constant')
wI1 = warp(I1, np.array([y+v, x+u]), mode='edge')

@@ -70,7 +70,7 @@ def parse_requirements_file(filename):
],
install_requires=REQUIRES,
extras_require=EXTRA_REQUIRES,
python_requires='>=3.5',
python_requires='>=3.7',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this change is mandatory 😕

@@ -59,7 +59,7 @@
# --- Show the result

fig = plt.figure(figsize=(15, 4))
ax0, ax1, ax2 = fig.subplots(1, 3, True)
ax0, ax1, ax2 = fig.subplots(1, 3)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ax0, ax1, ax2 = fig.subplots(1, 3)
ax0, ax1, ax2 = fig.subplots(1, 3, sharex=True, sharey=True)

Probably not necessary, but it doesn't hurt ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants