Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class _SubjectSummaryInputSpec(BaseInterfaceInputSpec):
t1w = InputMultiObject(File(exists=True), desc='T1w structural images')
t2w = InputMultiObject(File(exists=True), desc='T2w structural images')
subjects_dir = Directory(desc='FreeSurfer subjects directory')
subject_id = Str(desc='Subject ID')
output_spaces = InputMultiObject(Str, desc='list of standard spaces')
class _SubjectSummaryOutputSpec(_SummaryOutputSpec):
# This exists to ensure that the summary is run prior to the first ReconAll
# call, allowing a determination whether there is a pre-existing directory
subject_id = Str(desc='FreeSurfer subject ID')
class SubjectSummary(SummaryInterface):
"""Subject html summary reportlet."""
input_spec = _SubjectSummaryInputSpec
output_spec = _SubjectSummaryOutputSpec
def _run_interface(self, runtime):
if isdefined(self.inputs.subject_id):
self._results['subject_id'] = self.inputs.subject_id
return super(SubjectSummary, self)._run_interface(runtime)
def _generate_segment(self):
if not isdefined(self.inputs.subjects_dir):
freesurfer_status = 'Not run'
else:
recon = fs.ReconAll(subjects_dir=self.inputs.subjects_dir,
subject_id=self.inputs.subject_id,
output_spaces = ', '.join(output_spaces)
return SUBJECT_TEMPLATE.format(subject_id=self.inputs.subject_id,
n_t1s=len(self.inputs.t1w),
t2w=t2w_seg,
output_spaces=output_spaces,
freesurfer_status=freesurfer_status)
class _AboutSummaryInputSpec(BaseInterfaceInputSpec):
version = Str(desc='sMRIPrep version')
command = Str(desc='sMRIPrep command')
# Date not included - update timestamp only if version or command changes
class AboutSummary(SummaryInterface):
"""About section reportlet."""
input_spec = _AboutSummaryInputSpec
def _generate_segment(self):
return ABOUT_TEMPLATE.format(version=self.inputs.version,
command=self.inputs.command,
date=time.strftime("%Y-%m-%d %H:%M:%S %z"))
class _FSSurfaceReportInputSpec(_SVGReportCapableInputSpec, _FSSourceInputSpec):
pass
class _FSSurfaceReportOutputSpec(reporting.ReportCapableOutputSpec):
pass