How to use the nipype.interfaces.base.traits.Either 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 beOn / hcpre / hcpre / interfaces.py View on Github external
desc="a list of nifti files to be categorized, matched up, etc.",
            copyfile=False)
    series_map = traits.Dict(
            key_trait=traits.Str(),
            value_trait=traits.List(),
            value = {},
            mandatory=False,
            usedefault=True,
            desc="keys are any member of SCAN_TYPES, values are lists of series\
                  descriptions as recorded in DICOM headers.")
    dicom_info = traits.List(
            mandatory=True,
            desc="one dict for each series in the session, in the order they were\
                  run. each dict should contain at least the series_num (int) and\
                  the series_desc (str).")
    ep_echo_spacing = traits.Either(traits.Enum("NONE"), traits.Float(),
            desc="""
            The effective echo spacing of your BOLD images. Already accounts
            for whether or not iPAT (acceleration in the phase direction) was
            used. If you're using acceleration, then the EES is not going to
            match the 'Echo Spacing' that Siemen's reports in the console.

            Setting this value will prevent any attempt to derive it.""")
    ep_unwarp_dir = traits.Enum("x", "x-", "-x", "y", "y-", "-y", "z", "z-", "-z",
            desc="Setting this value will prevent any attempt to derive it.")
    block_struct_averaging = traits.Bool(False,
            mandatory=False, usedefault=True,
            desc="""
            Causes us to only use the first t1 and t2 images. A kludge for
            some data that fails during structural averaging.""")
    ep_fieldmap_selection = traits.Enum("first","most_recent",
            mandatory=False, usedefault=True,
github nipy / nipype / nipype / interfaces / slicer / BRAINSResample.py View on Github external
"""Autogenerated file - DO NOT EDIT

If you spot a bug, please report it on the mailing list and/or change the generator."""

from nipype.interfaces.base import CommandLine, CommandLineInputSpec, TraitedSpec, File, Directory, traits, isdefined, InputMultiPath, OutputMultiPath
import os
from nipype.interfaces.slicer.base import SlicerCommandLine


class BRAINSResampleInputSpec(CommandLineInputSpec):
    inputVolume = File(desc="Image To Warp", exists=True, argstr="--inputVolume %s")
    referenceVolume = File(desc="Reference image used only to define the output space. If not specified, the warping is done in the same space as the image to warp.", exists=True, argstr="--referenceVolume %s")
    outputVolume = traits.Either(traits.Bool, File(), hash_files=False, desc="Resulting deformed image", argstr="--outputVolume %s")
    pixelType = traits.Enum("float", "short", "ushort", "int", "uint", "uchar", "binary", desc="Specifies the pixel type for the input/output images.  The \"binary\" pixel type uses a modified algorithm whereby the image is read in as unsigned char, a signed distance map is created, signed distance map is resampled, and then a thresholded image of type unsigned char is written to disk.", argstr="--pixelType %s")
    deformationVolume = File(desc="Displacement Field to be used to warp the image", exists=True, argstr="--deformationVolume %s")
    warpTransform = File(desc="Filename for the BRAINSFit transform used in place of the deformation field", exists=True, argstr="--warpTransform %s")
    interpolationMode = traits.Enum("NearestNeighbor", "Linear", "ResampleInPlace", "BSpline", "WindowedSinc", "Hamming", "Cosine", "Welch", "Lanczos", "Blackman", desc="Type of interpolation to be used when applying transform to moving volume.  Options are Linear, ResampleInPlace, NearestNeighbor, BSpline, or WindowedSinc", argstr="--interpolationMode %s")
    inverseTransform = traits.Bool(desc="True/False is to compute inverse of given transformation. Default is false", argstr="--inverseTransform ")
    defaultValue = traits.Float(desc="Default voxel value", argstr="--defaultValue %f")
    gridSpacing = InputMultiPath(traits.Int, desc="Add warped grid to output image to help show the deformation that occured with specified spacing.   A spacing of 0 in a dimension indicates that grid lines should be rendered to fall exactly (i.e. do not allow displacements off that plane).  This is useful for makeing a 2D image of grid lines from the 3D space ", sep=",", argstr="--gridSpacing %s")
    numberOfThreads = traits.Int(desc="Explicitly specify the maximum number of threads to use.", argstr="--numberOfThreads %d")


class BRAINSResampleOutputSpec(TraitedSpec):
    outputVolume = File(desc="Resulting deformed image", exists=True)


class BRAINSResample(SlicerCommandLine):
    """title: Resample Image (BRAINS)
github nipy / nipype / nipype / interfaces / slicer / filtering / extractskeleton.py View on Github external
CommandLineInputSpec,
    SEMLikeCommandLine,
    TraitedSpec,
    File,
    Directory,
    traits,
    isdefined,
    InputMultiPath,
    OutputMultiPath,
)
import os


class ExtractSkeletonInputSpec(CommandLineInputSpec):
    InputImageFileName = File(position=-2, desc="Input image", exists=True, argstr="%s")
    OutputImageFileName = traits.Either(
        traits.Bool,
        File(),
        position=-1,
        hash_files=False,
        desc="Skeleton of the input image",
        argstr="%s",
    )
    type = traits.Enum(
        "1D", "2D", desc="Type of skeleton to create", argstr="--type %s"
    )
    dontPrune = traits.Bool(
        desc="Return the full skeleton, not just the maximal skeleton",
        argstr="--dontPrune ",
    )
    numPoints = traits.Int(
        desc="Number of points used to represent the skeleton", argstr="--numPoints %d"
github nipy / nipype / nipype / interfaces / slicer / gtractCoregBvalues.py View on Github external
"""Autogenerated file - DO NOT EDIT

If you spot a bug, please report it on the mailing list and/or change the generator."""

from nipype.interfaces.base import CommandLine, CommandLineInputSpec, TraitedSpec, File, Directory, traits, isdefined, InputMultiPath, OutputMultiPath
import os
from nipype.interfaces.slicer.base import SlicerCommandLine


class gtractCoregBvaluesInputSpec(CommandLineInputSpec):
    movingVolume = File(desc="Required: input moving image file name. In order to register gradients within a scan to its first gradient, set the movingVolume and fixedVolume as the same image.", exists=True, argstr="--movingVolume %s")
    fixedVolume = File(desc="Required: input fixed image file name. It is recommended that this image should either contain or be a b0 image.", exists=True, argstr="--fixedVolume %s")
    fixedVolumeIndex = traits.Int(desc="Index in the fixed image for registration. It is recommended that this image should be a b0 image.", argstr="--fixedVolumeIndex %d")
    outputVolume = traits.Either(traits.Bool, File(), hash_files=False, desc="Required: name of output NRRD file containing moving images individually resampled and fit to the specified fixed image index.", argstr="--outputVolume %s")
    outputTransform = traits.Either(traits.Bool, File(), hash_files=False, desc="Registration 3D transforms concatenated in a single output file.  There are no tools that can use this, but can be used for debugging purposes.", argstr="--outputTransform %s")
    eddyCurrentCorrection = traits.Bool(desc="Flag to perform eddy current corection in addition to motion correction (recommended)", argstr="--eddyCurrentCorrection ")
    numberOfIterations = traits.Int(desc="Number of iterations in each 3D fit", argstr="--numberOfIterations %d")
    numberOfSpatialSamples = traits.Int(desc="Number of voxels sampled for mutual information computation in each 3D fit step", argstr="--numberOfSpatialSamples %d")
    relaxationFactor = traits.Float(desc="Fraction of gradient from Jacobian to attempt to move in each 3D fit step (adjust when eddyCurrentCorrection is enabled; suggested value = 0.25)", argstr="--relaxationFactor %f")
    maximumStepSize = traits.Float(desc="Maximum permitted step size to move in each 3D fit step (adjust when eddyCurrentCorrection is enabled; suggested value = 0.1)", argstr="--maximumStepSize %f")
    minimumStepSize = traits.Float(desc="Minimum required step size to move in each 3D fit step without converging -- decrease this to make the fit more exacting", argstr="--minimumStepSize %f")
    spatialScale = traits.Float(desc="How much to scale up changes in position compared to unit rotational changes in radians -- decrease this to put more rotation in the fit", argstr="--spatialScale %f")
    registerB0Only = traits.Bool(desc="Register the B0 images only", argstr="--registerB0Only ")
    debugLevel = traits.Int(desc="Display debug messages, and produce debug intermediate results.  0=OFF, 1=Minimal, 10=Maximum debugging.", argstr="--debugLevel %d")
    numberOfThreads = traits.Int(desc="Explicitly specify the maximum number of threads to use.", argstr="--numberOfThreads %d")


class gtractCoregBvaluesOutputSpec(TraitedSpec):
    outputVolume = File(desc="Required: name of output NRRD file containing moving images individually resampled and fit to the specified fixed image index.", exists=True)
    outputTransform = File(desc="Registration 3D transforms concatenated in a single output file.  There are no tools that can use this, but can be used for debugging purposes.", exists=True)
github nipy / nipype / nipype / interfaces / fsl / model.py View on Github external
return outputs


class ClusterInputSpec(FSLCommandInputSpec):
    in_file = File(argstr="--in=%s", mandatory=True, exists=True, desc="input volume")
    threshold = traits.Float(
        argstr="--thresh=%.10f", mandatory=True, desc="threshold for input volume"
    )
    out_index_file = traits.Either(
        traits.Bool,
        File,
        argstr="--oindex=%s",
        desc="output of cluster index (in size order)",
        hash_files=False,
    )
    out_threshold_file = traits.Either(
        traits.Bool,
        File,
        argstr="--othresh=%s",
        desc="thresholded image",
        hash_files=False,
    )
    out_localmax_txt_file = traits.Either(
        traits.Bool,
        File,
        argstr="--olmax=%s",
        desc="local maxima text file",
        hash_files=False,
    )
    out_localmax_vol_file = traits.Either(
        traits.Bool,
        File,
github nipy / nipype / nipype / interfaces / slicer / utilities.py View on Github external
Directory,
    traits,
    isdefined,
    InputMultiPath,
    OutputMultiPath,
)
import os


class EMSegmentTransformToNewFormatInputSpec(CommandLineInputSpec):
    inputMRMLFileName = File(
        desc="Active MRML scene that contains EMSegment algorithm parameters in the format before 3.6.3 - please include absolute  file name in path.",
        exists=True,
        argstr="--inputMRMLFileName %s",
    )
    outputMRMLFileName = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc="Write out the MRML scene after transformation to format 3.6.3 has been made. - has to be in the same directory as the input MRML file due to Slicer Core bug  - please include absolute  file name in path ",
        argstr="--outputMRMLFileName %s",
    )
    templateFlag = traits.Bool(
        desc="Set to true if the transformed mrml file should be used as template file ",
        argstr="--templateFlag ",
    )


class EMSegmentTransformToNewFormatOutputSpec(TraitedSpec):
    outputMRMLFileName = File(
        desc="Write out the MRML scene after transformation to format 3.6.3 has been made. - has to be in the same directory as the input MRML file due to Slicer Core bug  - please include absolute  file name in path ",
        exists=True,
github poldracklab / niworkflows / niworkflows / interfaces / registration.py View on Github external
class ApplyXFMRPT(FLIRTRPT, fsl.ApplyXFM):
    input_spec = _ApplyXFMInputSpecRPT
    output_spec = _FLIRTOutputSpecRPT


if LooseVersion("0.0.0") < fs.Info.looseversion() < LooseVersion("6.0.0"):
    _BBRegisterInputSpec = fs.preprocess.BBRegisterInputSpec
else:
    _BBRegisterInputSpec = fs.preprocess.BBRegisterInputSpec6


class _BBRegisterInputSpecRPT(nrc._SVGReportCapableInputSpec, _BBRegisterInputSpec):
    # Adds default=True, usedefault=True
    out_lta_file = traits.Either(
        traits.Bool,
        File,
        default=True,
        usedefault=True,
        argstr="--lta %s",
        min_ver="5.2.0",
        desc="write the transformation matrix in LTA format",
    )


class _BBRegisterOutputSpecRPT(
    reporting.ReportCapableOutputSpec, fs.preprocess.BBRegisterOutputSpec
):
    pass
github nipy / nipype / nipype / interfaces / minc / minc.py View on Github external
variables = InputMultiPath(
        traits.Str,
        desc='Output data for specified variables only.',
        sep=',',
        argstr='-v %s')

    line_length = traits.Range(
        low=0,
        desc='Line length maximum in data section (default 80).',
        argstr='-l %d')

    netcdf_name = traits.Str(
        desc='Name for netCDF (default derived from file name).',
        argstr='-n %s')

    precision = traits.Either(
        traits.Int(),
        traits.Tuple(traits.Int, traits.Int),
        desc='Display floating-point values with less precision',
        argstr='%s',
    )  # See _format_arg in Dump for actual formatting.


class DumpOutputSpec(TraitedSpec):
    output_file = File(desc='output file', exists=True)


class Dump(StdOutCommandLine):
    """Dump a MINC file. Typically used in conjunction with mincgen (see Gen).

    Examples
    --------
github nipy / nipype / nipype / interfaces / semtools / segmentation / specialized.py View on Github external
argstr="--restoreState %s",
    )
    saveState = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc="(optional) Filename to which save the final state of the registration",
        argstr="--saveState %s",
    )
    inputVolumeTypes = InputMultiPath(
        traits.Str,
        desc="The list of input image types corresponding to the inputVolumes.",
        sep=",",
        argstr="--inputVolumeTypes %s",
    )
    outputDir = traits.Either(
        traits.Bool,
        Directory(),
        hash_files=False,
        desc="Ouput directory",
        argstr="--outputDir %s",
    )
    atlasToSubjectTransformType = traits.Enum(
        "Identity",
        "Rigid",
        "Affine",
        "BSpline",
        "SyN",
        desc=" What type of linear transform type do you want to use to register the atlas to the reference subject image.",
        argstr="--atlasToSubjectTransformType %s",
    )
    atlasToSubjectTransform = traits.Either(
github nipy / nipype / nipype / interfaces / slicer / gtractConcatDwi.py View on Github external
"""Autogenerated file - DO NOT EDIT

If you spot a bug, please report it on the mailing list and/or change the generator."""

from nipype.interfaces.base import CommandLine, CommandLineInputSpec, TraitedSpec, File, Directory, traits, isdefined, InputMultiPath, OutputMultiPath
import os
from nipype.interfaces.slicer.base import SlicerCommandLine


class gtractConcatDwiInputSpec(CommandLineInputSpec):
    inputVolume = InputMultiPath(File(exists=True), desc="Required: input file containing the first diffusion weighted image", argstr="--inputVolume %s...")
    outputVolume = traits.Either(traits.Bool, File(), hash_files=False, desc="Required: name of output NRRD file containing the combined diffusion weighted images.", argstr="--outputVolume %s")
    numberOfThreads = traits.Int(desc="Explicitly specify the maximum number of threads to use.", argstr="--numberOfThreads %d")


class gtractConcatDwiOutputSpec(TraitedSpec):
    outputVolume = File(desc="Required: name of output NRRD file containing the combined diffusion weighted images.", exists=True)


class gtractConcatDwi(SlicerCommandLine):
    """title: Concat DWI Images

category: Diffusion.GTRACT

description: This program will concatenate two DTI runs together.

version: 4.0.0