Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _post_run_hook(self, runtime):
""" generates a report showing slices from each axis """
if len(self.inputs.mask_files) != 1:
raise ValueError(
"ACompCorRPT only supports a single input mask. "
"A list %s was found." % self.inputs.mask_files
)
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)
def _post_run_hook(self, runtime):
""" generates a report showing slices from each axis of an arbitrary
volume of in_file, with the resulting binary brain mask overlaid """
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 = True
NIWORKFLOWS_LOG.info(
'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)
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
self._contour = self.inputs.wm_seg if isdefined(self.inputs.wm_seg) else None
NIWORKFLOWS_LOG.info(
"Report - setting before (%s) and after (%s) images",
self._fixed_image,
self._moving_image,
)
return super(SimpleBeforeAfterRPT, self)._post_run_hook(runtime)
interface_result = self.norm.run()
if interface_result.runtime.returncode != 0:
NIWORKFLOWS_LOG.warning("Retry #%d failed.", self.retry)
# Save outputs (if available)
term_out = _write_outputs(
interface_result.runtime, ".nipype-%04d" % self.retry
)
if term_out:
NIWORKFLOWS_LOG.warning(
"Log of failed retry saved (%s).", ", ".join(term_out)
)
else:
runtime.returncode = 0
# Note this in the log.
NIWORKFLOWS_LOG.info(
"Successful spatial normalization (retry #%d).", self.retry
)
# Break out of the retry loop.
return runtime
self.retry += 1
# If all tries fail, raise an error.
raise RuntimeError(
"Robust spatial normalization failed after %d retries." % (self.retry - 1)
)
def _post_run_hook(self, runtime):
self._fixed_image = self.inputs.fixed_image[0]
self._moving_image = self.aggregate_outputs(runtime=runtime).warped_image
NIWORKFLOWS_LOG.info(
"Report - setting fixed (%s) and moving (%s) images",
self._fixed_image,
self._moving_image,
)
return super(ANTSRegistrationRPT, self)._post_run_hook(runtime)