1

Most of my Nifti files have different xyZ dimensions. How can I arrange them so that they have the same dimensionality and then be able to train them in a CNN?

NUI
  • 23
  • 4

1 Answers1

2

You can resample the images to have the same voxel size and then crop them to cover the same physical size. This is important because if you just re-size the images then each pixel (or voxel in 3D) will be a different physical size, and your CNN will be learning features at different scales.

If you are interested in performing this in Python, then I strongly suggest SimpleITK. Another package built on top of this is platipy - which has tools for isotropic resampling and cropping which could be useful.

Robbie
  • 4,672
  • 1
  • 19
  • 24
  • Images are in the same MNI space, and already have the same voxel size. Can I just crop them in SimpleITK so that they have the same dimensionality? Lets say the I have three different images each with the following dimensions (19, 17, 20), ) (13, 15, 11), (25, 19, 15). I would want all of them to have the same resolution as (15, 15, 15). @Robbie – NUI Aug 31 '22 at 16:35
  • Okay, it's good they already have the same voxel size. You could crop them all to the same space - but I would be careful to make sure you aren't losing information (e.g. by cutting out parts of the image containing the patient). You will also have to pad the images that are smaller than the size you'd like. – Robbie Aug 31 '22 at 23:37