Thursday, 22 August 2013

Resizing a 3D image (and resampling)

Resizing a 3D image (and resampling)

I have 3D image of a brain (let's call it flash) and it's currently 263 x
256 x 185. I want to resize it to be the size of another image(call it
whole_brain_bravo); 256 x 256 x 176, and (hopefully) use a lanczos
interpolation to resample (Image.ANTIALIAS). My (failed) attempt:
from scipy import ndimage as nd
import nibabel as nib
import numpy as np
a = nib.load('flash.hdr') # nib is what I use to load the images
b = nib.load('whole_brain_bravo.hdr')
flash = a.get_data() # Access data as array (in this case memmap)
whole = b.get_data()
downed = nd.interpolation.zoom(flash, zoom=b.shape) # This obviously
doesn't work
Have you guys ever done this sort of thing on a 3D image?

No comments:

Post a Comment