Skip to content

Commit

Permalink
Merge pull request #89 from effigies/enh/plotting_improvements
Browse files Browse the repository at this point in the history
ENH: Plotting improvements
  • Loading branch information
effigies authored Jan 22, 2019
2 parents 890f48d + 0bc7995 commit c7cc798
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion fitlins/interfaces/visualizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from nipype.interfaces.base import (
SimpleInterface, BaseInterfaceInputSpec, TraitedSpec,
File, traits
File, traits, isdefined
)
from nipype.utils.filemanip import fname_presuffix, split_filename

Expand Down Expand Up @@ -99,9 +99,20 @@ def _visualize(self, data, out_name):
plot_and_save(out_name, plot_contrast_matrix, contrast_matrix,
ornt=self.inputs.orientation)

class GlassBrainPlotInputSpec(VisualizationInputSpec):
threshold = traits.Enum('auto', None, traits.Float(), usedefault=True)
vmax = traits.Float()
colormap = traits.Str('bwr_r', usedefault=True)

class GlassBrainPlot(Visualization):
input_spec = GlassBrainPlotInputSpec

def _visualize(self, data, out_name):
vmax = self.inputs.vmax
if not isdefined(vmax):
vmax = None
nlp.plot_glass_brain(data, colorbar=True, plot_abs=False,
display_mode='lyrz', axes=None,
vmax=vmax, threshold=self.inputs.threshold,
cmap=self.inputs.colormap,
output_file=out_name)
3 changes: 3 additions & 0 deletions fitlins/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ def init_fitlins_wf(bids_dir, derivatives, out_dir, space, desc=None,

level = 'l{:d}'.format(ix + 1)

# TODO: No longer used at higher level, suggesting we can simply return
# entities from loader as a single list
select_entities = pe.Node(
niu.Select(index=ix),
name='select_{}_entities'.format(level),
Expand Down Expand Up @@ -193,6 +195,7 @@ def init_fitlins_wf(bids_dir, derivatives, out_dir, space, desc=None,
name='ds_{}_contrast_plots'.format(level))

if ix == 0:
plot_contrasts.inputs.vmax = 20
wf.connect([
(loader, select_entities, [('entities', 'inlist')]),
(select_entities, getter, [('out', 'entities')]),
Expand Down

0 comments on commit c7cc798

Please sign in to comment.