I have a T1 image (NIFTI), already aligned, with dimension 121 x 145 x 121.
The image is loaded by nibabel. The voxel size is 1.5 x 1.5 x 1.5 mm.
I want to down-sample it to an image with 2.0 x 2.0 x 2.0 mm resolution and keep the images aligned.
I have little knowledge in MRI image manipulation. I couldn't find a clear tutorial.
How do I do that ? If you know any other Python library that can do it, it would also work.
I would suggest using Nibabel. It can downsample your nifti file in just a few lines.
Example to resample to an image to a voxel size of 2x2x2:
Just update
input_path
andoutput_path
to reflect your files. The second argument in the resample_to_output function (voxel_size
) needs to either match the dimensions of your input or be a single value, nibabel will then assume you want the same voxel size for all dimensions.Nibabel info:
Docs: http://nipy.org/nibabel/.
Install instructions: https://anaconda.org/conda-forge/nibabel