-
Notifications
You must be signed in to change notification settings - Fork 145
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
MRG: add mode and cval arguments for resampling #359
Conversation
Whitespace and docstring cleanup for resample, interplation edits.
Fix bug where arguments were not being passed to interpolation routine from `resample_img2img`. Extend tests and remove commented tests. Add tests for interpolator
This is #309 with some style and docstring edits, a fix, and some extra tests. |
@jbpoline - do you have time for a review? |
Transform object accidentally enforced `__init__` signature, but using ``self.__class__``. Use ``self.apply`` and return object of class ``Transform`` so we can have subclasses with different ``__init__`` signatures.
Not-affine transforms were not being rounded or thresholded correctly (as was the case for the Cython routine doing resampling for affine case). Not-affine, not default order case was not being reshaped correctly.
We were using a dictionary to pass extra kwargs to ndimage. Instead, define the relevant arguments explicitly.
@alexis-roche - when I was extending the tests, I noticed that the |
I am proposing a patch to make the cython cubic spline resampling routine signature consistent with the simple sampling routine ( |
Do you also want to threshold the peak values so they cast correctly? There's stuff in nibabel for that :
That ensures the top values don't wrap around into negatives etc. |
Would you mind making your patch a PR against my branch? |
Not sure users would expect clipping in the context of resampling an image, where the dynamic range is not expected to change significantly. I rather assume otherwise. |
Probably the user wouldn't expect this though:
|
Oh sorry - you mean the problem of wrapping around negative values. Yes, it would make sense to avoid that. But it should not affect intensities within the 'castable' range. |
Right - anything outside the castable range with do terrible things with a naive cast. |
…e_resample3d) for consistency with corresponding _cspline_sample routines. Casting of resampled arrays is now done in python.
MRG: add mode and cval arguments for resampling We sometimes need to resample images with specific ndimage resampling modes, such as changing the constant values outside the boundary or the boundary interpolation modes. Add and test these arguments to the nipy resampling functions. Fix some bugs in casting when using non-affines for resampling.
Thanks - sorry to be slow to get back to this. |
We sometimes need to resample images with specific ndimage resampling modes,
such as changing the constant values outside the boundary or the boundary
interpolation modes.
Add and test these arguments to the nipy resampling functions.