Skip to content

Instantly share code, notes, and snippets.

@r03ert0 r03ert0/plot_anat.py
Created Sep 13, 2017

Embed
What would you like to do?
def plot_anat(img,output_file=None,vmax=None):
sh=img.get_data().shape
midvox=[sh[0]/2,sh[1]/2,sh[2]/2,1]
worldmidvox=img.affine.dot(midvox)
if vmax is None:
data=img.get_data().ravel()
data=data[data>data.max()*0.2]
vmax=data[range(0,len(data),len(data)/1000)].max()
plotting.plot_anat(img,vmax=vmax,cut_coords=worldmidvox[:3],output_file=output_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.