How to use the niworkflows.interfaces.report_base._SVGReportCapableInputSpec function in niworkflows

To help you get started, we’ve selected a few niworkflows examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github poldracklab / niworkflows / niworkflows / interfaces / masks.py View on Github external
)
        self._anat_file = self.inputs.realigned_file
        self._mask_file = high_variance_masks
        self._seg_files = [high_variance_masks]
        self._masked = False

        NIWORKFLOWS_LOG.info(
            'Generating report for tCompCor. file "%s", mask "%s"',
            self.inputs.realigned_file,
            self.aggregate_outputs(runtime=runtime).high_variance_masks,
        )

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


class _SimpleShowMaskInputSpec(nrc._SVGReportCapableInputSpec):
    background_file = File(exists=True, mandatory=True, desc="file before")
    mask_file = File(exists=True, mandatory=True, desc="file before")


class SimpleShowMaskRPT(nrc.SegmentationRC, nrc.ReportingInterface):
    input_spec = _SimpleShowMaskInputSpec

    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 super(SimpleShowMaskRPT, self)._post_run_hook(runtime)
github poldracklab / niworkflows / niworkflows / interfaces / registration.py View on Github external
def _post_run_hook(self, runtime):
        self._fixed_image = self.inputs.reference
        self._moving_image = self.aggregate_outputs(runtime=runtime).out_file
        self._contour = self.inputs.wm_seg if isdefined(self.inputs.wm_seg) else None
        NIWORKFLOWS_LOG.info(
            "Report - setting fixed (%s) and moving (%s) images",
            self._fixed_image,
            self._moving_image,
        )

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


class _ApplyXFMInputSpecRPT(
    nrc._SVGReportCapableInputSpec, fsl.preprocess.ApplyXFMInputSpec
):
    pass


class ApplyXFMRPT(FLIRTRPT, fsl.ApplyXFM):
    input_spec = _ApplyXFMInputSpecRPT
    output_spec = _FLIRTOutputSpecRPT


if LooseVersion("0.0.0") < fs.Info.looseversion() < LooseVersion("6.0.0"):
    _BBRegisterInputSpec = fs.preprocess.BBRegisterInputSpec
else:
    _BBRegisterInputSpec = fs.preprocess.BBRegisterInputSpec6


class _BBRegisterInputSpecRPT(nrc._SVGReportCapableInputSpec, _BBRegisterInputSpec):
github poldracklab / niworkflows / niworkflows / interfaces / registration.py View on Github external
def _post_run_hook(self, runtime):
        self._fixed_image_label = "after"
        self._moving_image_label = "before"
        self._fixed_image = self.aggregate_outputs(runtime=runtime).unwarped_file
        self._moving_image = self.inputs.in_file
        self._contour = self.inputs.wm_seg if isdefined(self.inputs.wm_seg) else None
        NIWORKFLOWS_LOG.info(
            "Report - setting corrected (%s) and warped (%s) images",
            self._fixed_image,
            self._moving_image,
        )

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


class _FLIRTInputSpecRPT(nrc._SVGReportCapableInputSpec, fsl.preprocess.FLIRTInputSpec):
    pass


class _FLIRTOutputSpecRPT(
    reporting.ReportCapableOutputSpec, fsl.preprocess.FLIRTOutputSpec
):
    pass


class FLIRTRPT(nrc.RegistrationRC, fsl.FLIRT):
    input_spec = _FLIRTInputSpecRPT
    output_spec = _FLIRTOutputSpecRPT

    def _post_run_hook(self, runtime):
        self._fixed_image = self.inputs.reference
        self._moving_image = self.aggregate_outputs(runtime=runtime).out_file
github poldracklab / niworkflows / niworkflows / interfaces / registration.py View on Github external
output_spec = _ANTSApplyTransformsOutputSpecRPT

    def _post_run_hook(self, runtime):
        self._fixed_image = self.inputs.reference_image
        self._moving_image = self.aggregate_outputs(runtime=runtime).output_image
        NIWORKFLOWS_LOG.info(
            "Report - setting fixed (%s) and moving (%s) images",
            self._fixed_image,
            self._moving_image,
        )

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


class _ApplyTOPUPInputSpecRPT(
    nrc._SVGReportCapableInputSpec, fsl.epi.ApplyTOPUPInputSpec
):
    wm_seg = File(argstr="-wmseg %s", desc="reference white matter segmentation mask")


class _ApplyTOPUPOutputSpecRPT(
    reporting.ReportCapableOutputSpec, fsl.epi.ApplyTOPUPOutputSpec
):
    pass


class ApplyTOPUPRPT(nrc.RegistrationRC, fsl.ApplyTOPUP):
    input_spec = _ApplyTOPUPInputSpecRPT
    output_spec = _ApplyTOPUPOutputSpecRPT

    def _post_run_hook(self, runtime):
        self._fixed_image_label = "after"
github poldracklab / niworkflows / niworkflows / interfaces / segmentation.py View on Github external
self._anat_file = os.path.join(
            outputs.subjects_dir, outputs.subject_id, "mri", "brain.mgz"
        )
        self._contour = os.path.join(
            outputs.subjects_dir, outputs.subject_id, "mri", "ribbon.mgz"
        )
        self._masked = False

        NIWORKFLOWS_LOG.info(
            "Generating report for ReconAll (subject %s)", outputs.subject_id
        )

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


class _MELODICInputSpecRPT(nrc._SVGReportCapableInputSpec, fsl.model.MELODICInputSpec):
    out_report = File(
        "melodic_reportlet.svg",
        usedefault=True,
        desc="Filename for the visual" " report generated " "by Nipype.",
    )
    report_mask = File(
        desc="Mask used to draw the outline on the reportlet. "
        "If not set the mask will be derived from the data."
    )


class _MELODICOutputSpecRPT(
    reporting.ReportCapableOutputSpec, fsl.model.MELODICOutputSpec
):
    pass
github poldracklab / niworkflows / niworkflows / interfaces / masks.py View on Github external
self._anat_file = self.inputs.in_file
        self._mask_file = self.aggregate_outputs(runtime=runtime).mask_file
        self._seg_files = [self._mask_file]
        self._masked = self.inputs.mask

        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._SVGReportCapableInputSpec, ants.segmentation.BrainExtractionInputSpec
):
    pass


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


class BrainExtractionRPT(nrc.SegmentationRC, ants.segmentation.BrainExtraction):
    input_spec = _BrainExtractionInputSpecRPT
    output_spec = _BrainExtractionOutputSpecRPT

    def _post_run_hook(self, runtime):
        """ generates a report showing slices from each axis """
github poldracklab / niworkflows / niworkflows / interfaces / masks.py View on Github external
from nipype.interfaces.base import (
    File,
    BaseInterfaceInputSpec,
    traits,
    isdefined,
    InputMultiPath,
    Str,
)
from nipype.interfaces.mixins import reporting
from nipype.algorithms import confounds
from seaborn import color_palette
from .. import NIWORKFLOWS_LOG
from . import report_base as nrc


class _BETInputSpecRPT(nrc._SVGReportCapableInputSpec, fsl.preprocess.BETInputSpec):
    pass


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


class BETRPT(nrc.SegmentationRC, fsl.BET):
    input_spec = _BETInputSpecRPT
    output_spec = _BETOutputSpecRPT

    def _run_interface(self, runtime):
        if self.generate_report:
            self.inputs.mask = True
github poldracklab / niworkflows / niworkflows / interfaces / registration.py View on Github external
res = mri_vol2vol.run()

        self._fixed_image = target_file
        self._moving_image = res.outputs.transformed_file
        self._contour = os.path.join(mri_dir, "ribbon.mgz")
        NIWORKFLOWS_LOG.info(
            "Report - setting fixed (%s) and moving (%s) images",
            self._fixed_image,
            self._moving_image,
        )

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


class _MRICoregInputSpecRPT(
    nrc._SVGReportCapableInputSpec, fs.registration.MRICoregInputSpec
):
    pass


class _MRICoregOutputSpecRPT(
    reporting.ReportCapableOutputSpec, fs.registration.MRICoregOutputSpec
):
    pass


class MRICoregRPT(nrc.RegistrationRC, fs.MRICoreg):
    input_spec = _MRICoregInputSpecRPT
    output_spec = _MRICoregOutputSpecRPT

    def _post_run_hook(self, runtime):
        outputs = self.aggregate_outputs(runtime=runtime)