Ejemplo n.º 1
0
 def __init__(self, pipeline_mode, fs_subjects_dir=None, fs_subject_id=None, bids_dir="", output_dir=""):
     RegistrationStage.__init__(self, pipeline_mode, fs_subjects_dir, fs_subject_id, bids_dir, output_dir)
     self.config = RegistrationConfigUI()
     self.config.pipeline = pipeline_mode
     if self.config.pipeline == "fMRI":
         self.config.registration_mode = 'FSL (Linear)'
         self.config.registration_mode_trait = [
             'FSL (Linear)', 'BBregister (FS)']
         self.inputs = self.inputs + \
             ["eroded_csf", "eroded_wm", "eroded_brain"]
         self.outputs = self.outputs + ["eroded_wm_registered_crop", "eroded_csf_registered_crop",
                                        "eroded_brain_registered_crop"]
Ejemplo n.º 2
0
    def __init__(
        self,
        pipeline_mode,
        fs_subjects_dir=None,
        fs_subject_id=None,
        bids_dir="",
        output_dir="",
    ):
        """Constructor of the RegistrationStageUI class.

        Parameters
        -----------
        pipeline_mode : string
            Can be 'fMRI' or 'diffusion'

        fs_subjects_dir : path
            Path the the FreeSurfer subjects directory

        fs_subject_id : path
            FreeSurfer subject label

        bids_dir : path
            BIDS root directory

        output_dir : path
            Output directory

        See also
        ---------
        cmp.stages.registration.registration.RegistrationStage.__init_
        cmp.cmpbidsappmanager.stages.registration.registration.RegistrationStageUI
        """
        RegistrationStage.__init__(self, pipeline_mode, fs_subjects_dir,
                                   fs_subject_id, bids_dir, output_dir)
        self.config = RegistrationConfigUI()
        self.config.pipeline = pipeline_mode
        if self.config.pipeline == "fMRI":
            self.config.registration_mode = "FSL (Linear)"
            self.config.registration_mode_trait = [
                "FSL (Linear)", "BBregister (FS)"
            ]
            self.inputs = self.inputs + [
                "eroded_csf", "eroded_wm", "eroded_brain"
            ]
            self.outputs = self.outputs + [
                "eroded_wm_registered_crop",
                "eroded_csf_registered_crop",
                "eroded_brain_registered_crop",
            ]
Ejemplo n.º 3
0
    def __init__(self, project_info):

        self.subjects_dir = project_info.freesurfer_subjects_dir
        self.subject_id = project_info.freesurfer_subject_id

        self.global_conf.subjects = project_info.subjects
        self.global_conf.subject = project_info.subject

        if len(project_info.subject_sessions) > 0:
            self.global_conf.subject_session = project_info.subject_session
            self.subject_directory = os.path.join(self.base_directory,
                                                  project_info.subject,
                                                  project_info.subject_session)
        else:
            self.global_conf.subject_session = ''
            self.subject_directory = os.path.join(project_info.base_directory,
                                                  project_info.subject)

        self.derivatives_directory = os.path.abspath(
            project_info.output_directory)

        if project_info.output_directory is not None:
            self.output_directory = os.path.abspath(
                project_info.output_directory)
        else:
            self.output_directory = os.path.join(self.base_directory,
                                                 "derivatives")

        self.stages = {
            'Preprocessing':
            PreprocessingStage(bids_dir=project_info.base_directory,
                               output_dir=self.output_directory),
            'Registration':
            RegistrationStage(
                pipeline_mode="fMRI",
                fs_subjects_dir=project_info.freesurfer_subjects_dir,
                fs_subject_id=os.path.basename(
                    project_info.freesurfer_subject_id),
                bids_dir=project_info.base_directory,
                output_dir=self.output_directory),
            'FunctionalMRI':
            FunctionalMRIStage(bids_dir=project_info.base_directory,
                               output_dir=self.output_directory),
            'Connectome':
            ConnectomeStage(bids_dir=project_info.base_directory,
                            output_dir=self.output_directory)
        }

        Pipeline.__init__(self, project_info)

        self.subject = project_info.subject

        self.stages['FunctionalMRI'].config.on_trait_change(
            self.update_nuisance_requirements, 'global_nuisance')
        self.stages['FunctionalMRI'].config.on_trait_change(
            self.update_nuisance_requirements, 'csf')
        self.stages['FunctionalMRI'].config.on_trait_change(
            self.update_nuisance_requirements, 'wm')
        self.stages['Connectome'].config.on_trait_change(
            self.update_scrubbing, 'apply_scrubbing')
Ejemplo n.º 4
0
    def __init__(self, project_info):
        self.stages = {
            'Segmentation': SegmentationStage(),
            'Parcellation': ParcellationStage(pipeline_mode="Diffusion"),
            'Preprocessing': PreprocessingStage(),
            'Registration': RegistrationStage(pipeline_mode="Diffusion"),
            'Diffusion': DiffusionStage(),
            'MRTrixConnectome': MRTrixConnectomeStage()
        }

        Pipeline.__init__(self, project_info)

        self.diffusion_imaging_model = project_info.diffusion_imaging_model
        self.subject = project_info.subject

        self.global_conf.subjects = project_info.subjects
        self.global_conf.subject = self.subject

        self.subject_directory = os.path.join(self.base_directory,
                                              self.subject)
        self.derivatives_directory = os.path.join(self.base_directory,
                                                  'derivatives')

        self.stages['Segmentation'].config.on_trait_change(
            self.update_parcellation, 'seg_tool')
        self.stages['Parcellation'].config.on_trait_change(
            self.update_segmentation, 'parcellation_scheme')
Ejemplo n.º 5
0
    def __init__(self, project_info):
        self.stages = {
            'Preprocessing': PreprocessingStage(),
            'Segmentation': SegmentationStage(),
            'Parcellation': ParcellationStage(pipeline_mode="Diffusion"),
            'Registration': RegistrationStage(pipeline_mode="Diffusion"),
            'Diffusion': DiffusionStage(),
            'Connectome': ConnectomeStage()
        }

        Pipeline.__init__(self, project_info)

        self.stages['Segmentation'].config.on_trait_change(
            self.update_parcellation, 'seg_tool')
        self.stages['Parcellation'].config.on_trait_change(
            self.update_segmentation, 'parcellation_scheme')
Ejemplo n.º 6
0
 def __init__(self, project_info):
     self.stages = {
         'Preprocessing': PreprocessingStage(),
         'Segmentation': SegmentationStage(),
         'Parcellation': ParcellationStage(pipeline_mode="fMRI"),
         'Registration': RegistrationStage(pipeline_mode="fMRI"),
         'Functional': FunctionalStage(),
         'Connectome': ConnectomeStage()
     }
     Pipeline.__init__(self, project_info)
     self.stages['Segmentation'].config.on_trait_change(
         self.update_parcellation, 'seg_tool')
     self.stages['Parcellation'].config.on_trait_change(
         self.update_segmentation, 'parcellation_scheme')
     self.stages['Functional'].config.on_trait_change(
         self.update_nuisance_requirements, 'global_nuisance')
     self.stages['Functional'].config.on_trait_change(
         self.update_nuisance_requirements, 'csf')
     self.stages['Functional'].config.on_trait_change(
         self.update_nuisance_requirements, 'wm')
     self.stages['Connectome'].config.on_trait_change(
         self.update_scrubbing, 'apply_scrubbing')
Ejemplo n.º 7
0
    def __init__(self, project_info):
        """Constructor of a `fMRIPipeline` object.

        Parameters
        ----------
        project_info: cmp.project.ProjectInfo
            Instance of `CMP_Project_Info` object.

        See Also
        --------
        cmp.project.CMP_Project_Info
        """
        self.subjects_dir = project_info.freesurfer_subjects_dir
        self.subject_id = project_info.freesurfer_subject_id

        self.global_conf.subjects = project_info.subjects
        self.global_conf.subject = project_info.subject

        if len(project_info.subject_sessions) > 0:
            self.global_conf.subject_session = project_info.subject_session
            self.subject_directory = os.path.join(
                project_info.base_directory,
                project_info.subject,
                project_info.subject_session,
            )
        else:
            self.global_conf.subject_session = ""
            self.subject_directory = os.path.join(project_info.base_directory,
                                                  project_info.subject)

        self.derivatives_directory = os.path.abspath(
            project_info.output_directory)

        if project_info.output_directory is not None:
            self.output_directory = os.path.abspath(
                project_info.output_directory)
        else:
            self.output_directory = os.path.join(self.base_directory,
                                                 "derivatives")

        self.stages = {
            "Preprocessing":
            PreprocessingStage(bids_dir=project_info.base_directory,
                               output_dir=self.output_directory),
            "Registration":
            RegistrationStage(
                pipeline_mode="fMRI",
                fs_subjects_dir=project_info.freesurfer_subjects_dir,
                fs_subject_id=os.path.basename(
                    project_info.freesurfer_subject_id),
                bids_dir=project_info.base_directory,
                output_dir=self.output_directory,
            ),
            "FunctionalMRI":
            FunctionalMRIStage(bids_dir=project_info.base_directory,
                               output_dir=self.output_directory),
            "Connectome":
            ConnectomeStage(bids_dir=project_info.base_directory,
                            output_dir=self.output_directory),
        }

        Pipeline.__init__(self, project_info)

        self.subject = project_info.subject

        self.stages["FunctionalMRI"].config.on_trait_change(
            self.update_nuisance_requirements, "global_nuisance")
        self.stages["FunctionalMRI"].config.on_trait_change(
            self.update_nuisance_requirements, "csf")
        self.stages["FunctionalMRI"].config.on_trait_change(
            self.update_nuisance_requirements, "wm")
        self.stages["Connectome"].config.on_trait_change(
            self.update_scrubbing, "apply_scrubbing")