Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self._anat_file = self.inputs.realigned_file
self._mask_file = self.inputs.mask_files[0]
self._seg_files = self.inputs.mask_files
self._masked = False
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._SVGReportCapableInputSpec, confounds.TCompCorInputSpec
):
pass
class _TCompCorOutputSpecRPT(
reporting.ReportCapableOutputSpec, confounds.TCompCorOutputSpec
):
pass
class TCompCorRPT(nrc.SegmentationRC, confounds.TCompCor):
input_spec = _TCompCorInputSpecRPT
output_spec = _TCompCorOutputSpecRPT
def _post_run_hook(self, runtime):
""" generates a report showing slices from each axis """
def _generate_report(self):
from niworkflows.viz.utils import plot_melodic_components
plot_melodic_components(
melodic_dir=self._melodic_dir,
in_file=self.inputs.in_files[0],
tr=self.inputs.tr_sec,
out_file=self._out_report,
compress=self.inputs.compress_report,
report_mask=self.inputs.report_mask,
)
class _ICA_AROMAInputSpecRPT(
nrc._SVGReportCapableInputSpec, fsl.aroma.ICA_AROMAInputSpec
):
out_report = File(
"ica_aroma_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 _ICA_AROMAOutputSpecRPT(
reporting.ReportCapableOutputSpec, fsl.aroma.ICA_AROMAOutputSpec
):
pass
return super(FASTRPT, self)._post_run_hook(runtime)
class _ReconAllInputSpecRPT(
nrc._SVGReportCapableInputSpec, freesurfer.preprocess.ReconAllInputSpec
):
pass
class _ReconAllOutputSpecRPT(
reporting.ReportCapableOutputSpec, freesurfer.preprocess.ReconAllOutputSpec
):
pass
class ReconAllRPT(nrc.SurfaceSegmentationRC, freesurfer.preprocess.ReconAll):
input_spec = _ReconAllInputSpecRPT
output_spec = _ReconAllOutputSpecRPT
def _post_run_hook(self, runtime):
""" generates a report showing nine slices, three per axis, of an
arbitrary volume of `in_files`, with the resulting segmentation
overlaid """
outputs = self.aggregate_outputs(runtime=runtime)
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
res = mri_vol2vol.run()
self._fixed_image = target_file
self._moving_image = res.outputs.transformed_file
if mri_dir is not None:
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(MRICoregRPT, self)._post_run_hook(runtime)
class _SimpleBeforeAfterInputSpecRPT(nrc._SVGReportCapableInputSpec):
before = File(exists=True, mandatory=True, desc="file before")
after = File(exists=True, mandatory=True, desc="file after")
wm_seg = File(desc="reference white matter segmentation mask")
before_label = traits.Str("before", usedefault=True)
after_label = traits.Str("after", usedefault=True)
class SimpleBeforeAfterRPT(nrc.RegistrationRC, nrc.ReportingInterface):
input_spec = _SimpleBeforeAfterInputSpecRPT
def _post_run_hook(self, runtime):
""" there is not inner interface to run """
self._fixed_image_label = self.inputs.after_label
self._moving_image_label = self.inputs.before_label
self._fixed_image = self.inputs.after
self._moving_image = self.inputs.before
)
in_mask = File(exists=True, desc="a special region, eg. the brain mask")
masked = traits.Bool(False, usedefault=True, desc="mask in_file prior plotting")
colors = traits.Either(
None, traits.List(Str), usedefault=True, desc="use specific colors for contours"
)
levels = traits.Either(
None,
traits.List(traits.Float),
usedefault=True,
desc="pass levels to nilearn.plotting",
)
mask_color = Str("r", usedefault=True, desc="color for mask")
class ROIsPlot(nrc.ReportingInterface):
input_spec = _ROIsPlotInputSpecRPT
def _generate_report(self):
from niworkflows.viz.utils import plot_segs, compose_view
seg_files = self.inputs.in_rois
mask_file = None if not isdefined(self.inputs.in_mask) else self.inputs.in_mask
# Remove trait decoration and replace None with []
levels = [level for level in self.inputs.levels or []]
colors = [c for c in self.inputs.colors or []]
if len(seg_files) == 1: # in_rois is a segmentation
nsegs = len(levels)
if nsegs == 0:
levels = np.unique(