This is to write a function that I want to later turn into a package. Here are some of the things I want this to do (not necessarily:
Pierre generates one big matrix with all the images together and then just visualizes this. I think this is a pretty good template for what I want to do as well.
In [54]:
# Imports
import os
import numpy as np
import nibabel as nib
from scipy import ndimage as sn
from matplotlib import pyplot as plt
In [6]:
# Paths
in_file = '/home/surchs/Test/mni_152.nii.gz'
In [89]:
# Load the file and pick a volume
data = nib.load(in_file).get_data()
rolled = sn.interpolation.rotate(data, 0, [1,2])
print('The input file has the dimension {}'.format(data.shape))
slic_x = rolled[100,:,:]
slic_y = rolled[:,120,:]
slic_z = rolled[:,:,120]
print('The test slice has the dimension {}'.format(slic.shape))
In [90]:
f = plt.figure()
ax_x = f.add_subplot(131)
ax_x.imshow(slic_x, interpolation='nearest')
ax_y = f.add_subplot(132)
ax_y.imshow(slic_y, interpolation='nearest')
ax_z = f.add_subplot(133)
ax_z.imshow(slic_z, interpolation='nearest')
Out[90]:
In [ ]: