How to use the nipype.interfaces.base.File function in nipype

To help you get started, we’ve selected a few nipype examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nipy / nipype / nipype / interfaces / niftyfit / asl.py View on Github external
# *** Output options:
    desc = "Filename of the Cerebral Blood Flow map (in ml/100g/min)."
    cbf_file = File(
        name_source=["source_file"],
        name_template="%s_cbf.nii.gz",
        argstr="-cbf %s",
        desc=desc,
    )
    error_file = File(
        name_source=["source_file"],
        name_template="%s_error.nii.gz",
        argstr="-error %s",
        desc="Filename of the CBF error map.",
    )
    syn_file = File(
        name_source=["source_file"],
        name_template="%s_syn.nii.gz",
        argstr="-syn %s",
        desc="Filename of the synthetic ASL data.",
    )

    # *** Input options (see also fit_qt1 for generic T1 fitting):
    desc = "Filename of the estimated input T1 map (in ms)."
    t1map = File(exists=True, argstr="-t1map %s", desc=desc)
    desc = "Filename of the estimated input M0 map."
    m0map = File(exists=True, argstr="-m0map %s", desc=desc)
    desc = "Filename of the estimated input M0 map error."
    m0mape = File(exists=True, argstr="-m0mape %s", desc=desc)
    desc = "Filename of a [1,2,5]s Inversion Recovery volume (T1/M0 fitting \
carried out internally)."
github nipy / nipype / nipype / interfaces / fsl / dti.py View on Github external
XFibres = XFibres5
BEDPOSTX = BEDPOSTX5


class ProbTrackXBaseInputSpec(FSLCommandInputSpec):
    thsamples = InputMultiPath(File(exists=True), mandatory=True)
    phsamples = InputMultiPath(File(exists=True), mandatory=True)
    fsamples = InputMultiPath(File(exists=True), mandatory=True)
    samples_base_name = traits.Str(
        "merged",
        desc=('the rootname/base_name for samples '
              'files'),
        argstr='--samples=%s',
        usedefault=True)
    mask = File(
        exists=True,
        desc='bet binary mask file in diffusion space',
        argstr='-m %s',
        mandatory=True)
    seed = traits.Either(
        File(exists=True),
        traits.List(File(exists=True)),
        traits.List(traits.List(traits.Int(), minlen=3, maxlen=3)),
        desc=('seed volume(s), or voxel(s) or freesurfer '
              'label file'),
        argstr='--seed=%s',
        mandatory=True)
    target_masks = InputMultiPath(
        File(exits=True),
        desc=('list of target masks - required for '
              'seeds_to_targets classification'),
github nipy / nipype / nipype / interfaces / mrtrix / tensors.py View on Github external
desc='the number of directions to generate.')

    power = traits.Float(
        argstr='-power %s',
        desc='specify exponent to use for repulsion power law.')
    niter = traits.Int(
        argstr='-niter %s',
        desc='specify the maximum number of iterations to perform.')
    display_info = traits.Bool(
        argstr='-info', desc='Display information messages.')
    quiet_display = traits.Bool(
        argstr='-quiet',
        desc='do not display information messages or progress status.')
    display_debug = traits.Bool(
        argstr='-debug', desc='Display debugging messages.')
    out_file = File(
        name_source=['num_dirs'],
        name_template='directions_%d.txt',
        argstr='%s',
        hash_files=False,
        position=-1,
        desc='the text file to write the directions to, as [ az el ] pairs.')


class GenerateDirectionsOutputSpec(TraitedSpec):
    out_file = File(exists=True, desc='directions file')


class GenerateDirections(CommandLine):
    """
    generate a set of directions evenly distributed over a hemisphere.
github nipy / nipype / nipype / interfaces / freesurfer / utils.py View on Github external
class MRIsConvertInputSpec(FSTraitedSpec):
    """
    Uses Freesurfer's mris_convert to convert surface files to various formats
    """
    annot_file = File(exists=True, argstr="--annot %s",
                      desc="input is annotation or gifti label data")

    parcstats_file = File(exists=True, argstr="--parcstats %s",
                          desc="infile is name of text file containing label/val pairs")

    label_file = File(exists=True, argstr="--label %s",
                      desc="infile is .label file, label is name of this label")

    scalarcurv_file = File(exists=True, argstr="-c %s",
                           desc="input is scalar curv overlay file (must still specify surface)")

    functional_file = File(exists=True, argstr="-f %s",
                           desc="input is functional time-series or other multi-frame data (must specify surface)")

    labelstats_outfile = File(exists=False, argstr="--labelstats %s",
                              desc="outfile is name of gifti file to which label stats will be written")

    patch = traits.Bool(argstr="-p", desc="input is a patch, not a full surface")
    rescale = traits.Bool(argstr="-r", desc="rescale vertex xyz so total area is same as group average")
    normal = traits.Bool(argstr="-n", desc="output is an ascii file where vertex data")
    xyz_ascii = traits.Bool(argstr="-a", desc="Print only surface xyz to ascii file")
    vertex = traits.Bool(argstr="-v", desc="Writes out neighbors of a vertex in each row")

    scale = traits.Float(argstr="-s %.3f", desc="scale vertex xyz by scale")
    dataarray_num = traits.Int(argstr="--da_num %d", desc="if input is gifti, 'num' specifies which data array to use")
github FCP-INDI / C-PAC / CPAC / interfaces / afni / preprocess.py View on Github external
class ThreedvolregInputSpec(AFNITraitedSpec):
    in_file = File(desc = 'input file to 3dvolreg',
                  argstr = '%s',
                  position = -1,
                  mandatory = True,
                  exists = True)
    out_file = File(desc = 'output file from 3dvolreg',
                   argstr = '-prefix %s',
                   position = -2,
                   genfile = True)
    basefile = File(desc = 'base file for registration',
                    argstr = '-base %s',
                    position = -6)
    zpad = File(desc = 'Zeropad around the edges by \'n\' voxels during rotations',
                    argstr = '-zpad %s',
                    position = -5)
    md1d_file = File(desc = 'max displacement output file',
                    argstr = '-maxdisp1D %s',
                    position = -4,
                    genfile=True)
    oned_file = File(desc = '1D movement parameters output file',
                    argstr = '-1Dfile %s',
                    position = -3,
            genfile = True)
    
    mat1d_file = File(desc = '1D matrix transformation from base to input coordinates',
                    argstr = '-1Dmatrix_save %s',
                    position = -7,
            genfile = True)
github nipy / nipype / nipype / interfaces / elastix / registration.py View on Github external
iflogger = logging.getLogger('nipype.interface')


class RegistrationInputSpec(ElastixBaseInputSpec):
    fixed_image = File(
        exists=True, mandatory=True, argstr='-f %s', desc='fixed image')
    moving_image = File(
        exists=True, mandatory=True, argstr='-m %s', desc='moving image')
    parameters = InputMultiPath(
        File(exists=True),
        mandatory=True,
        argstr='-p %s...',
        desc='parameter file, elastix handles 1 or more -p')
    fixed_mask = File(
        exists=True, argstr='-fMask %s', desc='mask for fixed image')
    moving_mask = File(
        exists=True, argstr='-mMask %s', desc='mask for moving image')
    initial_transform = File(
        exists=True,
        argstr='-t0 %s',
        desc='parameter file for initial transform')


class RegistrationOutputSpec(TraitedSpec):
    transform = InputMultiPath(File(exists=True), desc='output transform')
    warped_file = File(desc='input moving image warped to fixed image')
    warped_files = InputMultiPath(
        File(exists=False),
        desc=('input moving image warped to fixed image at each level'))
    warped_files_flags = traits.List(
        traits.Bool(False),
        desc='flag indicating if warped image was generated')
github poldracklab / niworkflows / niworkflows / interfaces / utils.py View on Github external
self.inputs.in_mask,
            mask_erode_mm,
            erode_mm,
            mask_erode_prop,
            erode_prop,
            self.inputs.prob_thresh,
            newpath=runtime.cwd,
        )
        self._results["roi_file"] = roi_file
        self._results["eroded_mask"] = eroded_mask
        return runtime


class _AddTPMsInputSpec(BaseInterfaceInputSpec):
    in_files = InputMultiPath(
        File(exists=True), mandatory=True, desc="input list of ROIs"
    )
    indices = traits.List(traits.Int, desc="select specific maps")


class _AddTPMsOutputSpec(TraitedSpec):
    out_file = File(exists=True, desc="union of binarized input files")


class AddTPMs(SimpleInterface):
    """Calculate the union of several :abbr:`TPMs (tissue-probability map)`"""

    input_spec = _AddTPMsInputSpec
    output_spec = _AddTPMsOutputSpec

    def _run_interface(self, runtime):
        in_files = self.inputs.in_files
github nipy / nipype / nipype / interfaces / freesurfer / model.py View on Github external
use_weights = traits.Bool(
        argstr='-W',
        desc=('Use the weights from a previously '
              'generated weight file'))
    images = InputMultiPath(
        File(exists=True),
        argstr='%s',
        mandatory=True,
        copyfile=False,
        desc='list of input FLASH images',
        position=-1)


class MS_LDAOutputSpec(TraitedSpec):
    weight_file = File(exists=True, desc='')
    vol_synth_file = File(exists=True, desc='')


class MS_LDA(FSCommand):
    """Perform LDA reduction on the intensity space of an arbitrary # of FLASH images

    Examples
    --------

    >>> grey_label = 2
    >>> white_label = 3
    >>> zero_value = 1
    >>> optimalWeights = MS_LDA(lda_labels=[grey_label, white_label], \
                                label_file='label.mgz', weight_file='weights.txt', \
                                shift=zero_value, vol_synth_file='synth_out.mgz', \
                                conform=True, use_weights=True, \
                                images=['FLASH1.mgz', 'FLASH2.mgz', 'FLASH3.mgz'])
github nipy / nipype / nipype / interfaces / fsl / preprocess.py View on Github external
icorr_only = traits.Bool(argstr='--icorronly', requires=['unwarped_file'],
                             desc='apply intensity correction only')
    mask_file = File(exists=True, argstr='--mask=%s', desc='filename for loading valid mask')
    nokspace = traits.Bool(False, argstr='--nokspace', desc='do not use k-space forward warping')

    # Special outputs: shift (voxel shift map, vsm)
    save_shift = traits.Bool(False, xor=['save_unmasked_shift'],
                             desc='write pixel shift volume')
    shift_out_file = File(argstr='--saveshift=%s', desc='filename for saving pixel shift volume')
    save_unmasked_shift = traits.Bool(argstr='--unmaskshift', xor=['save_shift'],
                                      desc='saves the unmasked shiftmap when using --saveshift')

    # Special outputs: fieldmap (fmap)
    save_fmap = traits.Bool(False, xor=['save_unmasked_fmap'],
                            desc='write field map volume')
    fmap_out_file = File(argstr='--savefmap=%s', desc='filename for saving fieldmap (rad/s)')
    save_unmasked_fmap = traits.Bool(False, argstr='--unmaskfmap', xor=['save_fmap'],
                                     desc='saves the unmasked fieldmap when using --savefmap')




class FUGUEOutputSpec(TraitedSpec):
    unwarped_file = File(desc='unwarped file')
    warped_file = File(desc='forward warped file')
    shift_out_file = File(desc='voxel shift map file')
    fmap_out_file = File(desc='fieldmap file')


class FUGUE(FSLCommand):
    """
    `FUGUE `_ is, most generally, a set of tools for
github nipy / nipype / nipype / algorithms / confounds.py View on Github external
desc='Divide value in each voxel at each timepoint '
        'by the median calculated across all voxels'
        'and timepoints within the mask (if specified)'
        'and then multiply by the value specified by'
        'this parameter. By using the default (1000)'
        'output DVARS will be expressed in '
        'x10 % BOLD units compatible with Power et al.'
        '2012. Set this to 0 to disable intensity'
        'normalization altogether.')


class ComputeDVARSOutputSpec(TraitedSpec):
    out_std = File(exists=True, desc='output text file')
    out_nstd = File(exists=True, desc='output text file')
    out_vxstd = File(exists=True, desc='output text file')
    out_all = File(exists=True, desc='output text file')
    avg_std = traits.Float()
    avg_nstd = traits.Float()
    avg_vxstd = traits.Float()
    fig_std = File(exists=True, desc='output DVARS plot')
    fig_nstd = File(exists=True, desc='output DVARS plot')
    fig_vxstd = File(exists=True, desc='output DVARS plot')


class ComputeDVARS(BaseInterface):
    """
    Computes the DVARS.
    """
    input_spec = ComputeDVARSInputSpec
    output_spec = ComputeDVARSOutputSpec
    references_ = [{
        'entry':