-
Notifications
You must be signed in to change notification settings - Fork 52
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
Excessive padding when resampling zooms #696
Comments
That seems reasonable to me. Just to derail a little bit, this function worries me. It's a complicated, one-off procedure that implements a lot of things that should be composable operations. It seems like it would be better implemented as: def resample_to_zooms(img, target_zooms, **kwargs):
shape, affine = rezoom(img.affine, target_zooms)
new_img = resample_img(img, shape, affine, **kwargs)
# Possibly do some header fiddling
return new_img
def resample_img(img, shape, affine, order=3):
...
def rezoom(affine, target_zooms):
... Then we could even parameterize |
agreed - it will also simplify testing |
+1 |
When working with
RegridToZooms
(akaresample_by_spacing
), I was going from even -> odd slice lengths when doubling the zooms of an image. After a little digging, it seems to me we should be rounding (maybe to the 3rd decimal spot) before callingnp.ceil
to avoid any extra slices..Relevant code section:
niworkflows/niworkflows/utils/images.py
Lines 227 to 232 in 47d6034
Test case:
Does this make sense, or is it fine to just include the extra slice? cc @oesteban
The text was updated successfully, but these errors were encountered: