Add BBRegisterRPT
Choose subject's T1 as the fixed image, since no explicit reference is
specified
@@ -4,8 +4,9 @@ ReportCapableInterfaces for registration tools
"""
from __future__ import absolute_import, division, print_function, unicode_literals
+import os
-from nipype.interfaces import fsl, ants
+from nipype.interfaces import fsl, ants, freesurfer
from niworkflows.anat import mni
import niworkflows.common.report as nrc
from niworkflows import NIWORKFLOWS_LOG
@@ -143,6 +144,31 @@ class FLIRTRPT(nrc.RegistrationRC, fsl.FLIRT):
'Report - setting fixed (%s) and moving (%s) images',
self._fixed_image, self._moving_image)
+
+class BBRegisterInputSpecRPT(nrc.RegistrationRCInputSpec,
+ freesurfer.preprocess.BBRegisterInputSpec):
+ pass
+
+class BBRegisterOutputSpecRPT(nrc.ReportCapableOutputSpec,
+ freesurfer.preprocess.BBRegisterOutputSpec):
+ pass
+
+class BBRegisterRPT(nrc.RegistrationRC, freesurfer.BBRegister):
+ input_spec = BBRegisterInputSpecRPT
+ output_spec = BBRegisterOutputSpecRPT
+
+ def _post_run_hook(self, runtime):
+ # bbregister takes a subject_id, so the target is likely to be the
+ # T1 anatomical
+ self._fixed_image = os.path.join(os.getenv('SUBJECTS_DIR'),
+ self.input.subject_id, 'mri',
+ 'T1.mgz')
+ self._moving_image = self.aggregate_outputs().registered_file
+ NIWORKFLOWS_LOG.info(
+ 'Report - setting fixed (%s) and moving (%s) images',
+ self._fixed_image, self._moving_image)
+
+
# COMMENTED OUT UNTIL WE REALLY IMPLEMENT IT
# class ApplyXFMInputSpecRPT(nrc.RegistrationRCInputSpec,
# fsl.preprocess.ApplyXFMInputSpec):
