Skip to content

RF: Use ReportCapableInterface from nipype #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nipype
Submodule nipype updated 52 files
+70 −5 .circleci/config.yml
+1 −0 .gitignore
+4 −11 .travis.yml
+29 −29 .zenodo.json
+23 −0 doc/changelog/1.X.X-changelog
+1 −1 doc/conf.py
+1 −1 doc/documentation.rst
+9 −2 doc/users/config_file.rst
+8 −6 doc/users/debug.rst
+11 −11 nipype/info.py
+3 −3 nipype/interfaces/afni/__init__.py
+73 −0 nipype/interfaces/afni/tests/test_auto_LocalBistat.py
+115 −0 nipype/interfaces/afni/utils.py
+1 −1 nipype/interfaces/ants/__init__.py
+60 −0 nipype/interfaces/ants/tests/test_auto_LabelGeometry.py
+57 −0 nipype/interfaces/ants/utils.py
+24 −0 nipype/interfaces/base/core.py
+1 −1 nipype/interfaces/dcm2nii.py
+1 −1 nipype/interfaces/fsl/__init__.py
+45 −0 nipype/interfaces/fsl/tests/test_auto_Slice.py
+62 −0 nipype/interfaces/fsl/utils.py
+151 −0 nipype/interfaces/image.py
+2 −0 nipype/interfaces/mixins/__init__.py
+65 −0 nipype/interfaces/mixins/reporting.py
+1 −0 nipype/interfaces/mixins/tests/__init__.py
+17 −0 nipype/interfaces/mixins/tests/test_auto_ReportCapableInterface.py
+2 −1 nipype/interfaces/mrtrix3/__init__.py
+78 −5 nipype/interfaces/mrtrix3/preprocess.py
+61 −0 nipype/interfaces/mrtrix3/tests/test_auto_DWIDenoise.py
+2 −1 nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py
+30 −0 nipype/interfaces/tests/test_auto_Reorient.py
+64 −0 nipype/interfaces/tests/test_image.py
+5 −0 nipype/interfaces/workbench/__init__.py
+69 −0 nipype/interfaces/workbench/base.py
+161 −0 nipype/interfaces/workbench/metric.py
+0 −0 nipype/interfaces/workbench/tests/__init__.py
+94 −0 nipype/interfaces/workbench/tests/test_auto_MetricResample.py
+27 −0 nipype/interfaces/workbench/tests/test_auto_WBCommand.py
+32 −0 nipype/pipeline/engine/tests/test_join.py
+5 −3 nipype/pipeline/engine/utils.py
+4 −7 nipype/pipeline/plugins/base.py
+0 −0 nipype/testing/data/fs_LR-deformed_to-fsaverage.L.sphere.32k_fs_LR.surf.gii
+0 −0 nipype/testing/data/fs_LR.L.midthickness_va_avg.32k_fs_LR.shape.gii
+0 −0 nipype/testing/data/fsaverage5.L.midthickness_va_avg.10k_fsavg_L.shape.gii
+0 −0 nipype/testing/data/fsaverage5_std_sphere.L.10k_fsavg_L.surf.gii
+0 −0 nipype/testing/data/sub-01_task-rest_bold_space-fsaverage5.L.func.gii
+1 −1 nipype/tests/test_nipype.py
+3 −0 nipype/utils/config.py
+49 −0 nipype/utils/tests/test_config.py
+23 −6 nipype/workflows/dmri/dtitk/tensor_registration.py
+1 −1 tools/checkspecs.py
+116 −0 tools/feedstock.sh
50 changes: 28 additions & 22 deletions niworkflows/interfaces/masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@
from ..nipype.interfaces import fsl, ants
from ..nipype.interfaces.base import (
File, BaseInterfaceInputSpec, traits, isdefined, InputMultiPath, Str)
from ..nipype.interfaces.mixins import reporting
from ..nipype.algorithms import confounds
from . import report_base as nrc


class BETInputSpecRPT(nrc.ReportCapableInputSpec,
class BETInputSpecRPT(nrc.SVGReportCapableInputSpec,
fsl.preprocess.BETInputSpec):
pass


class BETOutputSpecRPT(nrc.ReportCapableOutputSpec,
class BETOutputSpecRPT(reporting.ReportCapableOutputSpec,
fsl.preprocess.BETOutputSpec):
pass

Expand All @@ -36,7 +37,7 @@ class BETRPT(nrc.SegmentationRC, fsl.BET):
output_spec = BETOutputSpecRPT

def _run_interface(self, runtime):
if self.inputs.generate_report:
if self.generate_report:
self.inputs.mask = True

return super(BETRPT, self)._run_interface(runtime)
Expand All @@ -53,13 +54,15 @@ def _post_run_hook(self, runtime):
NIWORKFLOWS_LOG.info('Generating report for BET. file "%s", and mask file "%s"',
self._anat_file, self._mask_file)

return super(BETRPT, self)._post_run_hook(runtime)

class BrainExtractionInputSpecRPT(nrc.ReportCapableInputSpec,

class BrainExtractionInputSpecRPT(nrc.SVGReportCapableInputSpec,
ants.segmentation.BrainExtractionInputSpec):
pass


class BrainExtractionOutputSpecRPT(nrc.ReportCapableOutputSpec,
class BrainExtractionOutputSpecRPT(reporting.ReportCapableOutputSpec,
ants.segmentation.BrainExtractionOutputSpec):
pass

Expand All @@ -84,15 +87,17 @@ def _post_run_hook(self, runtime):
NIWORKFLOWS_LOG.info('Generating report for ANTS BrainExtraction. file "%s", mask "%s"',
self._anat_file, self._mask_file)

return super(BrainExtractionRPT, self)._post_run_hook(runtime)


# TODO: move this interface to nipype.interfaces.nilearn
class ComputeEPIMaskInputSpec(nrc.ReportCapableInputSpec,
class ComputeEPIMaskInputSpec(nrc.SVGReportCapableInputSpec,
BaseInterfaceInputSpec):
in_file = File(exists=True, desc="3D or 4D EPI file")
dilation = traits.Int(desc="binary dilation on the nilearn output")


class ComputeEPIMaskOutputSpec(nrc.ReportCapableOutputSpec):
class ComputeEPIMaskOutputSpec(reporting.ReportCapableOutputSpec):
mask_file = File(exists=True, desc="Binary brain mask")


Expand Down Expand Up @@ -152,13 +157,15 @@ def _post_run_hook(self, runtime):
'Generating report for nilearn.compute_epi_mask. file "%s", and mask file "%s"',
self._anat_file, self._mask_file)

return super(ComputeEPIMask, self)._post_run_hook(runtime)


class ACompCorInputSpecRPT(nrc.ReportCapableInputSpec,
class ACompCorInputSpecRPT(nrc.SVGReportCapableInputSpec,
confounds.CompCorInputSpec):
pass


class ACompCorOutputSpecRPT(nrc.ReportCapableOutputSpec,
class ACompCorOutputSpecRPT(reporting.ReportCapableOutputSpec,
confounds.CompCorOutputSpec):
pass

Expand All @@ -181,13 +188,15 @@ def _post_run_hook(self, runtime):
NIWORKFLOWS_LOG.info('Generating report for aCompCor. file "%s", mask "%s"',
self.inputs.realigned_file, self._mask_file)

return super(ACompCorRPT, self)._post_run_hook(runtime)

class TCompCorInputSpecRPT(nrc.ReportCapableInputSpec,

class TCompCorInputSpecRPT(nrc.SVGReportCapableInputSpec,
confounds.TCompCorInputSpec):
pass


class TCompCorOutputSpecRPT(nrc.ReportCapableOutputSpec,
class TCompCorOutputSpecRPT(reporting.ReportCapableOutputSpec,
confounds.TCompCorOutputSpec):
pass

Expand All @@ -213,27 +222,27 @@ def _post_run_hook(self, runtime):
self.inputs.realigned_file,
self.aggregate_outputs(runtime=runtime).high_variance_masks)

return super(TCompCorRPT, self)._post_run_hook(runtime)


class SimpleShowMaskInputSpec(nrc.ReportCapableInputSpec):
class SimpleShowMaskInputSpec(nrc.SVGReportCapableInputSpec):
background_file = File(exists=True, mandatory=True, desc='file before')
mask_file = File(exists=True, mandatory=True, desc='file before')
generate_report = traits.Bool(True, usedefault=True)


class SimpleShowMaskRPT(nrc.SegmentationRC):
class SimpleShowMaskRPT(nrc.SegmentationRC, nrc.ReportingInterface):
input_spec = SimpleShowMaskInputSpec
output_spec = nrc.ReportCapableOutputSpec

def _post_run_hook(self, runtime):
self._anat_file = self.inputs.background_file
self._mask_file = self.inputs.mask_file
self._seg_files = [self.inputs.mask_file]
self._masked = True

return runtime
return super(SimpleShowMaskRPT, self)._post_run_hook(runtime)


class ROIsPlotInputSpecRPT(nrc.ReportCapableInputSpec):
class ROIsPlotInputSpecRPT(nrc.SVGReportCapableInputSpec):
in_file = File(exists=True, mandatory=True, desc='the volume where ROIs are defined')
in_rois = InputMultiPath(File(exists=True), mandatory=True,
desc='a list of regions to be plotted')
Expand All @@ -243,12 +252,10 @@ class ROIsPlotInputSpecRPT(nrc.ReportCapableInputSpec):
desc='use specific colors for contours')


class ROIsPlot(nrc.SegmentationRC):
class ROIsPlot(nrc.ReportingInterface):
input_spec = ROIsPlotInputSpecRPT
output_spec = nrc.ReportCapableOutputSpec

def _run_interface(self, runtime):
""" there is not inner interface to run """
def _generate_report(self):
from niworkflows.viz.utils import plot_segs, compose_view
seg_files = self.inputs.in_rois
mask_file = None
Expand All @@ -270,4 +277,3 @@ def _run_interface(self, runtime):
fg_svgs=None,
out_file=self._out_report
)
return runtime
Loading