Skip to content

Resample image to a lower resolution

lani1 edited this page Jul 13, 2022 · 4 revisions

This wiki explains how to use the ResampleImage command to change the resolution of an image. If you want to run the DBM with an average, you can either use an average that is higher resolution or matches the resolution of your data. But, if, say, your average is 40 um and your data are 70 um, it would be overkill to run with that very high resolution data, costing time, memory, and space. The command ResampleImage allows you to alter the resolution of the average.

As an example, we will use the DSURQE 40 um resolution mouse average copied from here: /opt/quarantine/resources/Dorr_2008_Steadman_2013_Ullmann_2013_Richards_2011_Qiu_2016_Egan_2015_40micron/ex-vivo named DSURQE_40micron.nii.gz

Then, you can resample it with the following command:

$ ResampleImage imageDimension inputImage outputImage MxNxO [size=1,spacing=0] [interpolate type]

For more information on the interpolation type, check out this: https://manpages.debian.org/experimental/ants/ResampleImage.1.en.html

$ ResampleImage 3 DSURQE_40micron.nii.gz DSURQE_70micron.nii.gz 0.07x0.07x0.07 0 0 6

In this formula, spacing refers to the voxel dimensions and size refers to the number of slices in each dimension. In this case, by specifying 0 for size and spacing, we tell the command to interpret the new resolution (MxNxO) to get the number of slices and the slices per dimension.

Clone this wiki locally