Skip to content

Instantly share code, notes, and snippets.

@r03ert0
Created September 13, 2017 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r03ert0/524df008c1d242538661aadd765a099f to your computer and use it in GitHub Desktop.
Save r03ert0/524df008c1d242538661aadd765a099f to your computer and use it in GitHub Desktop.
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