Beispiel #1
0
def test_MELODIC_outputs():
    output_map = dict(out_dir=dict(), report_dir=dict())
    outputs = MELODIC.output_spec()

    for key, metadata in output_map.items():
        for metakey, value in metadata.items():
            yield assert_equal, getattr(outputs.traits()[key], metakey), value
Beispiel #2
0
    def group_melodic_pipeline(self, **kwargs):

        pipeline = self.create_pipeline(
            name='group_melodic',
            inputs=[
                DatasetSpec('smoothed_ts', nifti_gz_format),
                FieldSpec('tr', float)
            ],
            outputs=[DatasetSpec('group_melodic', directory_format)],
            desc=("Group ICA"),
            version=1,
            citations=[fsl_cite],
            **kwargs)
        gica = pipeline.create_join_subjects_node(MELODIC(),
                                                  joinfield=['in_files'],
                                                  name='gica',
                                                  requirements=[fsl510_req],
                                                  wall_time=7200)
        gica.inputs.no_bet = True
        gica.inputs.bg_threshold = self.parameter('brain_thresh_percent')
        gica.inputs.bg_image = self.parameter('MNI_template')
        gica.inputs.dim = self.parameter('group_ica_components')
        gica.inputs.report = True
        gica.inputs.out_stats = True
        gica.inputs.mm_thresh = 0.5
        gica.inputs.sep_vn = True
        gica.inputs.mask = self.parameter('MNI_template_mask')
        gica.inputs.out_dir = 'group_melodic.ica'
        pipeline.connect_input('smoothed_ts', gica, 'in_files')
        pipeline.connect_input('tr', gica, 'tr_sec')

        pipeline.connect_output('group_melodic', gica, 'out_dir')

        return pipeline
Beispiel #3
0
    def single_subject_melodic_pipeline(self, **kwargs):

        pipeline = self.create_pipeline(
            name='MelodicL1',
            inputs=[
                DatasetSpec('filtered_data', nifti_gz_format),
                FieldSpec('tr', float),
                DatasetSpec('brain_mask', nifti_gz_format)
            ],
            outputs=[DatasetSpec('melodic_ica', directory_format)],
            desc=("Single subject ICA analysis using FSL MELODIC."),
            version=1,
            citations=[fsl_cite],
            **kwargs)

        mel = pipeline.create_node(MELODIC(),
                                   name='melodic_L1',
                                   wall_time=15,
                                   requirements=[fsl5_req])
        mel.inputs.no_bet = True
        pipeline.connect_input('brain_mask', mel, 'mask')
        mel.inputs.bg_threshold = self.parameter('brain_thresh_percent')
        mel.inputs.report = True
        mel.inputs.out_stats = True
        mel.inputs.mm_thresh = 0.5
        mel.inputs.out_dir = 'melodic_ica'
        pipeline.connect_input('tr', mel, 'tr_sec')
        pipeline.connect_input('filtered_data', mel, 'in_files')

        pipeline.connect_output('melodic_ica', mel, 'out_dir')

        return pipeline
Beispiel #4
0
    def group_melodic_pipeline(self, **name_maps):

        pipeline = self.new_pipeline(name='group_melodic',
                                     desc=("Group ICA"),
                                     citations=[fsl_cite],
                                     name_maps=name_maps)

        pipeline.add(MELODIC(
            no_bet=True,
            bg_threshold=self.parameter('brain_thresh_percent'),
            dim=self.parameter('group_ica_components'),
            report=True,
            out_stats=True,
            mm_thresh=0.5,
            sep_vn=True,
            out_dir='group_melodic.ica',
            output_type='NIFTI_GZ'),
                     inputs={
                         'bg_image': ('template_brain', nifti_gz_format),
                         'mask': ('template_mask', nifti_gz_format),
                         'in_files': ('smoothed_ts', nifti_gz_format),
                         'tr_sec': ('tr', float)
                     },
                     outputs={'group_melodic': ('out_dir', directory_format)},
                     joinsource=self.SUBJECT_ID,
                     joinfield=['in_files'],
                     name='gica',
                     requirements=[fsl_req.v('5.0.10')],
                     wall_time=7200)

        return pipeline
Beispiel #5
0
    def single_subject_melodic_pipeline(self, **name_maps):

        pipeline = self.new_pipeline(
            name='MelodicL1',
            desc=("Single subject ICA analysis using FSL MELODIC."),
            citations=[fsl_cite],
            name_maps=name_maps)

        pipeline.add('melodic_L1',
                     MELODIC(
                         no_bet=True,
                         bg_threshold=self.parameter('brain_thresh_percent'),
                         report=True,
                         out_stats=True,
                         mm_thresh=0.5,
                         out_dir='melodic_ica',
                         output_type='NIFTI_GZ'),
                     inputs={
                         'mask': (self.brain_mask_spec_name, nifti_gz_format),
                         'tr_sec': ('tr', float),
                         'in_files': ('filtered_data', nifti_gz_format)
                     },
                     outputs={'melodic_ica': ('out_dir', directory_format)},
                     wall_time=15,
                     requirements=[fsl_req.v('5.0.10')])

        return pipeline
Beispiel #6
0
def test_MELODIC_inputs():
    input_map = dict(
        ICs=dict(argstr="--ICs=%s"),
        approach=dict(argstr="-a %s"),
        args=dict(argstr="%s"),
        bg_image=dict(argstr="--bgimage=%s"),
        bg_threshold=dict(argstr="--bgthreshold=%f"),
        cov_weight=dict(argstr="--covarweight=%f"),
        dim=dict(argstr="-d %d"),
        dim_est=dict(argstr="--dimest=%s"),
        environ=dict(nohash=True, usedefault=True),
        epsilon=dict(argstr="--eps=%f"),
        epsilonS=dict(argstr="--epsS=%f"),
        ignore_exception=dict(nohash=True, usedefault=True),
        in_files=dict(argstr="-i %s", mandatory=True, position=0, sep=","),
        log_power=dict(argstr="--logPower"),
        mask=dict(argstr="-m %s"),
        max_restart=dict(argstr="--maxrestart=%d"),
        maxit=dict(argstr="--maxit=%d"),
        mix=dict(argstr="--mix=%s"),
        mm_thresh=dict(argstr="--mmthresh=%f"),
        no_bet=dict(argstr="--nobet"),
        no_mask=dict(argstr="--nomask"),
        no_mm=dict(argstr="--no_mm"),
        non_linearity=dict(argstr="--nl=%s"),
        num_ICs=dict(argstr="-n %d"),
        out_all=dict(argstr="--Oall"),
        out_dir=dict(argstr="-o %s", genfile=True),
        out_mean=dict(argstr="--Omean"),
        out_orig=dict(argstr="--Oorig"),
        out_pca=dict(argstr="--Opca"),
        out_stats=dict(argstr="--Ostats"),
        out_unmix=dict(argstr="--Ounmix"),
        out_white=dict(argstr="--Owhite"),
        output_type=dict(),
        pbsc=dict(argstr="--pbsc"),
        rem_cmp=dict(argstr="-f %d"),
        remove_deriv=dict(argstr="--remove_deriv"),
        report=dict(argstr="--report"),
        report_maps=dict(argstr="--report_maps=%s"),
        s_con=dict(argstr="--Scon=%s"),
        s_des=dict(argstr="--Sdes=%s"),
        sep_vn=dict(argstr="--sep_vn"),
        sep_whiten=dict(argstr="--sep_whiten"),
        smode=dict(argstr="--smode=%s"),
        t_con=dict(argstr="--Tcon=%s"),
        t_des=dict(argstr="--Tdes=%s"),
        terminal_output=dict(mandatory=True, nohash=True),
        tr_sec=dict(argstr="--tr=%f"),
        update_mask=dict(argstr="--update_mask"),
        var_norm=dict(argstr="--vn"),
    )
    inputs = MELODIC.input_spec()

    for key, metadata in input_map.items():
        for metakey, value in metadata.items():
            yield assert_equal, getattr(inputs.traits()[key], metakey), value
Beispiel #7
0
def test_MELODIC_outputs():
    output_map = dict(
        out_dir=dict(),
        report_dir=dict(),
    )
    outputs = MELODIC.output_spec()

    for key, metadata in output_map.items():
        for metakey, value in metadata.items():
            yield assert_equal, getattr(outputs.traits()[key], metakey), value
Beispiel #8
0
def test_MELODIC_inputs():
    input_map = dict(
        ICs=dict(argstr='--ICs=%s', ),
        approach=dict(argstr='-a %s', ),
        args=dict(argstr='%s', ),
        bg_image=dict(argstr='--bgimage=%s', ),
        bg_threshold=dict(argstr='--bgthreshold=%f', ),
        cov_weight=dict(argstr='--covarweight=%f', ),
        dim=dict(argstr='-d %d', ),
        dim_est=dict(argstr='--dimest=%s', ),
        environ=dict(
            nohash=True,
            usedefault=True,
        ),
        epsilon=dict(argstr='--eps=%f', ),
        epsilonS=dict(argstr='--epsS=%f', ),
        ignore_exception=dict(
            nohash=True,
            usedefault=True,
        ),
        in_files=dict(
            argstr='-i %s',
            mandatory=True,
            position=0,
            sep=',',
        ),
        log_power=dict(argstr='--logPower', ),
        mask=dict(argstr='-m %s', ),
        max_restart=dict(argstr='--maxrestart=%d', ),
        maxit=dict(argstr='--maxit=%d', ),
        mix=dict(argstr='--mix=%s', ),
        mm_thresh=dict(argstr='--mmthresh=%f', ),
        no_bet=dict(argstr='--nobet', ),
        no_mask=dict(argstr='--nomask', ),
        no_mm=dict(argstr='--no_mm', ),
        non_linearity=dict(argstr='--nl=%s', ),
        num_ICs=dict(argstr='-n %d', ),
        out_all=dict(argstr='--Oall', ),
        out_dir=dict(
            argstr='-o %s',
            genfile=True,
        ),
        out_mean=dict(argstr='--Omean', ),
        out_orig=dict(argstr='--Oorig', ),
        out_pca=dict(argstr='--Opca', ),
        out_stats=dict(argstr='--Ostats', ),
        out_unmix=dict(argstr='--Ounmix', ),
        out_white=dict(argstr='--Owhite', ),
        output_type=dict(),
        pbsc=dict(argstr='--pbsc', ),
        rem_cmp=dict(argstr='-f %d', ),
        remove_deriv=dict(argstr='--remove_deriv', ),
        report=dict(argstr='--report', ),
        report_maps=dict(argstr='--report_maps=%s', ),
        s_con=dict(argstr='--Scon=%s', ),
        s_des=dict(argstr='--Sdes=%s', ),
        sep_vn=dict(argstr='--sep_vn', ),
        sep_whiten=dict(argstr='--sep_whiten', ),
        smode=dict(argstr='--smode=%s', ),
        t_con=dict(argstr='--Tcon=%s', ),
        t_des=dict(argstr='--Tdes=%s', ),
        terminal_output=dict(nohash=True, ),
        tr_sec=dict(argstr='--tr=%f', ),
        update_mask=dict(argstr='--update_mask', ),
        var_norm=dict(argstr='--vn', ),
    )
    inputs = MELODIC.input_spec()

    for key, metadata in input_map.items():
        for metakey, value in metadata.items():
            yield assert_equal, getattr(inputs.traits()[key], metakey), value