Esempio n. 1
0
File: qc.py Progetto: suyashdb/mriqc
class StructuralQCOutputSpec(TraitedSpec):
    summary = traits.Dict(desc='summary statistics per tissue')
    icvs = traits.Dict(desc='intracranial volume (ICV) fractions')
    rpve = traits.Dict(desc='partial volume fractions')
    size = traits.Dict(desc='image sizes')
    spacing = traits.Dict(desc='image sizes')
    inu = traits.Dict(desc='summary statistics of the bias field')
    snr = traits.Dict
    cnr = traits.Float
    fber = traits.Float
    efc = traits.Float
    qi1 = traits.Float
    qi2 = traits.Float
    wm2max = traits.Float
    cjv = traits.Float
    out_qc = traits.Dict(desc='output flattened dictionary with all measures')
    out_noisefit = File(exists=True,
                        desc='plot of background noise and chi fitting')
Esempio n. 2
0
class BetaSeriesInputSpec(BaseInterfaceInputSpec):
    bold_file = File(exists=True, mandatory=True, desc="The bold run")
    bold_metadata = traits.Dict(
        desc='Dictionary containing useful information about'
        ' the bold_file')
    mask_file = File(exists=True,
                     mandatory=True,
                     desc="Binarized nifti file indicating the brain")
    events_file = File(exists=True,
                       mandatory=True,
                       desc="File that contains all events from the bold run")
    confounds_file = traits.Either(
        None,
        File(exists=True),
        desc="File that contains all usable confounds")
    selected_confounds = traits.Either(
        None, traits.List(), desc="Column names of the regressors to include")
    hrf_model = traits.String(desc="hemodynamic response model")
    smoothing_kernel = traits.Either(
        None, traits.Float(), desc="full wide half max smoothing kernel")
    high_pass = traits.Float(0.0078125, desc="the high pass filter (Hz)")
Esempio n. 3
0
class NoiseCovarianceConnInputSpec(BaseInterfaceInputSpec):

    cov_fname_in = traits.File(exists=False,
                               desc='file name for Noise \
                               Covariance Matrix')

    raw_filename = traits.File(exists=True, desc='raw data filename')

    is_epoched = traits.Bool(desc='true if we want to epoch the data',
                             mandatory=False)

    is_evoked = traits.Bool(desc='true if we want to analyze evoked data',
                            mandatory=False)

    events_id = traits.Dict(None,
                            desc='the id of all events to consider.',
                            mandatory=False)

    t_min = traits.Float(None, desc='start time before event', mandatory=False)

    t_max = traits.Float(None, desc='end time after event', mandatory=False)
Esempio n. 4
0
    def __init__(self, infields=None, outfields=None, **kwargs):
        """
        Parameters
        ----------
        infields : list of str
            Indicates the input fields to be dynamically created

        outfields: list of str
            Indicates output fields to be dynamically created

        See class examples for usage

        """
        if not outfields:
            outfields = ['outfiles']
        super(DataGrabber, self).__init__(**kwargs)
        undefined_traits = {}
        # used for mandatory inputs check
        self._infields = infields
        if infields:
            for key in infields:
                self.inputs.add_trait(key, traits.Any)
                undefined_traits[key] = Undefined
        # add ability to insert field specific templates
        self.inputs.add_trait(
            'field_template',
            traits.Dict(traits.Enum(outfields),
                        desc="arguments that fit into template"))
        undefined_traits['field_template'] = Undefined
        if not isdefined(self.inputs.template_args):
            self.inputs.template_args = {}
        for key in outfields:
            if not key in self.inputs.template_args:
                if infields:
                    self.inputs.template_args[key] = [infields]
                else:
                    self.inputs.template_args[key] = []

        self.inputs.trait_set(trait_change_notify=False, **undefined_traits)
Esempio n. 5
0
class WMMaskingInputSpec(BaseInterfaceInputSpec):
    """
    This class represents a...
    :param BaseInterfaceInputSpec:
    """
    atlas_file = File(
        exists=True, mandatory=True,
        desc='Label map used to divide hemispheres')
    posterior_files = traits.Dict(mandatory=True, desc='Posterior probability files')
    brainlabels_file = File(exists=True, mandatory=True,
                            desc='BRAINSABC brain labels')
    atlas_info = File(exists=True, mandatory=True,
                      desc='input label information in xml format')
    dilation = traits.Int(
        default_value=0, desc="""
        Parameter to adjust the dilation of the boundary mask (default=0)
        A negative value will erode the boundary mask.
        """, use_default=True)
    csf_threshold = traits.Float(
        default_value=0.9, desc="""
        Posterior probabilities above this threshold will be considered CSF
        """, use_default=True)
    hncma_file = File(exists=True, desc="HNCMA atlas is used to define ventricles.")
Esempio n. 6
0
class LSSBetaSeriesInputSpec(BaseInterfaceInputSpec):
    bold_file = traits.Either(
        File(exists=True, mandatory=True, desc="The bold run"),
        nib.spatialimages.SpatialImage)
    bold_metadata = traits.Dict(
        desc='Dictionary containing useful information about'
        ' the bold_file')
    mask_file = traits.Either(
        File(exists=True,
             mandatory=True,
             desc="Binarized nifti file indicating the brain"),
        nib.spatialimages.SpatialImage)
    events_file = File(exists=True,
                       mandatory=True,
                       desc="File that contains all events from the bold run")
    confounds_file = traits.Either(
        None,
        File(exists=True),
        desc="File that contains all usable confounds")
    signal_scaling = traits.Enum(
        False,
        0,
        desc="Whether (0) or not (False) to scale each"
        " voxel's timeseries")
    selected_confounds = traits.Either(
        None, traits.List(), desc="Column names of the regressors to include")
    hrf_model = traits.String(desc="hemodynamic response model")
    smoothing_kernel = traits.Either(
        None, traits.Float(), desc="full wide half max smoothing kernel")
    high_pass = traits.Float(0.0078125, desc="the high pass filter (Hz)")
    fir_delays = traits.Either(None,
                               traits.List(traits.Int),
                               desc="FIR delays (in scans)",
                               default=None,
                               usedefault=True)
    return_tstat = traits.Bool(
        desc="use the T-statistic instead of the raw beta estimates")
Esempio n. 7
0
File: io.py Progetto: heffjos/ecp
class DirectoryDataSinkInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
    '''
    '''

    # Init inputspec data attributes
    base_directory = Directory(
        desc='Path to the base directory for storing data.',
        madatory=True,
        exists=True)
    _outputs = traits.Dict(Str, value={}, usedefault=True)
    remove_dest_dir = traits.Bool(
        False, usedefault=True, desc='remove dest directory when copying dirs')

    # Set call-able inputs attributes
    def __setattr__(self, key, value):

        if key not in self.copyable_trait_names():
            if not isdefined(value):
                super(DirectoryDataSinkInputSpec, self).__setattr__(key, value)
            self._outputs[key] = value
        else:
            if key in self._outputs:
                self._outputs[key] = value
            super(DirectoryDataSinkInputSpec, self).__setattr__(key, value)
Esempio n. 8
0
class JSONSinkInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
    base_directory = Directory(
        desc='Path to the base directory for writing report.')
    json_name = traits.Str('QA', usedefault=True)
    container = traits.Str(
        desc='Folder within base directory in which to store output')
    parameterization = traits.Bool(
        True, usedefault=True, desc='store output in parametrized structure')
    substitutions = InputMultiPath(traits.Tuple(traits.Str, traits.Str),
                                   desc=('List of 2-tuples reflecting string '
                                         'to substitute and string to replace '
                                         'it with'))
    regexp_substitutions = InputMultiPath(
        traits.Tuple(traits.Str, traits.Str),
        desc=('List of 2-tuples reflecting a pair '
              'of a Python regexp pattern and a '
              'replacement string. Invoked after '
              'string `substitutions`'))
    _outputs = traits.Dict(traits.Str, value={}, usedefault=True)
    _outputs_order = []
    remove_dest_dir = traits.Bool(
        False, usedefault=True, desc='remove dest directory when copying dirs')
    parameterization = traits.Bool(True, usedefault=True)
    strip_dir = Directory()

    def __setattr__(self, key, value):
        if key not in self.copyable_trait_names():
            if not isdefined(value):
                super(JSONSinkInputSpec, self).__setattr__(key, value)
            self._outputs[key] = value
            self._outputs_order.append(key)
        else:
            if key in self._outputs:
                self._outputs[key] = value
                self._outputs_order.append(key)
            super(JSONSinkInputSpec, self).__setattr__(key, value)