sina-mansour / UKB-connectomics

This repository will host scripts used to map structural and functional brain connectivity matrices for the UK biobank dataset.
https://www.biorxiv.org/content/10.1101/2023.03.10.532036v1
62 stars 7 forks source link

rigid linear transformations of atlases #19

Closed sina-mansour closed 2 years ago

sina-mansour commented 2 years ago

I was using the following mrtransform command to generate atlases in the DWI image space:

    mrtransform "${atlas_file}" "${atlas_dwi}" -linear "${transform_DWI_T1}" -inverse -interp nearest \
                -datatype uint32 ${threading} -info

I used the nearest interpolation to ensure that the maps are not interpolated and labels are not mistakenly averaged. But am not sure why I'm seeing the following warning:

    mrtransform: [WARNING] interpolator choice ignored since the input image will not be regridded

@Lestropie do you think this is normal?

Lestropie commented 2 years ago

Yes, the software is alerting you to a misunderstanding on your part.

If you have a purely rigid-body transform (ignoring the additional complications of general affine for now), then you can achieve the consequences of that transformation by simply modifying the contents of the image header, shifting the position & orientation of the voxel grid but leaving the image contents untouched. The advantage of doing it this way is that there is no need for mapping the image intensities onto a different voxel grid, bypassing the interpolation-based inaccuracies involved in doing so. If you were to do something like ask to apply the rigid-body transformation, but to keep the voxel grid exactly where it is (e.g. by specifying -template ${atlas_file}), then you would need to perform interpolation in order to sample that transformed data onto a voxel grid other than the one on which it originates. But you wouldn't want to do this, because in many cases the quantisation error associated with nearest-neighbour interpolation would exceed the magnitude of the transformation.

Just omit -interp; there's no interpolation to be done here, and that's a good thing.