Closed ncullen93 closed 2 months ago
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).
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.
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.
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.