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

ENH: support resampling multi-channel images #609

Merged
merged 2 commits into from
Apr 16, 2024
Merged

Conversation

ncullen93
Copy link
Member

This PR adds support for multi-channel images in resample_image. The docstring says it's supported and there has pretty much always been an exception raised for multi-channel, so I think I just never got around to implementing it.

This implementation is the simplest - it just splits the channels and resamples on each of them individually. I think the ants function ResampleImage supports vector images natively, so that may be preferred in the future.

@coveralls
Copy link

Coverage Status

coverage: 55.357% (+0.1%) from 55.245%
when pulling 6f4fa76 on resample-channels
into 54ec16e on master.

@cookpa
Copy link
Member

cookpa commented Apr 16, 2024

ANTs ResampleImage is templated over dimension so it will work for 3D images or 4D time series. Your approach of resampling each channel separately makes more sense for actual multi-channel images, and things like DWI data that are sometimes stored on disk as time series, but where it does not really make sense to interpolate along the fourth dimension.

I don't know how best to harmonize these things, in antsApplyTransforms we have different codes for 4D (time series) or 5D (vectors / tensors / generic multi-channel with 3 spatial dimensions and single time value).

@cookpa
Copy link
Member

cookpa commented Apr 16, 2024

Looking at the function I think it might actually be good, becuase antspy will recognize components in a 5D image, and if components is >1 then it calls the new code, and if components is 1 it will call ResampleImage which already works for time series.

@ncullen93
Copy link
Member Author

OK - thanks for the input. I will merge but feel free to open an issue in the future if needed and I will change it.

@ncullen93 ncullen93 merged commit d14dacd into master Apr 16, 2024
2 checks passed
@ncullen93 ncullen93 deleted the resample-channels branch April 16, 2024 17:14
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.

3 participants