Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interpolate/Resize 3D array

Tags:

I have a 3D array holding voxels from a mri dataset. The model could be stretched along one or more directions. E.g. the voxel size (x,y,z) could be 0.5x0.5x2 mm. Now I want to resample the 3D array into an array holding 1,1,1 mm voxels. For this I need to make the x/y dimensions smaller and the z dimension bigger and interpolate the voxel values. My question is: Is there a simple function in numpy or scipy for doing such a resampling of a simple 3d array?

Loading model from *.nii file:

img = nib.load(sFileName)
array = np.array(img.dataobj).astype("uint8") # 3d array with e.g. 0.5,0.5,2 mm
# TODO resample