Skip to content

Commit 593b555

Browse files
committed
enh: add labels
1 parent 0d5c3b5 commit 593b555

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

sdcflows/interfaces/reportlets.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ class _FieldmapReportletInputSpec(reporting.ReportCapableInputSpec):
2121
desc='filename for the visual report')
2222
show = traits.Enum(1, 0, 'both', usedefault=True,
2323
desc='where the fieldmap should be shown')
24+
reference_label = traits.Str('Reference', usedefault=True,
25+
desc='a label name for the reference mosaic')
26+
moving_label = traits.Str('Fieldmap (Hz)', usedefault=True,
27+
desc='a label name for the reference mosaic')
2428

2529

2630
class FieldmapReportlet(reporting.ReportCapableInterface):
@@ -42,9 +46,12 @@ def _generate_report(self):
4246
"""Generate a reportlet."""
4347
NIWORKFLOWS_LOG.info('Generating visual report')
4448

45-
refnii = load_img(self.inputs.reference)
49+
movnii = refnii = load_img(self.inputs.reference)
4650
fmapnii = load_img(self.inputs.fieldmap)
4751

52+
if isdefined(self.inputs.moving):
53+
movnii = load_img(self.inputs.moving)
54+
4855
contour_nii = mask_nii = None
4956
if isdefined(self.inputs.mask):
5057
contour_nii = load_img(self.inputs.mask)
@@ -71,17 +78,17 @@ def _generate_report(self):
7178

7279
# Call composer
7380
compose_view(
74-
plot_registration(refnii, 'moving-image',
81+
plot_registration(movnii, 'moving-image',
7582
estimate_brightness=True,
7683
cuts=cuts,
77-
label='fieldmap (Hz)',
84+
label=self.inputs.moving_label,
7885
contour=contour_nii,
7986
compress=False,
8087
**fmap_overlay[1]),
8188
plot_registration(refnii, 'fixed-image',
8289
estimate_brightness=True,
8390
cuts=cuts,
84-
label='reference',
91+
label=self.inputs.reference_label,
8592
contour=contour_nii,
8693
compress=False,
8794
**fmap_overlay[0]),

sdcflows/workflows/tests/test_pepolar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def test_pepolar_wf1(bids_layouts, output_path, dataset, workdir):
157157
wf.inputs.inputnode.in_reference_brain = boldref.path
158158
wf.inputs.inputnode.in_reference = boldref.path
159159

160-
rep = pe.Node(FieldmapReportlet(), 'simple_report')
160+
rep = pe.Node(FieldmapReportlet(reference_label='EPI Reference'), 'simple_report')
161161
rep.interface._always_run = True
162162
dsink = pe.Node(DerivativesDataSink(
163163
base_directory=str(output_path), keep_dtype=True,

sdcflows/workflows/tests/test_phdiff.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_workflow(bids_layouts, tmpdir, output_path, dataset, workdir):
3131

3232
if output_path:
3333
from ...interfaces.reportlets import FieldmapReportlet
34-
rep = pe.Node(FieldmapReportlet(), 'simple_report')
34+
rep = pe.Node(FieldmapReportlet(reference_label='Magnitude'), 'simple_report')
3535
rep.interface._always_run = True
3636

3737
dsink = pe.Node(DerivativesDataSink(

0 commit comments

Comments
 (0)