0

I am trying to resize Nii files so that my program takes less computational resources, I want to rescale them from (240,240,155) to (120,120,155). I have tried using nilearn.image.resample_img module to do so however as it is seen the image below the output is not what I would expect. Need some help to figure this out. enter image description here

Dabhi
  • 23
  • 3
  • Can you use `pillow`? Resizing an image is easy there: https://pillow.readthedocs.io/en/stable/reference/Image.html?highlight=resize#PIL.Image.Image.resize – Jan Christoph Terasa Mar 31 '21 at 07:36
  • 1
    @Dabhi *"I have tried using nilearn.image.resample_img module"* would you please share what you have tried so far as a piece of code? [minimal-reproducible-example](https://stackoverflow.com/help/minimal-reproducible-example) – Bilal Mar 31 '21 at 09:24
  • 1
    @Dabhi please take a look into this [solution](https://neurostars.org/t/nibabel-how-can-we-rescale-a-3d-image/4107/2) – Bilal Mar 31 '21 at 09:27
  • The documentation in `nilearn` says that if you give a new size, the image will be cropped or padded. For actual resampling you need to change the spacing (via the affine transform). – alle_meije Aug 16 '21 at 22:34
  • I am not sure how to use the affine transform to resize image. Could you point to an example? – Misslinska Feb 21 '22 at 14:04

0 Answers0