From 009d9767c6f39822b9ee89f0b62055156dad3c9f Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 8 Oct 2020 15:51:13 -0700 Subject: [PATCH] Adds a brainsprite example. --- examples/plot_brainsprite.py | 57 ++++++++++++++++++++++++++++++++++++ setup.cfg | 3 ++ 2 files changed, 60 insertions(+) create mode 100644 examples/plot_brainsprite.py diff --git a/examples/plot_brainsprite.py b/examples/plot_brainsprite.py new file mode 100644 index 000000000..048e7f3cb --- /dev/null +++ b/examples/plot_brainsprite.py @@ -0,0 +1,57 @@ +""" +Streamline count viewer +========================== +Generate a brainsprite viewer for a streamline coun map with an anatomical +background, by populating an html template. +""" + +from brainsprite import viewer_substitute +import tempita + +anat = './callosal_tract_profile/dti_FA.nii.gz' +stat_img = './callosal_tract_profile/afq_AntFrontal_density_map.nii.gz' + +bsprite = viewer_substitute(vmin=0, cmap="hot", symmetric_cmap=False, + title="streamline_count") +bsprite.fit(stat_img, bg_img=anat) + +template = \ +""" + + + + +
+ + {{ html }} +
+ + + + + + + + + +""" + +template = tempita.Template(template) + +viewer = bsprite.transform(template, javascript='js', html='html', library='bsprite') +output_fname = 'plot_stat_map.html' +viewer.save_as_html(output_fname) + +viewer \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 000efbf3d..6383c8f4b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -78,3 +78,6 @@ fury = vtk==9.0.1 fury==0.6.0 xvfbwrapper==0.2.9 +brainsprite = + brainsprite +