Example #1
0
class CAT12SegmentInputSpec(SPMCommandInputSpec):
    in_files = InputMultiPath(
        ImageFileSPM(exists=True),
        field="data",
        desc="file to segment",
        mandatory=True,
        copyfile=False,
    )

    _help_tpm = (
        "Tissue Probability Map. Select the tissue probability image that includes 6 tissue probability "
        "classes for (1) grey matter, (2) white matter, (3) cerebrospinal fluid, (4) bone, (5) non-brain  "
        "soft tissue, and (6) the background.  CAT uses the TPM only for the initial SPM segmentation."
    )
    tpm = InputMultiPath(
        ImageFileSPM(exists=True),
        field="tpm",
        desc=_help_tpm,
        mandatory=False,
        copyfile=False,
    )

    _help_shoots_tpm = (
        "Shooting Template %d.  The Shooting template must be in multi-volume nifti format and should contain GM,"
        " WM, and background segmentations and have to be saved with at least 16 bit. "
    )

    shooting_tpm = ImageFileSPM(
        exists=True,
        field="extopts.registration.shooting.shootingtpm",
        desc=_help_shoots_tpm % 0,
        mandatory=False,
        copyfile=False,
    )

    shooting_tpm_template_1 = ImageFileSPM(exists=True,
                                           desc=_help_shoots_tpm % 1,
                                           mandatory=False,
                                           copyfile=False)
    shooting_tpm_template_2 = ImageFileSPM(exists=True,
                                           desc=_help_shoots_tpm % 2,
                                           mandatory=False,
                                           copyfile=False)
    shooting_tpm_template_3 = ImageFileSPM(exists=True,
                                           desc=_help_shoots_tpm % 3,
                                           mandatory=False,
                                           copyfile=False)
    shooting_tpm_template_4 = ImageFileSPM(exists=True,
                                           desc=_help_shoots_tpm % 4,
                                           mandatory=False,
                                           copyfile=False)

    n_jobs = traits.Int(1,
                        usedefault=True,
                        mandatory=True,
                        field="nproc",
                        desc="Number of threads")

    _help_affine_reg = (
        "Affine Regularization. The procedure is a local optimisation, so it needs reasonable initial "
        "starting estimates. Images should be placed in approximate alignment using the Display "
        "function of SPM before beginning.  A Mutual Information affine registration with the tissue "
        "probability maps (D"
        "Agostino et al, 2004) is used to achieve approximate alignment.")
    affine_regularization = Str(default_value="mni",
                                field="opts.affreg",
                                usedefault=True,
                                desc=_help_affine_reg)

    _help_bias_acc = (
        "Strength of the SPM inhomogeneity (bias) correction that simultaneously controls the SPM "
        "biasreg, biasfwhm, samp (resolution), and tol (iteration) parameter.")
    power_spm_inhomogeneity_correction = traits.Float(default_value=0.5,
                                                      field="opts.biasacc",
                                                      usedefault=True,
                                                      desc=_help_bias_acc)
    # Extended options for CAT12 preprocessing
    _help_app = (
        "Affine registration and SPM preprocessing can fail in some subjects with deviating anatomy (e.g. "
        "other species/neonates) or in images with strong signal inhomogeneities, or untypical intensities "
        "(e.g. synthetic images). An initial bias correction can help to reduce such problems (see details "
        'below). Recommended are the "default" and "full" option.')
    affine_preprocessing = traits.Int(1070,
                                      field="extopts.APP",
                                      desc=_help_app,
                                      usedefault=True)

    _help_initial_seg = (
        "In rare cases the Unified Segmentation can fail in highly abnormal brains, where e.g. the "
        "cerebrospinal fluid of superlarge ventricles (hydrocephalus) were classified as white "
        "matter. However, if the affine registration is correct, the AMAP segmentation with an "
        "prior-independent k-means initialization can be used to replace the SPM brain tissue "
        "classification. Moreover, if the default Dartel and Shooting registrations will fail then "
        'rhe "Optimized Shooting - superlarge ventricles" option for "Spatial registration" is ! '
        "required Values: \nnone: 0;\nlight: 1;\nfull: 2;\ndefault: 1070.")
    initial_segmentation = traits.Int(0,
                                      field="extopts.spm_kamap",
                                      desc=_help_initial_seg,
                                      usedefault=True)

    _help_las = (
        "Additionally to WM-inhomogeneities, GM intensity can vary across different regions such as the motor"
        " cortex, the basal ganglia, or the occipital lobe. These changes have an anatomical background "
        "(e.g. iron content, myelinization), but are dependent on the MR-protocol and often lead to "
        "underestimation of GM at higher intensities and overestimation of CSF at lower intensities. "
        "Therefore, a local intensity transformation of all tissue classes is used to reduce these effects in"
        " the image. This local adaptive segmentation (LAS) is applied before the final AMAP segmentation."
        "Possible Values: \nSPM Unified Segmentation: 0 \nk-means AMAP: 2")
    local_adaptive_seg = traits.Float(0.5,
                                      field="extopts.LASstr",
                                      usedefault=True,
                                      desc=_help_las)

    _help_gcutstr = (
        "Method of initial skull-stripping before AMAP segmentation. The SPM approach works quite stable "
        "for the majority of data. However, in some rare cases parts of GM (i.e. in frontal lobe) might "
        "be cut. If this happens the GCUT approach is a good alternative. GCUT is a graph-cut/region-"
        "growing approach starting from the WM area. APRG (adaptive probability region-growing) is a new"
        " method that refines the probability maps of the SPM approach by region-growing techniques of "
        "the gcut approach with a final surface-based optimization strategy. This is currently the method"
        " with the most accurate and reliable results. If you use already skull-stripped data you can "
        "turn off skull-stripping although this is automaticaly detected in most cases. Please note that "
        "the choice of the skull-stripping method will also influence the estimation of TIV, because the"
        " methods mainly differ in the handling of the outer CSF around the cortical surface. "
        "\nPossible Values:\n - none (already skull-stripped): -1;\n - SPM approach: 0; "
        "\n - GCUT approach: 0.50; \n - APRG approach: 2")
    skull_strip = traits.Float(2,
                               field="extopts.gcutstr",
                               desc=_help_gcutstr,
                               usedefault=True)

    _help_wmhc = (
        "WARNING: Please note that the detection of WM hyperintensies is still under development and does "
        "not have the same accuracy as approaches that additionally consider FLAIR images (e.g. Lesion "
        "Segmentation Toolbox)! In aging or (neurodegenerative) diseases WM intensity can be reduced "
        "locally in T1 or increased in T2/PD images. These so-called WM hyperintensies (WMHs) can lead to "
        "preprocessing errors. Large GM areas next to the ventricle can cause normalization problems. "
        "Therefore, a temporary correction for normalization is useful if WMHs are expected. CAT allows "
        "different ways to handle WMHs: "
        "\n0) No Correction (handled as GM). \n1) Temporary (internal) correction as WM for spatial "
        "normalization and estimation of cortical thickness. \n2) Permanent correction to WM. "
    )
    wm_hyper_intensity_correction = traits.Int(1,
                                               field="extopts.WMHC",
                                               desc=_help_wmhc,
                                               usedefault=True)

    _help_vox = (
        "The (isotropic) voxel sizes of any spatially normalised written images. A non-finite value will be "
        "replaced by the average voxel size of the tissue probability maps used by the segmentation."
    )
    voxel_size = traits.Float(1.5,
                              field="extopts.vox",
                              desc=_help_vox,
                              usedefault=True)

    _help_resampling = (
        "Internal resampling for preprocessing.\n The default fixed image resolution offers a good "
        "trade-off between optimal quality and preprocessing time and memory demands. Standard "
        "structural data with a voxel resolution around 1mm or even data with high in-plane resolution"
        " and large slice thickness (e.g. 0.5x0.5x1.5 mm) will benefit from this setting. If you have"
        ' higher native resolutions the highres option "Fixed 0.8 mm" will sometimes offer slightly'
        " better preprocessing quality with an increase of preprocessing time and memory demands. In"
        " case of even higher resolutions and high signal-to-noise ratio (e.g. for 7 T data) the "
        '"Best native" option will process the data on the highest native resolution. A resolution'
        " of 0.4x0.7x1.0 mm will be interpolated to 0.4x0.4x0.4 mm. A tolerance range of 0.1 mm is "
        "used to avoid interpolation artifacts, i.e. a resolution of 0.95x1.01x1.08 mm will not be "
        'interpolated in case of the "Fixed 1.0 mm"! This "optimal" option prefers an isotropic voxel '
        "size with at least 1.1 mm that is controlled by the median voxel size and a volume term that "
        "penalizes highly anisotropic voxels."
        "Values:\nOptimal: [1.0 0.1]\nFixed 1.0 mm: [1.0 0.1];\nFixed 0.8 mm:[0.8 0.1]"
        "\nBest native: [0.5 0.1]")
    internal_resampling_process = traits.Tuple(
        traits.Float(1),
        traits.Float(0.1),
        minlen=2,
        maxlen=2,
        usedefault=True,
        field="extopts.restypes.optimal",
        desc="help_resampling",
    )
    _errors_help = (
        "Error handling.\nTry to catch preprocessing errors and continue with the next data set or ignore "
        "all warnings (e.g., bad intensities) and use an experimental pipeline which is still in "
        "development. In case of errors, CAT continues with the next subject if this option is enabled. If "
        "the experimental option with backup functions is selected and warnings occur, CAT will try to use"
        " backup routines and skip some processing steps which require good T1 contrasts (e.g., LAS). If "
        "you want to avoid processing of critical data and ensure that only the main pipeline is used then"
        ' select the option "Ignore errors (continue with the next subject)". It is strongly recommended '
        "to check for preprocessing problems, especially with non-T1 contrasts. "
        "\nValues:\nnone: 0,\ndefault: 1,\ndetails: 2.")
    ignore_errors = traits.Int(1,
                               field="extopts.ignoreErrors",
                               desc=_errors_help,
                               usedefault=True)

    # Writing options
    _help_surf = (
        "Surface and thickness estimation. \nUse projection-based thickness (PBT) (Dahnke et al. 2012) to"
        " estimate cortical thickness and to create the central cortical surface for left and right "
        "hemisphere. Surface reconstruction includes topology correction (Yotter et al. 2011), spherical "
        "inflation (Yotter et al.) and spherical registration. Additionally you can also estimate surface "
        "parameters such as gyrification, cortical complexity or sulcal depth that can be subsequently "
        "analyzed at each vertex of the surface. Please note, that surface reconstruction and spherical "
        "registration additionally requires about 20-60 min of computation time. A fast (1-3 min) surface "
        "pipeline is available for visual preview (e.g., to check preprocessing quality) in the "
        "cross-sectional, but not in the longitudinal pipeline.  Only the initial surfaces are created with "
        "a lower resolution and without topology correction, spherical mapping and surface registration. "
        "Please note that the files with the estimated surface thickness can therefore not be used for "
        'further analysis!  For distinction, these files contain "preview" in their filename and they'
        " are not available as batch dependencies objects. ")
    surface_and_thickness_estimation = traits.Int(1,
                                                  field="surface",
                                                  desc=_help_surf,
                                                  usedefault=True)
    surface_measures = traits.Int(
        1,
        field="output.surf_measures",
        usedefault=True,
        desc="Extract surface measures",
    )

    # Templates
    neuromorphometrics = traits.Bool(
        True,
        field="output.ROImenu.atlases.neuromorphometrics",
        usedefault=True,
        desc="Extract brain measures for Neuromorphometrics template",
    )
    lpba40 = traits.Bool(
        True,
        field="output.ROImenu.atlases.lpba40",
        usedefault=True,
        desc="Extract brain measures for LPBA40 template",
    )
    cobra = traits.Bool(
        True,
        field="output.ROImenu.atlases.hammers",
        usedefault=True,
        desc="Extract brain measures for COBRA template",
    )
    hammers = traits.Bool(
        True,
        field="output.ROImenu.atlases.cobra",
        usedefault=True,
        desc="Extract brain measures for Hammers template",
    )
    own_atlas = InputMultiPath(
        ImageFileSPM(exists=True),
        field="output.ROImenu.atlases.ownatlas",
        desc="Extract brain measures for a given template",
        mandatory=False,
        copyfile=False,
    )

    # Grey matter
    gm_output_native = traits.Bool(
        False,
        field="output.GM.native",
        usedefault=True,
        desc="Save modulated grey matter images.",
    )
    gm_output_modulated = traits.Bool(
        True,
        field="output.GM.mod",
        usedefault=True,
        desc="Save native grey matter images.",
    )
    gm_output_dartel = traits.Bool(
        False,
        field="output.GM.dartel",
        usedefault=True,
        desc="Save dartel grey matter images.",
    )

    # White matter
    _wm_desc = "Options to save white matter images."
    wm_output_native = traits.Bool(
        False,
        field="output.WM.native",
        usedefault=True,
        desc="Save dartel white matter images.",
    )
    wm_output_modulated = traits.Bool(
        True,
        field="output.WM.mod",
        usedefault=True,
        desc="Save dartel white matter images.",
    )
    wm_output_dartel = traits.Bool(
        False,
        field="output.WM.dartel",
        usedefault=True,
        desc="Save dartel white matter images.",
    )

    # CSF matter
    _csf_desc = "Options to save CSF images."
    csf_output_native = traits.Bool(
        False,
        field="output.CSF.native",
        usedefault=True,
        desc="Save dartel CSF images.",
    )
    csf_output_modulated = traits.Bool(True,
                                       field="output.CSF.mod",
                                       usedefault=True,
                                       desc="Save dartel CSF images.")
    csf_output_dartel = traits.Bool(
        False,
        field="output.CSF.dartel",
        usedefault=True,
        desc="Save dartel CSF images.",
    )

    # Labels
    _help_label_desc = (
        "This is the option to save a labeled version of your segmentations in the %s space for fast visual "
        "comparision. Labels are saved as Partial Volume Estimation (PVE) values with different mix "
        "classes for GM-WM (2.5) and GM-CSF (1.5). BG=0, CSF=1, GM=2, WM=3, WMH=4 (if WMHC=3), "
        "SL=1.5 (if SLC)")
    label_native = traits.Bool(
        False,
        field="output.label.native",
        usedefault=True,
        desc=_help_label_desc % "native",
    )
    label_warped = traits.Bool(
        True,
        field="output.label.warped",
        usedefault=True,
        desc=_help_label_desc % "warped",
    )
    label_dartel = traits.Bool(
        False,
        field="output.label.dartel",
        usedefault=True,
        desc=_help_label_desc % "dartel",
    )
    output_labelnative = traits.Bool(
        False,
        field="output.labelnative",
        usedefault=True,
        desc=_help_label_desc % "native",
    )

    # Bias
    save_bias_corrected = traits.Bool(
        True,
        field="output.bias.warped",
        usedefault=True,
        desc="Save bias corrected image",
    )

    # las
    _las_desc = (
        "This is the option to save a bias, noise, and local intensity corrected version of the original T1"
        " image in the %s space. MR images are usually corrupted by a smooth, spatially varying artifact that modulates the"
        " intensity of the image (bias). These artifacts, although not usually a problem for visual "
        "inspection, can impede automated processing of the images. The bias corrected version should have "
        "more uniform intensities within the different types of tissues and can be saved in native space "
        "and/or normalised. Noise is corrected by an adaptive non-local mean (NLM) filter (Manjon 2008, "
        "Medical Image Analysis 12).")
    las_native = traits.Bool(False,
                             field="output.las.native",
                             usedefault=True,
                             desc=_las_desc % "native")
    las_warped = traits.Bool(True,
                             field="output.las.warped",
                             usedefault=True,
                             desc=_las_desc % "warped")
    las_dartel = traits.Bool(False,
                             field="output.las.dartel",
                             usedefault=True,
                             desc=_las_desc % "dartel")

    # Jacobian Warped
    _help_jacobian = (
        "This is the option to save the Jacobian determinant, which expresses local volume changes. This"
        " image can be used in a pure deformation based morphometry (DBM) design. Please note that the"
        " affine part of the deformation field is ignored. Thus, there is no need for any additional"
        " correction for different brain sizes using ICV.")
    jacobianwarped = traits.Bool(True,
                                 field="output.jacobianwarped",
                                 usedefault=True,
                                 desc=_help_jacobian)

    # Deformation Fields
    _help_warp = (
        "Deformation fields can be saved to disk, and used by the Deformations Utility and/or applied to "
        "coregistered data from other modalities (e.g. fMRI). For spatially normalising images to MNI space,"
        " you will need the forward deformation, whereas for spatially normalising (eg) GIFTI surface files,"
        " you"
        "ll need the inverse. It is also possible to transform data in MNI space on to the individual"
        " subject, which also requires the inverse transform. Deformations are saved as .nii files, which"
        " contain three volumes to encode the x, y and z coordinates."
        "\nValues: No:[0 0];\nImage->Template (forward): [1 0];\nTemplate->Image (inverse): [0 1]; "
        "\ninverse + forward: [1 1]")
    warps = traits.Tuple(
        traits.Int(1),
        traits.Int(0),
        minlen=2,
        maxlen=2,
        field="output.warps",
        usedefault=True,
        desc=_help_warp,
    )
Example #2
0
class BroccoliInputSpec(BaseInterfaceInputSpec):
    opencl_platform = traits.Int(0, usedefault=True)
    opencl_device = traits.Int(0, usedefault=True)
    show_results = traits.Bool(False)
    
    base_name = traits.Str(value='output', desc='base name that all output files will start with')
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 ComputeCorrelationMatrixInputSpec(BaseInterfaceInputSpec):
    hypergraph_path = File(exists=True, mandatory=True)
    time_series_path = File(mandatory=True)
    lag = traits.Int(default_value=0)
    correlation_matrix_out_file = File(mandatory=True)
    correlation_matrix_plot_out_file = File(mandatory=True)
Example #5
0
class _RobustMNINormalizationInputSpec(BaseInterfaceInputSpec):
    # Enable deprecation
    package_version = niworkflows_version

    # Moving image.
    moving_image = File(exists=True,
                        mandatory=True,
                        desc="image to apply transformation to")
    # Reference image (optional).
    reference_image = File(exists=True, desc="override the reference image")
    # Moving mask (optional).
    moving_mask = File(exists=True, desc="moving image mask")
    # Reference mask (optional).
    reference_mask = File(exists=True, desc="reference image mask")
    # Lesion mask (optional).
    lesion_mask = File(exists=True, desc="lesion mask image")
    # Number of threads to use for ANTs/ITK processes.
    num_threads = traits.Int(cpu_count(),
                             usedefault=True,
                             nohash=True,
                             desc="Number of ITK threads to use")
    # ANTs parameter set to use.
    flavor = traits.Enum(
        "precise",
        "testing",
        "fast",
        usedefault=True,
        desc="registration settings parameter set",
    )
    # Template orientation.
    orientation = traits.Enum(
        "RAS",
        "LAS",
        mandatory=True,
        usedefault=True,
        desc="modify template orientation (should match input image)",
    )
    # Modality of the reference image.
    reference = traits.Enum(
        "T1w",
        "T2w",
        "boldref",
        "PDw",
        mandatory=True,
        usedefault=True,
        desc="set the reference modality for registration",
    )
    # T1 or EPI registration?
    moving = traits.Enum("T1w",
                         "boldref",
                         usedefault=True,
                         mandatory=True,
                         desc="registration type")
    # Template to use as the default reference image.
    template = traits.Str("MNI152NLin2009cAsym",
                          usedefault=True,
                          desc="define the template to be used")
    # Load other settings from file.
    settings = traits.List(File(exists=True),
                           desc="pass on the list of settings files")
    # Resolution of the default template.
    template_spec = traits.DictStrAny(desc="template specifications")
    template_resolution = traits.Enum(1,
                                      2,
                                      None,
                                      desc="(DEPRECATED) template resolution")
    # Use explicit masking?
    explicit_masking = traits.Bool(
        True,
        usedefault=True,
        desc="""\
Set voxels outside the masks to zero thus creating an artificial border
that can drive the registration. Requires reliable and accurate masks.
See https://sourceforge.net/p/advants/discussion/840261/thread/27216e69/#c7ba\
""",
    )
    initial_moving_transform = File(exists=True,
                                    desc="transform for initialization")
    float = traits.Bool(False,
                        usedefault=True,
                        desc="use single precision calculations")
Example #6
0
class BRAINSFitInputSpec(CommandLineInputSpec):
    fixedVolume = File(
        desc=
        "The fixed image for registration by mutual information optimization.",
        exists=True,
        argstr="--fixedVolume %s")
    movingVolume = File(
        desc=
        "The moving image for registration by mutual information optimization.",
        exists=True,
        argstr="--movingVolume %s")
    bsplineTransform = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc=
        "(optional) Filename to which save the estimated transform. NOTE: You must set at least one output object (either a deformed image or a transform.  NOTE: USE THIS ONLY IF THE FINAL TRANSFORM IS BSpline",
        argstr="--bsplineTransform %s")
    linearTransform = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc=
        "(optional) Filename to which save the estimated transform. NOTE: You must set at least one output object (either a deformed image or a transform.  NOTE: USE THIS ONLY IF THE FINAL TRANSFORM IS ---NOT--- BSpline",
        argstr="--linearTransform %s")
    outputVolume = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc=
        "(optional) Output image for registration. NOTE: You must select either the outputTransform or the outputVolume option.",
        argstr="--outputVolume %s")
    initialTransform = File(
        desc=
        "Filename of transform used to initialize the registration.  This CAN NOT be used with either CenterOfHeadLAlign, MomentsAlign, GeometryAlign, or initialTransform file.",
        exists=True,
        argstr="--initialTransform %s")
    initializeTransformMode = traits.Enum(
        "Off",
        "useMomentsAlign",
        "useCenterOfHeadAlign",
        "useGeometryAlign",
        "useCenterOfROIAlign",
        desc=
        "Determine how to initialize the transform center.  GeometryAlign on assumes that the center of the voxel lattice of the images represent similar structures.  MomentsAlign assumes that the center of mass of the images represent similar structures.  useCenterOfHeadAlign attempts to use the top of head and shape of neck to drive a center of mass estimate.  Off assumes that the physical space of the images are close, and that centering in terms of the image Origins is a good starting point.  This flag is mutually exclusive with the initialTransform flag.",
        argstr="--initializeTransformMode %s")
    metricSamplingStrategy = traits.Enum(
        "None",
        "Random",
        "Regular",
        desc=
        "It defines the method that registration filter uses to sample the input fixed image={None,Regular,Random}",
        argstr="--metricSamplingStrategy %s")
    useRigid = traits.Bool(
        desc=
        "Perform a rigid registration as part of the sequential registration steps.  This family of options superceeds the use of transformType if any of them are set.",
        argstr="--useRigid ")
    useScaleVersor3D = traits.Bool(
        desc=
        "Perform a ScaleVersor3D registration as part of the sequential registration steps.  This family of options superceeds the use of transformType if any of them are set.",
        argstr="--useScaleVersor3D ")
    useScaleSkewVersor3D = traits.Bool(
        desc=
        "Perform a ScaleSkewVersor3D registration as part of the sequential registration steps.  This family of options superceeds the use of transformType if any of them are set.",
        argstr="--useScaleSkewVersor3D ")
    useAffine = traits.Bool(
        desc=
        "Perform an Affine registration as part of the sequential registration steps.  This family of options superceeds the use of transformType if any of them are set.",
        argstr="--useAffine ")
    useBSpline = traits.Bool(
        desc=
        "Perform a BSpline registration as part of the sequential registration steps.  This family of options superceeds the use of transformType if any of them are set.",
        argstr="--useBSpline ")
    useSyN = traits.Bool(
        desc=
        "Perform a SyN registration as part of the sequential registration steps.  This family of options superceeds the use of transformType if any of them are set.",
        argstr="--useSyN ")
    useComposite = traits.Bool(
        desc=
        "Perform a Composite registration as part of the sequential registration steps.  This family of options superceeds the use of transformType if any of them are set.",
        argstr="--useComposite ")
    numberOfSamples = traits.Int(
        desc=
        "The number of voxels sampled for mutual information computation.  Increase this for a slower, more careful fit. NOTE that it is suggested to use samplingPercentage instead of this option. However, if set, it overwrites the samplingPercentage option.  ",
        argstr="--numberOfSamples %d")
    samplingPercentage = traits.Float(
        desc=
        "This is a number in [0,1] interval that shows the percentage of the input fixed image voxels that are sampled for mutual information computation.  Increase this for a slower, more careful fit. You can also limit the sampling focus with ROI masks and ROIAUTO mask generation.",
        argstr="--samplingPercentage %f")
    splineGridSize = InputMultiPath(
        traits.Int,
        desc=
        "The number of subdivisions of the BSpline Grid to be centered on the image space (in voxels).  Each dimension must have at least 3 subdivisions for the BSpline to be correctly computed. ",
        sep=",",
        argstr="--splineGridSize %s")
    useROIBSpline = traits.Bool(
        desc=
        "When set, will use the bounding box of the input ROIs to define spline grid support region. Otherwise will use the whole image.",
        argstr="--useROIBSpline ")
    numberOfIterations = InputMultiPath(
        traits.Int,
        desc=
        "The maximum number of iterations to try before failing to converge.  Use an explicit limit like 500 or 1000 to manage risk of divergence",
        sep=",",
        argstr="--numberOfIterations %s")
    maskProcessingMode = traits.Enum(
        "NOMASK",
        "ROIAUTO",
        "ROI",
        desc=
        "What mode to use for using the masks.  If ROIAUTO is choosen, then the mask is implicitly defined using a otsu forground and hole filling algorithm. The Region Of Interest mode (choose ROI) uses the masks to define what parts of the image should be used for computing the transform.",
        argstr="--maskProcessingMode %s")
    fixedBinaryVolume = File(
        desc=
        "Fixed Image binary mask volume, ONLY FOR MANUAL ROI mode. (Values are zero and non-zero.)",
        exists=True,
        argstr="--fixedBinaryVolume %s")
    movingBinaryVolume = File(
        desc=
        "Moving Image binary mask volume, ONLY FOR MANUAL ROI mode. (Values are zero and non-zero.)",
        exists=True,
        argstr="--movingBinaryVolume %s")
    outputFixedVolumeROI = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc=
        "The ROI automatically found in fixed image, ONLY FOR ROIAUTO mode. (Values are zero and non-zero.)",
        argstr="--outputFixedVolumeROI %s")
    outputMovingVolumeROI = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc=
        "The ROI automatically found in moving image, ONLY FOR ROIAUTO mode. (Values are zero and non-zero.)",
        argstr="--outputMovingVolumeROI %s")
    outputVolumePixelType = traits.Enum(
        "float",
        "short",
        "ushort",
        "int",
        "uint",
        "uchar",
        desc=
        "The output image Pixel Type is the scalar datatype for representation of the Output Volume.",
        argstr="--outputVolumePixelType %s")
    backgroundFillValue = traits.Float(
        desc="Background fill value for output image.",
        argstr="--backgroundFillValue %f")
    maskInferiorCutOffFromCenter = traits.Float(
        desc=
        "For use with --initializeTransformMode useCenterOfHeadAlign (and --maskProcessingMode ROIAUTO): the cut-off below the image centers, in millimeters, ",
        argstr="--maskInferiorCutOffFromCenter %f")
    scaleOutputValues = traits.Bool(
        desc=
        "If true, and the voxel values do not fit within the minimum and maximum values of the desired outputVolumePixelType, then linearly scale the min/max output image voxel values to fit within the min/max range of the outputVolumePixelType.",
        argstr="--scaleOutputValues ")
    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, NearestNeighbor, BSpline, WindowedSinc, or ResampleInPlace.  The ResampleInPlace option will create an image with the same discrete voxel values and will adjust the origin and direction of the physical space interpretation.",
        argstr="--interpolationMode %s")
    minimumStepLength = InputMultiPath(
        traits.Float,
        desc=
        "Each step in the optimization takes steps at least this big.  When none are possible, registration is complete.",
        sep=",",
        argstr="--minimumStepLength %s")
    translationScale = 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 search pattern.",
        argstr="--translationScale %f")
    reproportionScale = traits.Float(
        desc=
        "ScaleVersor3D 'Scale' compensation factor.  Increase this to put more rescaling in a ScaleVersor3D or ScaleSkewVersor3D search pattern.  1.0 works well with a translationScale of 1000.0",
        argstr="--reproportionScale %f")
    skewScale = traits.Float(
        desc=
        "ScaleSkewVersor3D Skew compensation factor.  Increase this to put more skew in a ScaleSkewVersor3D search pattern.  1.0 works well with a translationScale of 1000.0",
        argstr="--skewScale %f")
    maxBSplineDisplacement = traits.Float(
        desc=
        " Sets the maximum allowed displacements in image physical coordinates (mm) for BSpline control grid along each axis.  A value of 0.0 indicates that the problem should be unbounded.  NOTE:  This only constrains the BSpline portion, and does not limit the displacement from the associated bulk transform.  This can lead to a substantial reduction in computation time in the BSpline optimizer.,       ",
        argstr="--maxBSplineDisplacement %f")
    histogramMatch = traits.Bool(
        desc=
        "Histogram Match the input images.  This is suitable for images of the same modality that may have different absolute scales, but the same overall intensity profile. Do NOT use if registering images from different modailties.",
        argstr="--histogramMatch ")
    numberOfHistogramBins = traits.Int(desc="The number of histogram levels",
                                       argstr="--numberOfHistogramBins %d")
    numberOfMatchPoints = traits.Int(desc="the number of match points",
                                     argstr="--numberOfMatchPoints %d")
    strippedOutputTransform = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc=
        "File name for the rigid component of the estimated affine transform. Can be used to rigidly register the moving image to the fixed image. NOTE:  This value is overwritten if either bsplineTransform or linearTransform is set.",
        argstr="--strippedOutputTransform %s")
    transformType = InputMultiPath(
        traits.Str,
        desc=
        "Specifies a list of registration types to be used.  The valid types are, Rigid, ScaleVersor3D, ScaleSkewVersor3D, Affine, BSpline and SyN.  Specifiying more than one in a comma separated list will initialize the next stage with the previous results. If registrationClass flag is used, it overrides this parameter setting.",
        sep=",",
        argstr="--transformType %s")
    outputTransform = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc=
        "(optional) Filename to which save the (optional) estimated transform. NOTE: You must select either the outputTransform or the outputVolume option.",
        argstr="--outputTransform %s")
    fixedVolumeTimeIndex = traits.Int(
        desc=
        "The index in the time series for the 3D fixed image to fit, if 4-dimensional.",
        argstr="--fixedVolumeTimeIndex %d")
    movingVolumeTimeIndex = traits.Int(
        desc=
        "The index in the time series for the 3D moving image to fit, if 4-dimensional.",
        argstr="--movingVolumeTimeIndex %d")
    medianFilterSize = InputMultiPath(
        traits.Int,
        desc=
        "The radius for the optional MedianImageFilter preprocessing in all 3 directions (in voxels).",
        sep=",",
        argstr="--medianFilterSize %s")
    removeIntensityOutliers = traits.Float(
        desc=
        "The half percentage to decide outliers of image intensities. The default value is zero, which means no outlier removal. If the value of 0.005 is given, the moduel will throw away 0.005 % of both tails, so 0.01% of intensities in total would be ignored in its statistic calculation. ",
        argstr="--removeIntensityOutliers %f")
    initializeRegistrationByCurrentGenericTransform = traits.Bool(
        desc=
        "If this flag is ON, the current generic composite transform, resulted from the linear registration stages, is set to initialize the follow nonlinear registration process. However, by the default behaviour, the moving image is first warped based on the existant transform before it is passed to the BSpline registration filter. It is done to speed up the BSpline registration by reducing the computations of composite transform jacobian.",
        argstr="--initializeRegistrationByCurrentGenericTransform ")
    useCachingOfBSplineWeightsMode = traits.Enum(
        "ON",
        "OFF",
        desc=
        "This is a 5x speed advantage at the expense of requiring much more memory.  Only relevant when transformType is BSpline.",
        argstr="--useCachingOfBSplineWeightsMode %s")
    useExplicitPDFDerivativesMode = traits.Enum(
        "AUTO",
        "ON",
        "OFF",
        desc=
        "This option is not used in ITKv4 optimizers. There is no need to set that; however, this flag is not removed to keep backward compatibility.",
        argstr="--useExplicitPDFDerivativesMode %s")
    ROIAutoDilateSize = traits.Float(
        desc=
        "This flag is only relavent when using ROIAUTO mode for initializing masks.  It defines the final dilation size to capture a bit of background outside the tissue region.  A setting of 10mm has been shown to help regularize a BSpline registration type so that there is some background constraints to match the edges of the head better.",
        argstr="--ROIAutoDilateSize %f")
    ROIAutoClosingSize = traits.Float(
        desc=
        "This flag is only relavent when using ROIAUTO mode for initializing masks.  It defines the hole closing size in mm.  It is rounded up to the nearest whole pixel size in each direction. The default is to use a closing size of 9mm.  For mouse data this value may need to be reset to 0.9 or smaller.",
        argstr="--ROIAutoClosingSize %f")
    relaxationFactor = traits.Float(
        desc=
        "Internal debugging parameter, and should probably never be used from the command line.  This will be removed in the future.",
        argstr="--relaxationFactor %f")
    maximumStepLength = traits.Float(
        desc=
        "Internal debugging parameter, and should probably never be used from the command line.  This will be removed in the future.",
        argstr="--maximumStepLength %f")
    failureExitCode = traits.Int(
        desc=
        "If the fit fails, exit with this status code.  (It can be used to force a successfult exit status of (0) if the registration fails due to reaching the maximum number of iterations.",
        argstr="--failureExitCode %d")
    writeTransformOnFailure = traits.Bool(
        desc=
        "Flag to save the final transform even if the numberOfIterations are reached without convergence. (Intended for use when --failureExitCode 0 )",
        argstr="--writeTransformOnFailure ")
    numberOfThreads = traits.Int(
        desc=
        "Explicitly specify the maximum number of threads to use. (default is auto-detected)",
        argstr="--numberOfThreads %d")
    forceMINumberOfThreads = traits.Int(
        desc=
        "Force the the maximum number of threads to use for non thread safe MI metric.",
        argstr="--forceMINumberOfThreads %d")
    debugLevel = traits.Int(
        desc=
        "Display debug messages, and produce debug intermediate results.  0=OFF, 1=Minimal, 10=Maximum debugging.",
        argstr="--debugLevel %d")
    costFunctionConvergenceFactor = traits.Float(
        desc=
        " From itkLBFGSBOptimizer.h: Set/Get the CostFunctionConvergenceFactor. Algorithm terminates when the reduction in cost function is less than (factor * epsmcj) where epsmch is the machine precision. Typical values for factor: 1e+12 for low accuracy; 1e+7 for moderate accuracy and 1e+1 for extremely high accuracy.  1e+9 seems to work well.,       ",
        argstr="--costFunctionConvergenceFactor %f")
    projectedGradientTolerance = traits.Float(
        desc=
        " From itkLBFGSBOptimizer.h: Set/Get the ProjectedGradientTolerance. Algorithm terminates when the project gradient is below the tolerance. Default lbfgsb value is 1e-5, but 1e-4 seems to work well.,       ",
        argstr="--projectedGradientTolerance %f")
    gui = traits.Bool(
        desc=
        "Display intermediate image volumes for debugging.  NOTE:  This is not part of the standard build sytem, and probably does nothing on your installation.",
        argstr="--gui ")
    promptUser = traits.Bool(
        desc=
        "Prompt the user to hit enter each time an image is sent to the DebugImageViewer",
        argstr="--promptUser ")
    permitParameterVariation = InputMultiPath(
        traits.Int,
        desc=
        "A bit vector to permit linear transform parameters to vary under optimization.  The vector order corresponds with transform parameters, and beyond the end ones fill in as a default.  For instance, you can choose to rotate only in x (pitch) with 1,0,0;  this is mostly for expert use in turning on and off individual degrees of freedom in rotation, translation or scaling without multiplying the number of transform representations; this trick is probably meaningless when tried with the general affine transform.",
        sep=",",
        argstr="--permitParameterVariation %s")
    costMetric = traits.Enum(
        "MMI",
        "MSE",
        "NC",
        "MIH",
        desc=
        "The cost metric to be used during fitting. Defaults to MMI. Options are MMI (Mattes Mutual Information), MSE (Mean Square Error), NC (Normalized Correlation), MC (Match Cardinality for binary images)",
        argstr="--costMetric %s")
    logFileReport = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc=
        "A file to write out final information report in CSV file: MetricName,MetricValue,FixedImageName,FixedMaskName,MovingImageName,MovingMaskName",
        argstr="--logFileReport %s")
    metricSeed = traits.Int(
        desc=
        "Seed value will be used to reinitialize the metric. To ensure consistent results, the same seed value should be used across runs. If the seed value is set to 0, the sampler will use the clock of your machine to initialize the metric, which will lead to a random initialization of the seed.",
        argstr="--metricSeed %d")
Example #7
0
class TrackBayesDiracInputSpec(TrackInputSpec):
    scheme_file = File(
        argstr='-schemefile %s',
        mandatory=True,
        exist=True,
        desc='The scheme file corresponding to the data being processed.')

    iterations = traits.Int(
        argstr='-iterations %d',
        units='NA',
        desc=
        "Number of streamlines to generate at each seed point. The default is 5000."
    )

    pdf = traits.Enum(
        'bingham',
        'watson',
        'acg',
        argstr='-pdf %s',
        desc=
        'Specifies the model for PICo priors (not the curvature priors). The default is "bingham".'
    )

    pointset = traits.Int(
        argstr='-pointset %s',
        desc=
        'Index to the point set to use for Bayesian likelihood calculation. The index specifies a set of evenly distributed points on the unit sphere, where each point x defines two possible step directions (x or -x) for the streamline path. A larger number indexes a larger point set, which gives higher angular resolution at the expense of computation time. The default is index 1, which gives 1922 points, index 0 gives 1082 points, index 2 gives 3002 points.'
    )

    datamodel = traits.Enum(
        'cylsymmdt',
        'ballstick',
        argstr='-datamodel %s',
        desc=
        'Model of the data for Bayesian tracking. The default model is "cylsymmdt", a diffusion tensor with cylindrical symmetry about e_1, ie L1 >= L_2 = L_3. The other model is "ballstick", the partial volume model (see ballstickfit).'
    )

    curvepriork = traits.Float(
        argstr='-curvepriork %s',
        desc=
        'Concentration parameter for the prior distribution on fibre orientations given the fibre orientation at the previous step. Larger values of k make curvature less likely.'
    )

    curvepriorg = traits.Float(
        argstr='-curvepriorg %s',
        desc=
        'Concentration parameter for the prior distribution on fibre orientations given the fibre orientation at the previous step. Larger values of g make curvature less likely.'
    )

    extpriorfile = File(
        exists=True,
        argstr='-extpriorfile %s',
        desc=
        'Path to a PICo image produced by picopdfs. The PDF in each voxel is used as a prior for the fibre orientation in Bayesian tracking. The prior image must be in the same space as the diffusion data.'
    )

    extpriordatatype = traits.Enum(
        'float',
        'double',
        argstr='-extpriordatatype %s',
        desc='Datatype of the prior image. The default is "double".')
Example #8
0
class UKFTractographyInputSpec(CommandLineInputSpec):
    dwiFile = File(desc="Input DWI volume", exists=True, argstr="--dwiFile %s")
    seedsFile = File(
        desc=
        "Seeds for diffusion. If not specified, full brain tractography will be performed, and the algorithm will start from every voxel in the brain mask where the Generalized Anisotropy is bigger than 0.18",
        exists=True,
        argstr="--seedsFile %s")
    labels = InputMultiPath(traits.Int,
                            desc="A vector of the ROI labels to be used",
                            sep=",",
                            argstr="--labels %s")
    maskFile = File(desc="Mask for diffusion tractography",
                    exists=True,
                    argstr="--maskFile %s")
    tracts = traits.Either(traits.Bool,
                           File(),
                           hash_files=False,
                           desc="Tracts generated, with first tensor output",
                           argstr="--tracts %s")
    writeAsciiTracts = traits.Bool(
        desc="Write tract file as a VTK binary data file",
        argstr="--writeAsciiTracts ")
    writeUncompressedTracts = traits.Bool(
        desc="Write tract file as a VTK uncompressed data file",
        argstr="--writeUncompressedTracts ")
    seedsPerVoxel = traits.Int(
        desc=
        " Each seed generates a fiber, thus using more seeds generates more fibers. In general use 1 or 2 seeds, and for a more thorough result use 5 or 10 (depending on your machine this may take up to 2 days to run).,       ",
        argstr="--seedsPerVoxel %d")
    numTensor = traits.Enum("1",
                            "2",
                            desc="Number of tensors used",
                            argstr="--numTensor %s")
    freeWater = traits.Bool(
        desc=
        "Adds a term for free water difusion to the model. (Note for experts: if checked, the 1T simple model is forced) ",
        argstr="--freeWater ")
    recordFA = traits.Bool(
        desc=
        "Whether to store FA. Attaches field 'FA', and 'FA2' for 2-tensor case to fiber. ",
        argstr="--recordFA ")
    recordFreeWater = traits.Bool(
        desc=
        "Whether to store the fraction of free water. Attaches field 'FreeWater' to fiber.",
        argstr="--recordFreeWater ")
    recordTrace = traits.Bool(
        desc=
        "Whether to store Trace. Attaches field 'Trace', and 'Trace2' for 2-tensor case to fiber.",
        argstr="--recordTrace ")
    recordTensors = traits.Bool(
        desc=
        "Recording the tensors enables Slicer to color the fiber bundles by FA, orientation, and so on. The fields will be called 'TensorN', where N is the tensor number. ",
        argstr="--recordTensors ")
    recordNMSE = traits.Bool(
        desc="Whether to store NMSE. Attaches field 'NMSE' to fiber. ",
        argstr="--recordNMSE ")
    recordState = traits.Bool(
        desc=
        "Whether to attach the states to the fiber. Will generate field 'state'.",
        argstr="--recordState ")
    recordCovariance = traits.Bool(
        desc=
        "Whether to store the covariance. Will generate field 'covariance' in fiber.",
        argstr="--recordCovariance ")
    recordLength = traits.Float(
        desc="Record length of tractography, in millimeters",
        argstr="--recordLength %f")
    minFA = traits.Float(
        desc=
        "Abort the tractography when the Fractional Anisotropy is less than this value",
        argstr="--minFA %f")
    minGA = traits.Float(
        desc=
        "Abort the tractography when the Generalized Anisotropy is less than this value",
        argstr="--minGA %f")
    fullTensorModel = traits.Bool(
        desc=
        "Whether to use the full tensor model. If unchecked, use the default simple tensor model",
        argstr="--fullTensorModel ")
    numThreads = traits.Int(
        desc=
        "Number of threads used during computation. Set to the number of cores on your workstation for optimal speed. If left undefined the number of cores detected will be used. ",
        argstr="--numThreads %d")
    stepLength = traits.Float(
        desc="Step length of tractography, in millimeters",
        argstr="--stepLength %f")
    maxHalfFiberLength = traits.Float(
        desc=
        "The max length limit of the half fibers generated during tractography. Here the fiber is \'half\' because the tractography goes in only one direction from one seed point at a time",
        argstr="--maxHalfFiberLength %f")
    seedFALimit = traits.Float(
        desc="Seed points whose FA are below this value are excluded",
        argstr="--seedFALimit %f")
    Qm = traits.Float(desc="Process noise for angles/direction",
                      argstr="--Qm %f")
    Ql = traits.Float(desc="Process noise for eigenvalues", argstr="--Ql %f")
    Qw = traits.Float(
        desc=
        "Process noise for free water weights, ignored if no free water estimation",
        argstr="--Qw %f")
    Rs = traits.Float(desc="Measurement noise", argstr="--Rs %f")
    maxBranchingAngle = traits.Float(
        desc=
        "Maximum branching angle, in degrees. When using multiple tensors, a new branch will be created when the tensors' major directions form an angle between (minBranchingAngle, maxBranchingAngle). Branching is supressed when this maxBranchingAngle is set to 0.0",
        argstr="--maxBranchingAngle %f")
    minBranchingAngle = traits.Float(
        desc=
        "Minimum branching angle, in degrees. When using multiple tensors, a new branch will be created when the tensors' major directions form an angle between (minBranchingAngle, maxBranchingAngle)",
        argstr="--minBranchingAngle %f")
    tractsWithSecondTensor = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc="Tracts generated, with second tensor output (if there is one)",
        argstr="--tractsWithSecondTensor %s")
    storeGlyphs = traits.Bool(
        desc=
        "Store tensors' main directions as two-point lines in a separate file named glyphs_{tracts}. When using multiple tensors, only the major tensors' main directions are stored",
        argstr="--storeGlyphs ")
Example #9
0
class CMTK_filterfibersInputSpec(BaseInterfaceInputSpec):
    track_file = File(desc='Input trk file', mandatory=True, exists=True)
    fiber_cutoff_lower = traits.Int(20, desc='Lower length threshold of the fibers', usedefault=True)
    fiber_cutoff_upper = traits.Int(500, desc='Upper length threshold of the fibers', usedefault=True)
    filtered_track_file = File(desc='Filtered trk file')
Example #10
0
class BRAINSAlignMSPInputSpec(CommandLineInputSpec):
    inputVolume = File(desc=",         The Image to be resampled,       ",
                       exists=True,
                       argstr="--inputVolume %s")
    OutputresampleMSP = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc=",         The image to be output.,       ",
        argstr="--OutputresampleMSP %s")
    verbose = traits.Bool(desc=",         Show more verbose output,       ",
                          argstr="--verbose ")
    resultsDir = traits.Either(
        traits.Bool,
        Directory(),
        hash_files=False,
        desc=",         The directory for the results to be written.,       ",
        argstr="--resultsDir %s")
    writedebuggingImagesLevel = traits.Int(
        desc=
        ",           This flag controls if debugging images are produced.  By default value of 0 is no images.  Anything greater than zero will be increasing level of debugging images.,       ",
        argstr="--writedebuggingImagesLevel %d")
    mspQualityLevel = traits.Int(
        desc=
        ",           Flag cotrols how agressive the MSP is estimated.  0=quick estimate (9 seconds), 1=normal estimate (11 seconds), 2=great estimate (22 seconds), 3=best estimate (58 seconds).,       ",
        argstr="--mspQualityLevel %d")
    rescaleIntensities = traits.Bool(
        desc=
        ",           Flag to turn on rescaling image intensities on input.,       ",
        argstr="--rescaleIntensities ")
    trimRescaledIntensities = traits.Float(
        desc=
        ",           Turn on clipping the rescaled image one-tailed on input.  Units of standard deviations above the mean.  Very large values are very permissive.  Non-positive value turns clipping off.  Defaults to removing 0.00001 of a normal tail above the mean.,       ",
        argstr="--trimRescaledIntensities %f")
    rescaleIntensitiesOutputRange = InputMultiPath(
        traits.Int,
        desc=
        ",           This pair of integers gives the lower and upper bounds on the signal portion of the output image.  Out-of-field voxels are taken from BackgroundFillValue.,       ",
        sep=",",
        argstr="--rescaleIntensitiesOutputRange %s")
    BackgroundFillValue = traits.Str(
        desc=
        "Fill the background of image with specified short int value. Enter number or use BIGNEG for a large negative number.",
        argstr="--BackgroundFillValue %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")
    numberOfThreads = traits.Int(
        desc="Explicitly specify the maximum number of threads to use.",
        argstr="--numberOfThreads %d")
Example #11
0
class TrackPICoInputSpec(TrackInputSpec):
    pdf = traits.Enum('bingham', 'watson', 'acg', argstr='-pdf %s', desc='Specifies the model for PICo parameters. The default is "bingham.')

    iterations = traits.Int(argstr='-iterations %d', units='NA', desc="Number of streamlines to generate at each seed point. The default is 5000.")
Example #12
0
class BRAINSMushInputSpec(CommandLineInputSpec):
    inputFirstVolume = File(desc="Input image (1) for mixture optimization",
                            exists=True,
                            argstr="--inputFirstVolume %s")
    inputSecondVolume = File(desc="Input image (2) for mixture optimization",
                             exists=True,
                             argstr="--inputSecondVolume %s")
    inputMaskVolume = File(desc="Input label image for mixture optimization",
                           exists=True,
                           argstr="--inputMaskVolume %s")
    outputWeightsFile = traits.Either(traits.Bool,
                                      File(),
                                      hash_files=False,
                                      desc="Output Weights File",
                                      argstr="--outputWeightsFile %s")
    outputVolume = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc="The MUSH image produced from the T1 and T2 weighted images",
        argstr="--outputVolume %s")
    outputMask = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc="The brain volume mask generated from the MUSH image",
        argstr="--outputMask %s")
    seed = InputMultiPath(traits.Int,
                          desc="Seed Point for Brain Region Filling",
                          sep=",",
                          argstr="--seed %s")
    desiredMean = traits.Float(
        desc="Desired mean within the mask for weighted sum of both images.",
        argstr="--desiredMean %f")
    desiredVariance = traits.Float(
        desc=
        "Desired variance within the mask for weighted sum of both images.",
        argstr="--desiredVariance %f")
    lowerThresholdFactorPre = traits.Float(
        desc="Lower threshold factor for finding an initial brain mask",
        argstr="--lowerThresholdFactorPre %f")
    upperThresholdFactorPre = traits.Float(
        desc="Upper threshold factor for finding an initial brain mask",
        argstr="--upperThresholdFactorPre %f")
    lowerThresholdFactor = traits.Float(
        desc="Lower threshold factor for defining the brain mask",
        argstr="--lowerThresholdFactor %f")
    upperThresholdFactor = traits.Float(
        desc="Upper threshold factor for defining the brain mask",
        argstr="--upperThresholdFactor %f")
    boundingBoxSize = InputMultiPath(
        traits.Int,
        desc=
        "Size of the cubic bounding box mask used when no brain mask is present",
        sep=",",
        argstr="--boundingBoxSize %s")
    boundingBoxStart = InputMultiPath(
        traits.Int,
        desc=
        "XYZ point-coordinate for the start of the cubic bounding box mask used when no brain mask is present",
        sep=",",
        argstr="--boundingBoxStart %s")
    numberOfThreads = traits.Int(
        desc="Explicitly specify the maximum number of threads to use.",
        argstr="--numberOfThreads %d")
Example #13
0
class OtsuThresholdImageFilterInputSpec(CommandLineInputSpec):
    insideValue = traits.Int(desc="The value assigned to pixels that are inside the computed threshold", argstr="--insideValue %d")
    outsideValue = traits.Int(desc="The value assigned to pixels that are outside the computed threshold", argstr="--outsideValue %d")
    numberOfBins = traits.Int(desc="This is an advanced parameter. The number of bins in the histogram used to model the probability mass function of the two intensity distributions. Small numbers of bins may result in a more conservative threshold. The default should suffice for most applications. Experimentation is the only way to see the effect of varying this parameter.", argstr="--numberOfBins %d")
    inputVolume = File(position=-2, desc="Input volume to be filtered", exists=True, argstr="%s")
    outputVolume = traits.Either(traits.Bool, File(), position=-1, hash_files=False, desc="Output filtered", argstr="%s")
Example #14
0
class TractographyInputSpec(MRTrix3BaseInputSpec):
    sph_trait = traits.Tuple(
        traits.Float, traits.Float, traits.Float, traits.Float, argstr="%f,%f,%f,%f"
    )

    in_file = File(
        exists=True,
        argstr="%s",
        mandatory=True,
        position=-2,
        desc="input file to be processed",
    )

    out_file = File(
        "tracked.tck",
        argstr="%s",
        mandatory=True,
        position=-1,
        usedefault=True,
        desc="output file containing tracks",
    )

    algorithm = traits.Enum(
        "iFOD2",
        "FACT",
        "iFOD1",
        "Nulldist",
        "SD_Stream",
        "Tensor_Det",
        "Tensor_Prob",
        usedefault=True,
        argstr="-algorithm %s",
        desc="tractography algorithm to be used",
    )

    # ROIs processing options
    roi_incl = traits.Either(
        File(exists=True),
        sph_trait,
        argstr="-include %s",
        desc=(
            "specify an inclusion region of interest, streamlines must"
            " traverse ALL inclusion regions to be accepted"
        ),
    )
    roi_excl = traits.Either(
        File(exists=True),
        sph_trait,
        argstr="-exclude %s",
        desc=(
            "specify an exclusion region of interest, streamlines that"
            " enter ANY exclude region will be discarded"
        ),
    )
    roi_mask = traits.Either(
        File(exists=True),
        sph_trait,
        argstr="-mask %s",
        desc=(
            "specify a masking region of interest. If defined,"
            "streamlines exiting the mask will be truncated"
        ),
    )

    # Streamlines tractography options
    step_size = traits.Float(
        argstr="-step %f",
        desc=(
            "set the step size of the algorithm in mm (default is 0.1"
            " x voxelsize; for iFOD2: 0.5 x voxelsize)"
        ),
    )
    angle = traits.Float(
        argstr="-angle %f",
        desc=(
            "set the maximum angle between successive steps (default "
            "is 90deg x stepsize / voxelsize)"
        ),
    )
    select = traits.Int(
        argstr="-select %d",
        desc=(
            "set the desired number of tracks. The program will continue"
            " to generate tracks until this number of tracks have been "
            "selected and written to the output file"
        ),
    )
    max_tracks = traits.Int(
        argstr="-maxnum %d",
        desc=(
            "set the maximum number of tracks to generate. The program "
            "will not generate more tracks than this number, even if "
            "the desired number of tracks hasn't yet been reached "
            "(default is 100 x number)"
        ),
    )
    max_length = traits.Float(
        argstr="-maxlength %f",
        desc=(
            "set the maximum length of any track in mm (default is " "100 x voxelsize)"
        ),
    )
    min_length = traits.Float(
        argstr="-minlength %f",
        desc=(
            "set the minimum length of any track in mm (default is " "5 x voxelsize)"
        ),
    )
    cutoff = traits.Float(
        argstr="-cutoff %f",
        desc=(
            "set the FA or FOD amplitude cutoff for terminating "
            "tracks (default is 0.1)"
        ),
    )
    cutoff_init = traits.Float(
        argstr="-initcutoff %f",
        desc=(
            "set the minimum FA or FOD amplitude for initiating "
            "tracks (default is the same as the normal cutoff)"
        ),
    )
    n_trials = traits.Int(
        argstr="-trials %d",
        desc=(
            "set the maximum number of sampling trials at each point"
            " (only used for probabilistic tracking)"
        ),
    )
    unidirectional = traits.Bool(
        argstr="-unidirectional",
        desc=(
            "track from the seed point in one direction only "
            "(default is to track in both directions)"
        ),
    )
    init_dir = traits.Tuple(
        traits.Float,
        traits.Float,
        traits.Float,
        argstr="-initdirection %f,%f,%f",
        desc=(
            "specify an initial direction for the tracking (this "
            "should be supplied as a vector of 3 comma-separated values"
        ),
    )
    noprecompt = traits.Bool(
        argstr="-noprecomputed",
        desc=(
            "do NOT pre-compute legendre polynomial values. Warning: this "
            "will slow down the algorithm by a factor of approximately 4"
        ),
    )
    power = traits.Int(
        argstr="-power %d",
        desc=("raise the FOD to the power specified (default is 1/nsamples)"),
    )
    n_samples = traits.Int(
        4,
        usedefault=True,
        argstr="-samples %d",
        desc=(
            "set the number of FOD samples to take per step for the 2nd "
            "order (iFOD2) method"
        ),
    )
    use_rk4 = traits.Bool(
        argstr="-rk4",
        desc=(
            "use 4th-order Runge-Kutta integration (slower, but eliminates"
            " curvature overshoot in 1st-order deterministic methods)"
        ),
    )
    stop = traits.Bool(
        argstr="-stop",
        desc=(
            "stop propagating a streamline once it has traversed all " "include regions"
        ),
    )
    downsample = traits.Float(
        argstr="-downsample %f",
        desc="downsample the generated streamlines to reduce output file size",
    )

    # Anatomically-Constrained Tractography options
    act_file = File(
        exists=True,
        argstr="-act %s",
        desc=(
            "use the Anatomically-Constrained Tractography framework during"
            " tracking; provided image must be in the 5TT "
            "(five - tissue - type) format"
        ),
    )
    backtrack = traits.Bool(argstr="-backtrack", desc="allow tracks to be truncated")

    crop_at_gmwmi = traits.Bool(
        argstr="-crop_at_gmwmi",
        desc=(
            "crop streamline endpoints more "
            "precisely as they cross the GM-WM interface"
        ),
    )

    # Tractography seeding options
    seed_sphere = traits.Tuple(
        traits.Float,
        traits.Float,
        traits.Float,
        traits.Float,
        argstr="-seed_sphere %f,%f,%f,%f",
        desc="spherical seed",
    )
    seed_image = File(
        exists=True,
        argstr="-seed_image %s",
        desc="seed streamlines entirely at random within mask",
    )
    seed_rnd_voxel = traits.Tuple(
        File(exists=True),
        traits.Int(),
        argstr="-seed_random_per_voxel %s %d",
        xor=["seed_image", "seed_grid_voxel"],
        desc=(
            "seed a fixed number of streamlines per voxel in a mask "
            "image; random placement of seeds in each voxel"
        ),
    )
    seed_grid_voxel = traits.Tuple(
        File(exists=True),
        traits.Int(),
        argstr="-seed_grid_per_voxel %s %d",
        xor=["seed_image", "seed_rnd_voxel"],
        desc=(
            "seed a fixed number of streamlines per voxel in a mask "
            "image; place seeds on a 3D mesh grid (grid_size argument "
            "is per axis; so a grid_size of 3 results in 27 seeds per"
            " voxel)"
        ),
    )
    seed_rejection = File(
        exists=True,
        argstr="-seed_rejection %s",
        desc=(
            "seed from an image using rejection sampling (higher "
            "values = more probable to seed from"
        ),
    )
    seed_gmwmi = File(
        exists=True,
        argstr="-seed_gmwmi %s",
        requires=["act_file"],
        desc=(
            "seed from the grey matter - white matter interface (only "
            "valid if using ACT framework)"
        ),
    )
    seed_dynamic = File(
        exists=True,
        argstr="-seed_dynamic %s",
        desc=(
            "determine seed points dynamically using the SIFT model "
            "(must not provide any other seeding mechanism). Note that"
            " while this seeding mechanism improves the distribution of"
            " reconstructed streamlines density, it should NOT be used "
            "as a substitute for the SIFT method itself."
        ),
    )
    max_seed_attempts = traits.Int(
        argstr="-max_seed_attempts %d",
        desc=(
            "set the maximum number of times that the tracking "
            "algorithm should attempt to find an appropriate tracking"
            " direction from a given seed point"
        ),
    )
    out_seeds = File(
        "out_seeds.nii.gz",
        usedefault=True,
        argstr="-output_seeds %s",
        desc=("output the seed location of all successful streamlines to" " a file"),
    )
class EMSegmentCommandLineInputSpec(CommandLineInputSpec):
    mrmlSceneFileName = File(
        desc="Active MRML scene that contains EMSegment algorithm parameters.",
        exists=True,
        argstr="--mrmlSceneFileName %s",
    )
    resultVolumeFileName = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc="The file name that the segmentation result volume will be written to.",
        argstr="--resultVolumeFileName %s",
    )
    targetVolumeFileNames = InputMultiPath(
        File(exists=True),
        desc="File names of target volumes (to be segmented).  The number of target images must be equal to the number of target images specified in the parameter set, and these images must be spatially aligned.",
        argstr="--targetVolumeFileNames %s...",
    )
    intermediateResultsDirectory = Directory(
        desc="Directory where EMSegmenter will write intermediate data (e.g., aligned atlas data).",
        exists=True,
        argstr="--intermediateResultsDirectory %s",
    )
    parametersMRMLNodeName = traits.Str(
        desc="The name of the EMSegment parameters node within the active MRML scene.  Leave blank for default.",
        argstr="--parametersMRMLNodeName %s",
    )
    disableMultithreading = traits.Int(
        desc="Disable multithreading for the EMSegmenter algorithm only! Preprocessing might still run in multi-threaded mode. -1: Do not overwrite default value. 0: Disable. 1: Enable.",
        argstr="--disableMultithreading %d",
    )
    dontUpdateIntermediateData = traits.Int(
        desc="Disable update of intermediate results.  -1: Do not overwrite default value. 0: Disable. 1: Enable.",
        argstr="--dontUpdateIntermediateData %d",
    )
    verbose = traits.Bool(desc="Enable verbose output.", argstr="--verbose ")
    loadTargetCentered = traits.Bool(
        desc="Read target files centered.", argstr="--loadTargetCentered "
    )
    loadAtlasNonCentered = traits.Bool(
        desc="Read atlas files non-centered.", argstr="--loadAtlasNonCentered "
    )
    taskPreProcessingSetting = traits.Str(
        desc="Specifies the different task parameter. Leave blank for default.",
        argstr="--taskPreProcessingSetting %s",
    )
    keepTempFiles = traits.Bool(
        desc="If flag is set then at the end of command the temporary files are not removed",
        argstr="--keepTempFiles ",
    )
    resultStandardVolumeFileName = File(
        desc="Used for testing.  Compare segmentation results to this image and return EXIT_FAILURE if they do not match.",
        exists=True,
        argstr="--resultStandardVolumeFileName %s",
    )
    dontWriteResults = traits.Bool(
        desc="Used for testing.  Don't actually write the resulting labelmap to disk.",
        argstr="--dontWriteResults ",
    )
    generateEmptyMRMLSceneAndQuit = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc="Used for testing.  Only write a scene with default mrml parameters.",
        argstr="--generateEmptyMRMLSceneAndQuit %s",
    )
    resultMRMLSceneFileName = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc="Write out the MRML scene after command line substitutions have been made.",
        argstr="--resultMRMLSceneFileName %s",
    )
    disableCompression = traits.Bool(
        desc="Don't use compression when writing result image to disk.",
        argstr="--disableCompression ",
    )
    atlasVolumeFileNames = InputMultiPath(
        File(exists=True),
        desc="Use an alternative atlas to the one that is specified by the mrml file - note the order matters ! ",
        argstr="--atlasVolumeFileNames %s...",
    )
    registrationPackage = traits.Str(
        desc="specify the registration package for preprocessing (CMTK or BRAINS or PLASTIMATCH or DEMONS)",
        argstr="--registrationPackage %s",
    )
    registrationAffineType = traits.Int(
        desc="specify the accuracy of the affine registration. -2: Do not overwrite default, -1: Test, 0: Disable, 1: Fast, 2: Accurate",
        argstr="--registrationAffineType %d",
    )
    registrationDeformableType = traits.Int(
        desc="specify the accuracy of the deformable registration. -2: Do not overwrite default, -1: Test, 0: Disable, 1: Fast, 2: Accurate",
        argstr="--registrationDeformableType %d",
    )
Example #16
0
class StreamlineTrackInputSpec(CommandLineInputSpec):
    in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, desc='the image containing the source data.' \
    'The type of data required depends on the type of tracking as set in the preceeding argument. For DT methods, ' \
    'the base DWI are needed. For SD methods, the SH harmonic coefficients of the FOD are needed.')

    seed_file = File(exists=True,
                     argstr='-seed %s',
                     mandatory=False,
                     desc='seed file')
    seed_spec = traits.List(
        traits.Int,
        desc='seed specification in voxels and radius (x y z r)',
        position=2,
        argstr='-seed %s',
        minlen=4,
        maxlen=4,
        sep=',',
        units='voxels')
    include_file = File(exists=True,
                        argstr='-include %s',
                        mandatory=False,
                        desc='inclusion file')
    include_spec = traits.List(
        traits.Int,
        desc='inclusion specification in voxels and radius (x y z r)',
        position=2,
        argstr='-include %s',
        minlen=4,
        maxlen=4,
        sep=',',
        units='voxels')
    exclude_file = File(exists=True,
                        argstr='-exclude %s',
                        mandatory=False,
                        desc='exclusion file')
    exclude_spec = traits.List(
        traits.Int,
        desc='exclusion specification in voxels and radius (x y z r)',
        position=2,
        argstr='-exclude %s',
        minlen=4,
        maxlen=4,
        sep=',',
        units='voxels')
    mask_file = File(exists=True,
                     argstr='-mask %s',
                     mandatory=False,
                     desc='mask file. Only tracks within mask.')
    mask_spec = traits.List(
        traits.Int,
        desc=
        'Mask specification in voxels and radius (x y z r). Tracks will be terminated when they leave the ROI.',
        position=2,
        argstr='-mask %s',
        minlen=4,
        maxlen=4,
        sep=',',
        units='voxels')

    inputmodel = traits.Enum('DT_STREAM',
                             'SD_PROB',
                             'SD_STREAM',
                             argstr='%s',
                             desc='input model type',
                             usedefault=True,
                             position=-3)

    stop = traits.Bool(
        argstr='-gzip',
        desc="stop track as soon as it enters any of the include regions.")
    do_not_precompute = traits.Bool(
        argstr='-noprecomputed',
        desc=
        "Turns off precomputation of the legendre polynomial values. Warning: this will slow down the algorithm by a factor of approximately 4."
    )
    unidirectional = traits.Bool(
        argstr='-unidirectional',
        desc=
        "Track from the seed point in one direction only (default is to track in both directions)."
    )
    no_mask_interpolation = traits.Bool(
        argstr='-nomaskinterp',
        desc="Turns off trilinear interpolation of mask images.")

    step_size = traits.Float(
        argstr='-step %s',
        units='mm',
        desc="Set the step size of the algorithm in mm (default is 0.2).")
    minimum_radius_of_curvature = traits.Float(
        argstr='-curvature %s',
        units='mm',
        desc=
        "Set the minimum radius of curvature (default is 2 mm for DT_STREAM, 0 for SD_STREAM, 1 mm for SD_PROB and DT_PROB)"
    )
    desired_number_of_tracks = traits.Int(argstr='-number %d', desc='Sets the desired number of tracks.'   \
    'The program will continue to generate tracks until this number of tracks have been selected and written to the output file' \
    '(default is 100 for *_STREAM methods, 1000 for *_PROB methods).')
    maximum_number_of_tracks = traits.Int(argstr='-maxnum %d', desc='Sets the maximum number of tracks to generate.' \
    "The program will not generate more tracks than this number, even if the desired number of tracks hasn't yet been reached" \
    '(default is 100 x number).')

    minimum_tract_length = traits.Float(
        argstr='-minlength %s',
        units='mm',
        desc=
        "Sets the minimum length of any track in millimeters (default is 10 mm)."
    )
    maximum_tract_length = traits.Float(
        argstr='-length %s',
        units='mm',
        desc=
        "Sets the maximum length of any track in millimeters (default is 200 mm)."
    )

    cutoff_value = traits.Float(
        argstr='-cutoff %s',
        units='NA',
        desc=
        "Set the FA or FOD amplitude cutoff for terminating tracks (default is 0.1)."
    )
    initial_cutoff_value = traits.Float(
        argstr='-initcutoff %s',
        units='NA',
        desc=
        "Sets the minimum FA or FOD amplitude for initiating tracks (default is twice the normal cutoff)."
    )

    initial_direction = traits.List(
        traits.Int,
        desc='Specify the initial tracking direction as a vector',
        argstr='-initdirection %s',
        minlen=2,
        maxlen=2,
        units='voxels')
    out_file = File(argstr='%s',
                    position=-1,
                    genfile=True,
                    desc='output data file')
Example #17
0
class PlotRealignemntParametersInputSpec(TraitedSpec):
    realignment_parameters = File(exists=True, mandatory=True)
    outlier_files = File(exists=True)
    title = traits.Str("Realignment parameters", usedefault=True)
    dpi = traits.Int(300, usedefault = True)
Example #18
0
class DSIStudioDSIReconstructionInputSpec(DSIStudioReconstructionInputSpec):
    hamming_window_len = traits.Int(16, argstr="--param0=%d")
Example #19
0
class TrackInputSpec(CommandLineInputSpec):
    in_file = File(exists=True,
                   argstr='-inputfile %s',
                   mandatory=True,
                   position=1,
                   desc='input data file')

    seed_file = File(exists=True,
                     argstr='-seedfile %s',
                     mandatory=False,
                     position=2,
                     desc='seed file')

    inputmodel = traits.Enum('dt',
                             'multitensor',
                             'pds',
                             'pico',
                             'bootstrap',
                             'ballstick',
                             'bayesdirac',
                             argstr='-inputmodel %s',
                             desc='input model type',
                             usedefault=True)

    inputdatatype = traits.Enum('float',
                                'double',
                                argstr='-inputdatatype %s',
                                desc='input file type')

    gzip = traits.Bool(argstr='-gzip',
                       desc="save the output image in gzip format")

    maxcomponents = traits.Int(
        argstr='-maxcomponents %d',
        units='NA',
        desc=
        "The maximum number of tensor components in a voxel. This determines the size of the input file and does not say anything about the voxel classification. The default is 2 if the input model is multitensor and 1 if the input model is dt."
    )

    data_dims = traits.List(traits.Int,
                            desc='data dimensions in voxels',
                            argstr='-datadims %s',
                            minlen=3,
                            maxlen=3,
                            units='voxels')

    voxel_dims = traits.List(traits.Float,
                             desc='voxel dimensions in mm',
                             argstr='-voxeldims %s',
                             minlen=3,
                             maxlen=3,
                             units='mm')

    ipthresh = traits.Float(
        argstr='-ipthresh %s',
        desc=
        'Curvature threshold for tracking, expressed as the minimum dot product between two streamline orientations calculated over the length of a voxel. If the dot product between the previous and current directions is less than this threshold, then the streamline terminates. The default setting will terminate fibres that curve by more than 80 degrees. Set this to -1.0 to disable curvature checking completely.'
    )

    curvethresh = traits.Float(
        argstr='-curvethresh %s',
        desc=
        'Curvature threshold for tracking, expressed as the maximum angle (in degrees) between between two streamline orientations calculated over the length of a voxel. If the angle is greater than this, then the streamline terminates.'
    )

    anisthresh = traits.Float(
        argstr='-anisthresh %s',
        desc=
        'Terminate fibres that enter a voxel with lower anisotropy than the threshold.'
    )

    anisfile = File(
        argstr='-anisfile %s',
        exists=True,
        desc=
        'File containing the anisotropy map. This is required to apply an anisotropy threshold with non tensor data. If the map issupplied it is always used, even in tensor data.'
    )

    outputtracts = traits.Enum('float',
                               'double',
                               'oogl',
                               argstr='-outputtracts %s',
                               desc='output tract file type')

    out_file = File(argstr='-outputfile %s',
                    position=-1,
                    genfile=True,
                    desc='output data file')

    output_root = File(exists=False,
                       argstr='-outputroot %s',
                       mandatory=False,
                       position=-1,
                       desc='root directory for output')
Example #20
0
class DSIStudioAtlasGraphInputSpec(DSIStudioConnectivityMatrixInputSpec):
    atlas_configs = traits.Dict(
        desc='atlas configs for atlases to run connectivity for')
    n_procs = traits.Int(1, usedefault=True)
Example #21
0
class SpikesOutputSpec(TraitedSpec):
    out_tsz = File(
        desc="slice-wise z-scored timeseries (Z x N), inside brainmask")
    out_spikes = File(desc="indices of spikes")
    num_spikes = traits.Int(desc="number of spikes found (total)")
Example #22
0
class DSIStudioReconstructionInputSpec(CommandLineInputSpec):
    input_src_file = File(desc="DSI Studio src file",
                          mandatory=True,
                          exists=True,
                          copyfile=False,
                          argstr="--source=%s")
    mask = File(desc="Volume to mask brain voxels",
                exists=True,
                copyfile=False,
                argstr="--mask=%s")
    grad_dev = File(desc="Gradient deviation file",
                    exists=True,
                    copyfile=True,
                    position=-1,
                    argstr="#%s")
    thread_count = traits.Int(1, usedefault=True, argstr="--thread_count=%d")
    output_odf = traits.Bool(True,
                             usedefault=True,
                             desc="Include full ODF's in output",
                             argstr="--record_odf=1")
    odf_order = traits.Enum((8, 4, 5, 6, 10, 12, 16, 20),
                            usedefault=True,
                            desc="ODF tesselation order")
    check_btable = traits.Enum(
        (1, 0),
        usedefault=True,
        argstr="--check_btable=%d",
        desc="Check if btable matches nifti orientation (not foolproof)")
    num_fibers = traits.Int(
        3,
        usedefault=True,
        argstr="--num_fiber=%d",
        desc="number of fiber populations estimated at each voxel")
    grad_dev = File(desc="Gradient deviation file",
                    exists=True,
                    copyfile=True,
                    position=-1,
                    argstr="#%s")

    # Decomposition traits
    decomposition = traits.Bool(False,
                                argstr="--decomposition=1",
                                desc="Apply ODF Decomposition")
    decomp_fraction = traits.Float(0.05,
                                   desc="Decomposition Fraction",
                                   argstr="--param3=%.2f",
                                   requires=["decomposition"])
    decomp_m_value = traits.Int(10,
                                desc="Decomposition m value",
                                argstr="--param4=%d",
                                requires=["decomposition"])

    # Deconvolution traits
    deconvolution = traits.Bool(False,
                                argstr="--deconvolution=1",
                                desc="Apply ODF Deconvolution")
    deconv_regularization = traits.Float(
        0.5,
        requires=["deconvolution"],
        desc="Deconvolution regularization parameter",
        argstr="--param2=%.2f")
Example #23
0
class SelectOneInputSpec(BaseInterfaceInputSpec):
    inlist = InputMultiPath(traits.Any,
                            mandatory=True,
                            desc='list of values to choose from')
    index = traits.Int(mandatory=True,
                       desc='0-based indice of element to extract')
Example #24
0
class ProcStreamlinesInputSpec(StdOutCommandLineInputSpec):
    inputmodel = traits.Enum('raw', 'voxels', argstr='-inputmodel %s', desc='input model type (raw or voxels)', usedefault=True)

    in_file = File(exists=True, argstr='-inputfile %s',
                    mandatory=True, position=1,
                    desc='data file')

    maxtractpoints= traits.Int(argstr='-maxtractpoints %d', units='NA',
                desc="maximum number of tract points")
    mintractpoints= traits.Int(argstr='-mintractpoints %d', units='NA',
                desc="minimum number of tract points")
    maxtractlength= traits.Int(argstr='-maxtractlength %d', units='mm',
                desc="maximum length of tracts")
    mintractlength= traits.Int(argstr='-mintractlength %d', units='mm',
                desc="minimum length of tracts")
    datadims = traits.List(traits.Int, desc = 'data dimensions in voxels',
                 argstr='-datadims %s', minlen=3, maxlen=3,
                 units='voxels')
    voxeldims = traits.List(traits.Int, desc = 'voxel dimensions in mm',
                 argstr='-voxeldims %s', minlen=3, maxlen=3,
                 units='mm')
    seedpointmm = traits.List(traits.Int, desc = 'The coordinates of a single seed point for tractography in mm',
                 argstr='-seedpointmm %s', minlen=3, maxlen=3,
                 units='mm')
    seedpointvox = traits.List(traits.Int, desc = 'The coordinates of a single seed point for tractography in voxels',
                             argstr='-seedpointvox %s', minlen=3, maxlen=3,
                             units='voxels')
    seedfile = File(exists=False, argstr='-seedfile %s',
                    desc='Image Containing Seed Points')
    regionindex = traits.Int(argstr='-regionindex %d', units='mm',
                desc="index of specific region to process")
    iterations = traits.Float(argstr='-iterations %d', units='NA',
                desc="Number of streamlines generated for each seed. Not required when outputting streamlines, but needed to create PICo images. The default is 1 if the output is streamlines, and 5000 if the output is connection probability images.")
    targetfile = File(exists=False, argstr='-targetfile %s',
                    desc='Image containing target volumes.')
    allowmultitargets = traits.Bool(argstr='-allowmultitargets', desc="Allows streamlines to connect to multiple target volumes.")
    directional = traits.List(traits.Int, desc = 'Splits the streamlines at the seed point and computes separate connection probabilities for each segment. Streamline segments are grouped according to their dot product with the vector (X, Y, Z). The ideal vector will be tangential to the streamline trajectory at the seed, such that the streamline projects from the seed along (X, Y, Z) and -(X, Y, Z). However, it is only necessary for the streamline trajectory to not be orthogonal to (X, Y, Z).',
                 argstr='-directional %s', minlen=3, maxlen=3,
                 units='NA')
    waypointfile = File(exists=False, argstr='-waypointfile %s',
                    desc='Image containing waypoints. Waypoints are defined as regions of the image with the same intensity, where 0 is background and any value > 0 is a waypoint.')
    truncateloops = traits.Bool(argstr='-truncateloops', desc="This option allows streamlines to enter a waypoint exactly once. After the streamline leaves the waypoint, it is truncated upon a second entry to the waypoint.")
    discardloops = traits.Bool(argstr='-discardloops', desc="This option allows streamlines to enter a waypoint exactly once. After the streamline leaves the waypoint, the entire streamline is discarded upon a second entry to the waypoint.")
    exclusionfile = File(exists=False, argstr='-exclusionfile %s',
                    desc='Image containing exclusion ROIs. This should be an Analyze 7.5 header / image file.hdr and file.img.')
    truncateinexclusion = traits.Bool(argstr='-truncateinexclusion', desc="Retain segments of a streamline before entry to an exclusion ROI.")

    endpointfile = File(exists=False, argstr='-endpointfile %s',
                    desc='Image containing endpoint ROIs. This should be an Analyze 7.5 header / image file.hdr and file.img.')

    resamplestepsize = traits.Float(argstr='-resamplestepsize %d', units='NA',
                desc="Each point on a streamline is tested for entry into target, exclusion or waypoint volumes. If the length between points on a tract is not much smaller than the voxel length, then streamlines may pass through part of a voxel without being counted. To avoid this, the program resamples streamlines such that the step size is one tenth of the smallest voxel dimension in the image. This increases the size of raw or oogl streamline output and incurs some performance penalty. The resample resolution can be controlled with this option or disabled altogether by passing a negative step size or by passing the -noresample option.")

    noresample = traits.Bool(argstr='-noresample', desc="Disables resampling of input streamlines. Resampling is automatically disabled if the input model is voxels.")

    outputtracts = traits.Bool(argstr='-outputtracts', desc="Output streamlines in raw binary format.")

    outputroot = File(exists=False, argstr='-outputroot %s',
                    desc='Prepended onto all output file names.')

    gzip = traits.Bool(argstr='-gzip', desc="save the output image in gzip format")
    outputcp = traits.Bool(argstr='-outputcp', desc="output the connection probability map (Analyze image, float)",
                           requires=['outputroot','seedfile'])
    outputsc = traits.Bool(argstr='-outputsc', desc="output the connection probability map (raw streamlines, int)",
                           requires=['outputroot','seedfile'])
    outputacm = traits.Bool(argstr='-outputacm', desc="output all tracts in a single connection probability map (Analyze image)",
                            requires=['outputroot','seedfile'])
    outputcbs = traits.Bool(argstr='-outputcbs', desc="outputs connectivity-based segmentation maps; requires target outputfile",
                            requires=['outputroot','targetfile','seedfile'])
Example #25
0
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,
        argstr="--olmaxim=%s",
        desc="output of local maxima volume",
        hash_files=False,
    )
    out_size_file = traits.Either(
        traits.Bool,
        File,
        argstr="--osize=%s",
        desc="filename for output of size image",
        hash_files=False,
    )
    out_max_file = traits.Either(
        traits.Bool,
        File,
        argstr="--omax=%s",
        desc="filename for output of max image",
        hash_files=False,
    )
    out_mean_file = traits.Either(
        traits.Bool,
        File,
        argstr="--omean=%s",
        desc="filename for output of mean image",
        hash_files=False,
    )
    out_pval_file = traits.Either(
        traits.Bool,
        File,
        argstr="--opvals=%s",
        desc="filename for image output of log pvals",
        hash_files=False,
    )
    pthreshold = traits.Float(
        argstr="--pthresh=%.10f",
        requires=["dlh", "volume"],
        desc="p-threshold for clusters",
    )
    peak_distance = traits.Float(
        argstr="--peakdist=%.10f",
        desc="minimum distance between local maxima/minima, in mm (default 0)",
    )
    cope_file = File(argstr="--cope=%s", desc="cope volume")
    volume = traits.Int(argstr="--volume=%d", desc="number of voxels in the mask")
    dlh = traits.Float(
        argstr="--dlh=%.10f", desc="smoothness estimate = sqrt(det(Lambda))"
    )
    fractional = traits.Bool(
        False,
        usedefault=True,
        argstr="--fractional",
        desc="interprets the threshold as a fraction of the robust range",
    )
    connectivity = traits.Int(
        argstr="--connectivity=%d", desc="the connectivity of voxels (default 26)"
    )
    use_mm = traits.Bool(
        False, usedefault=True, argstr="--mm", desc="use mm, not voxel, coordinates"
    )
    find_min = traits.Bool(
        False, usedefault=True, argstr="--min", desc="find minima instead of maxima"
    )
    no_table = traits.Bool(
        False,
        usedefault=True,
        argstr="--no_table",
        desc="suppresses printing of the table info",
    )
    minclustersize = traits.Bool(
        False,
        usedefault=True,
        argstr="--minclustersize",
        desc="prints out minimum significant cluster size",
    )
    xfm_file = File(
        argstr="--xfm=%s",
        desc=(
            "filename for Linear: input->standard-space "
            "transform. Non-linear: input->highres transform"
        ),
    )
    std_space_file = File(
        argstr="--stdvol=%s", desc="filename for standard-space volume"
    )
    num_maxima = traits.Int(argstr="--num=%d", desc="no of local maxima to report")
    warpfield_file = File(argstr="--warpvol=%s", desc="file contining warpfield")
    voxthresh= traits.Bool(
        False,
        usedefault=True,
        argstr="--voxthresh",
        desc="voxel-wise thresholding (corrected)",
    )
    resels = traits.Float(
        argstr="--resels=%.10f",
        desc="Size of one resel in voxel units",
    )
Example #26
0
class AnalyzeHeaderInputSpec(StdOutCommandLineInputSpec):
    in_file = File(exists=True, argstr='< %s', mandatory=True, position=1,
                   desc='Tensor-fitted data filename')

    scheme_file = File(exists=True, argstr='%s', position=2,
                       desc=('Camino scheme file (b values / vectors, '
                             'see camino.fsl2scheme)'))

    readheader = File(exists=True, argstr='-readheader %s', position=3,
                      desc=('Reads header information from file and prints to '
                            'stdout. If this option is not specified, then the '
                            'program writes a header based on the other '
                            'arguments.'))

    printimagedims = File(exists=True, argstr='-printimagedims %s', position=3,
                          desc=('Prints image data and voxel dimensions as '
                                'Camino arguments and exits.'))

    # How do we implement both file and enum (for the program) in one argument?
    # Is this option useful anyway?
    #-printprogargs <file> <prog>
    #Prints data dimension (and type, if relevant) arguments for a specific
    # Camino program, where prog is one of shredder, scanner2voxel,
    # vcthreshselect, pdview, track.
    printprogargs = File(exists=True, argstr='-printprogargs %s', position=3,
                         desc=('Prints data dimension (and type, if relevant) '
                               'arguments for a specific Camino program, where '
                               'prog is one of shredder, scanner2voxel, '
                               'vcthreshselect, pdview, track.'))

    printintelbyteorder = File(exists=True, argstr='-printintelbyteorder %s',
                               position=3,
                               desc=('Prints 1 if the header is little-endian, '
                                     '0 otherwise.'))

    printbigendian = File(exists=True, argstr='-printbigendian %s', position=3,
                          desc=('Prints 1 if the header is big-endian, 0 '
                                'otherwise.'))

    initfromheader = File(exists=True, argstr='-initfromheader %s', position=3,
                          desc=('Reads header information from file and '
                                'intializes a new header with the values read '
                                'from the file. You may replace any '
                                'combination of fields in the new header by '
                                'specifying subsequent options.'))

    data_dims = traits.List(traits.Int, desc = 'data dimensions in voxels',
                            argstr='-datadims %s', minlen=3, maxlen=3,
                            units='voxels')

    voxel_dims = traits.List(traits.Float, desc = 'voxel dimensions in mm',
                             argstr='-voxeldims %s', minlen=3, maxlen=3,
                             units='mm')

    centre = traits.List(traits.Int, argstr='-centre %s', minlen=3, maxlen=3,
                         units='mm',
                         desc=('Voxel specifying origin of Talairach '
                               'coordinate system for SPM, default [0 0 0].'))

    picoseed = traits.List(traits.Int, argstr='-picoseed %s', minlen=3,
                           maxlen=3,
                           desc=('Voxel specifying the seed (for PICo maps), '
                                 'default [0 0 0].'), units='mm')

    nimages = traits.Int(argstr='-nimages %d', units='NA',
                         desc="Number of images in the img file. Default 1.")

    datatype = traits.Enum('byte', 'char', '[u]short', '[u]int', 'float',
                           'complex', 'double', argstr='-datatype %s',
                           desc=('The char datatype is 8 bit (not the 16 bit '
                                 'char of Java), as specified by the Analyze '
                                 '7.5 standard. The byte, ushort and uint '
                                 'types are not part of the Analyze '
                                 'specification but are supported by SPM.'),
                           mandatory=True)

    offset = traits.Int(argstr='-offset %d', units='NA',
                        desc=('According to the Analyze 7.5 standard, this is '
                              'the byte offset in the .img file at which '
                              'voxels start. This value can be negative to '
                              'specify that the absolute value is applied for '
                              'every image in the file.'))

    greylevels = traits.List(traits.Int, argstr='-gl %s', minlen=2, maxlen=2,
                             desc=('Minimum and maximum greylevels. Stored as '
                                   'shorts in the header.'), units='NA')

    scaleslope = traits.Float(argstr='-scaleslope %d', units='NA',
                              desc=('Intensities in the image are scaled by '
                                    'this factor by SPM and MRICro. Default is '
                                    '1.0.'))

    scaleinter = traits.Float(argstr='-scaleinter %d', units='NA',
                              desc=('Constant to add to the image intensities. '
                                    'Used by SPM and MRIcro.'))

    description = traits.String(argstr='-description %s',
                                desc=('Short description - No spaces, max '
                                      'length 79 bytes. Will be null '
                                      'terminated automatically.'))

    intelbyteorder = traits.Bool(argstr='-intelbyteorder',
                                 desc=("Write header in intel byte order "
                                       "(little-endian)."))

    networkbyteorder = traits.Bool(argstr='-networkbyteorder',
                                   desc=("Write header in network byte order "
                                         "(big-endian). This is the default "
                                         "for new headers."))
Example #27
0
class BRAINSABCInputSpec(CommandLineInputSpec):
    inputVolumes = InputMultiPath(File(exists=True),
                                  argstr="--inputVolumes %s...")
    atlasDefinition = File(exists=True, argstr="--atlasDefinition %s")
    inputVolumeTypes = InputMultiPath(traits.Str,
                                      sep=",",
                                      argstr="--inputVolumeTypes %s")
    outputDir = traits.Either(traits.Bool,
                              Directory(),
                              hash_files=False,
                              argstr="--outputDir %s")
    atlasToSubjectTransformType = traits.Enum(
        "ID",
        "Rigid",
        "Affine",
        "BSpline",
        argstr="--atlasToSubjectTransformType %s")
    atlasToSubjectTransform = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        argstr="--atlasToSubjectTransform %s")
    atlasToSubjectInitialTransform = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        argstr="--atlasToSubjectInitialTransform %s")
    subjectIntermodeTransformType = traits.Enum(
        "ID",
        "Rigid",
        "Affine",
        "BSpline",
        argstr="--subjectIntermodeTransformType %s")
    outputVolumes = traits.Either(traits.Bool,
                                  InputMultiPath(File(), ),
                                  hash_files=False,
                                  argstr="--outputVolumes %s...")
    outputLabels = traits.Either(traits.Bool,
                                 File(),
                                 hash_files=False,
                                 argstr="--outputLabels %s")
    outputDirtyLabels = traits.Either(traits.Bool,
                                      File(),
                                      hash_files=False,
                                      argstr="--outputDirtyLabels %s")
    posteriorTemplate = traits.Str(argstr="--posteriorTemplate %s")
    outputFormat = traits.Enum("NIFTI",
                               "Meta",
                               "Nrrd",
                               argstr="--outputFormat %s")
    resamplerInterpolatorType = traits.Enum("BSpline",
                                            "NearestNeighbor",
                                            "WindowedSinc",
                                            "Linear",
                                            "ResampleInPlace",
                                            "Hamming",
                                            "Cosine",
                                            "Welch",
                                            "Lanczos",
                                            "Blackman",
                                            argstr="--interpolationMode %s")
    maxIterations = traits.Int(argstr="--maxIterations %d")
    medianFilterSize = InputMultiPath(traits.Int,
                                      sep=",",
                                      argstr="--medianFilterSize %s")
    filterIteration = traits.Int(argstr="--filterIteration %d")
    filterTimeStep = traits.Float(argstr="--filterTimeStep %f")
    filterMethod = traits.Enum("None",
                               "CurvatureFlow",
                               "GradientAnisotropicDiffusion",
                               "Median",
                               argstr="--filterMethod %s")
    maxBiasDegree = traits.Int(argstr="--maxBiasDegree %d")
    atlasWarpingOff = traits.Bool(argstr="--atlasWarpingOff ")
    gridSize = InputMultiPath(traits.Int, sep=",", argstr="--gridSize %s")
    defaultSuffix = traits.Str(argstr="--defaultSuffix %s")
    implicitOutputs = traits.Either(traits.Bool,
                                    InputMultiPath(File(), ),
                                    hash_files=False,
                                    argstr="--implicitOutputs %s...")
    debuglevel = traits.Int(argstr="--debuglevel %d")
    writeLess = traits.Bool(argstr="--writeLess ")
    numberOfThreads = traits.Int(argstr="--numberOfThreads %d")
Example #28
0
class VBRAINSDemonWarpInputSpec(CommandLineInputSpec):
    movingVolume = InputMultiPath(File(exists=True),
                                  desc="Required: input moving image",
                                  argstr="--movingVolume %s...")
    fixedVolume = InputMultiPath(File(exists=True),
                                 desc="Required: input fixed (target) image",
                                 argstr="--fixedVolume %s...")
    inputPixelType = traits.Enum(
        "float",
        "short",
        "ushort",
        "int",
        "uchar",
        desc=
        "Input volumes will be typecast to this format: float|short|ushort|int|uchar",
        argstr="--inputPixelType %s")
    outputVolume = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc=
        "Required: output resampled moving image (will have the same physical space as the fixedVolume).",
        argstr="--outputVolume %s")
    outputDisplacementFieldVolume = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc=
        "Output deformation field vector image (will have the same physical space as the fixedVolume).",
        argstr="--outputDisplacementFieldVolume %s")
    outputPixelType = traits.Enum(
        "float",
        "short",
        "ushort",
        "int",
        "uchar",
        desc=
        "outputVolume will be typecast to this format: float|short|ushort|int|uchar",
        argstr="--outputPixelType %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")
    registrationFilterType = traits.Enum(
        "Demons",
        "FastSymmetricForces",
        "Diffeomorphic",
        "LogDemons",
        "SymmetricLogDemons",
        desc=
        "Registration Filter Type: Demons|FastSymmetricForces|Diffeomorphic|LogDemons|SymmetricLogDemons",
        argstr="--registrationFilterType %s")
    smoothDisplacementFieldSigma = traits.Float(
        desc=
        "A gaussian smoothing value to be applied to the deformation feild at each iteration.",
        argstr="--smoothDisplacementFieldSigma %f")
    numberOfPyramidLevels = traits.Int(
        desc=
        "Number of image pyramid levels to use in the multi-resolution registration.",
        argstr="--numberOfPyramidLevels %d")
    minimumFixedPyramid = InputMultiPath(
        traits.Int,
        desc=
        "The shrink factor for the first level of the fixed image pyramid. (i.e. start at 1/16 scale, then 1/8, then 1/4, then 1/2, and finally full scale)",
        sep=",",
        argstr="--minimumFixedPyramid %s")
    minimumMovingPyramid = InputMultiPath(
        traits.Int,
        desc=
        "The shrink factor for the first level of the moving image pyramid. (i.e. start at 1/16 scale, then 1/8, then 1/4, then 1/2, and finally full scale)",
        sep=",",
        argstr="--minimumMovingPyramid %s")
    arrayOfPyramidLevelIterations = InputMultiPath(
        traits.Int,
        desc="The number of iterations for each pyramid level",
        sep=",",
        argstr="--arrayOfPyramidLevelIterations %s")
    histogramMatch = traits.Bool(
        desc=
        "Histogram Match the input images.  This is suitable for images of the same modality that may have different absolute scales, but the same overall intensity profile.",
        argstr="--histogramMatch ")
    numberOfHistogramBins = traits.Int(desc="The number of histogram levels",
                                       argstr="--numberOfHistogramBins %d")
    numberOfMatchPoints = traits.Int(
        desc="The number of match points for histrogramMatch",
        argstr="--numberOfMatchPoints %d")
    medianFilterSize = InputMultiPath(
        traits.Int,
        desc=
        "Median filter radius in all 3 directions.  When images have a lot of salt and pepper noise, this step can improve the registration.",
        sep=",",
        argstr="--medianFilterSize %s")
    initializeWithDisplacementField = File(
        desc="Initial deformation field vector image file name",
        exists=True,
        argstr="--initializeWithDisplacementField %s")
    initializeWithTransform = File(desc="Initial Transform filename",
                                   exists=True,
                                   argstr="--initializeWithTransform %s")
    makeBOBF = traits.Bool(
        desc=
        "Flag to make Brain-Only Background-Filled versions of the input and target volumes.",
        argstr="--makeBOBF ")
    fixedBinaryVolume = File(
        desc="Mask filename for desired region of interest in the Fixed image.",
        exists=True,
        argstr="--fixedBinaryVolume %s")
    movingBinaryVolume = File(
        desc=
        "Mask filename for desired region of interest in the Moving image.",
        exists=True,
        argstr="--movingBinaryVolume %s")
    lowerThresholdForBOBF = traits.Int(
        desc="Lower threshold for performing BOBF",
        argstr="--lowerThresholdForBOBF %d")
    upperThresholdForBOBF = traits.Int(
        desc="Upper threshold for performing BOBF",
        argstr="--upperThresholdForBOBF %d")
    backgroundFillValue = traits.Int(
        desc="Replacement value to overwrite background when performing BOBF",
        argstr="--backgroundFillValue %d")
    seedForBOBF = InputMultiPath(
        traits.Int,
        desc="coordinates in all 3 directions for Seed when performing BOBF",
        sep=",",
        argstr="--seedForBOBF %s")
    neighborhoodForBOBF = InputMultiPath(
        traits.Int,
        desc=
        "neighborhood in all 3 directions to be included when performing BOBF",
        sep=",",
        argstr="--neighborhoodForBOBF %s")
    outputDisplacementFieldPrefix = traits.Str(
        desc=
        "Displacement field filename prefix for writing separate x, y, and z component images",
        argstr="--outputDisplacementFieldPrefix %s")
    outputCheckerboardVolume = traits.Either(
        traits.Bool,
        File(),
        hash_files=False,
        desc=
        "Genete a checkerboard image volume between the fixedVolume and the deformed movingVolume.",
        argstr="--outputCheckerboardVolume %s")
    checkerboardPatternSubdivisions = InputMultiPath(
        traits.Int,
        desc="Number of Checkerboard subdivisions in all 3 directions",
        sep=",",
        argstr="--checkerboardPatternSubdivisions %s")
    outputNormalized = traits.Bool(
        desc=
        "Flag to warp and write the normalized images to output.  In normalized images the image values are fit-scaled to be between 0 and the maximum storage type value.",
        argstr="--outputNormalized ")
    outputDebug = traits.Bool(
        desc="Flag to write debugging images after each step.",
        argstr="--outputDebug ")
    weightFactors = InputMultiPath(
        traits.Float,
        desc="Weight fatctors for each input images",
        sep=",",
        argstr="--weightFactors %s")
    gradient_type = traits.Enum(
        "0",
        "1",
        "2",
        desc=
        "Type of gradient used for computing the demons force (0 is symmetrized, 1 is fixed image, 2 is moving image)",
        argstr="--gradient_type %s")
    upFieldSmoothing = traits.Float(
        desc="Smoothing sigma for the update field at each iteration",
        argstr="--upFieldSmoothing %f")
    max_step_length = traits.Float(
        desc="Maximum length of an update vector (0: no restriction)",
        argstr="--max_step_length %f")
    use_vanilla_dem = traits.Bool(desc="Run vanilla demons algorithm",
                                  argstr="--use_vanilla_dem ")
    gui = traits.Bool(desc="Display intermediate image volumes for debugging",
                      argstr="--gui ")
    promptUser = traits.Bool(
        desc=
        "Prompt the user to hit enter each time an image is sent to the DebugImageViewer",
        argstr="--promptUser ")
    numberOfBCHApproximationTerms = traits.Int(
        desc="Number of terms in the BCH expansion",
        argstr="--numberOfBCHApproximationTerms %d")
    numberOfThreads = traits.Int(
        desc="Explicitly specify the maximum number of threads to use.",
        argstr="--numberOfThreads %d")
Example #29
0
class TOPUPInputSpec(FSLCommandInputSpec):
    in_file = File(exists=True,
                   mandatory=True,
                   desc='name of 4D file with images',
                   argstr='--imain=%s')
    encoding_file = File(exists=True,
                         mandatory=True,
                         xor=['encoding_direction'],
                         desc='name of text file with PE directions/times',
                         argstr='--datain=%s')
    encoding_direction = traits.List(traits.Enum('y', 'x', 'z', 'x-', 'y-',
                                                 'z-'),
                                     mandatory=True,
                                     xor=['encoding_file'],
                                     requires=['readout_times'],
                                     argstr='--datain=%s',
                                     desc=('encoding direction for automatic '
                                           'generation of encoding_file'))
    readout_times = InputMultiPath(traits.Float,
                                   requires=['encoding_direction'],
                                   xor=['encoding_file'],
                                   mandatory=True,
                                   desc=('readout times (dwell times by # '
                                         'phase-encode steps minus 1)'))
    out_base = File(desc=('base-name of output files (spline '
                          'coefficients (Hz) and movement parameters)'),
                    name_source=['in_file'],
                    name_template='%s_base',
                    argstr='--out=%s',
                    hash_files=False)
    out_field = File(argstr='--fout=%s',
                     hash_files=False,
                     name_source=['in_file'],
                     name_template='%s_field',
                     desc='name of image file with field (Hz)')
    out_corrected = File(argstr='--iout=%s',
                         hash_files=False,
                         name_source=['in_file'],
                         name_template='%s_corrected',
                         desc='name of 4D image file with unwarped images')
    out_logfile = File(argstr='--logout=%s',
                       desc='name of log-file',
                       name_source=['in_file'],
                       name_template='%s_topup.log',
                       keep_extension=True,
                       hash_files=False)

    # TODO: the following traits admit values separated by commas, one value
    # per registration level inside topup.
    warp_res = traits.Float(10.0,
                            argstr='--warpres=%f',
                            desc=('(approximate) resolution (in mm) of warp '
                                  'basis for the different sub-sampling levels'
                                  '.'))
    subsamp = traits.Int(1, argstr='--subsamp=%d', desc='sub-sampling scheme')
    fwhm = traits.Float(8.0,
                        argstr='--fwhm=%f',
                        desc='FWHM (in mm) of gaussian smoothing kernel')
    config = traits.String('b02b0.cnf',
                           argstr='--config=%s',
                           usedefault=True,
                           desc=('Name of config file specifying command line '
                                 'arguments'))
    max_iter = traits.Int(5,
                          argstr='--miter=%d',
                          desc='max # of non-linear iterations')
    reg_lambda = traits.Float(1.0,
                              argstr='--miter=%0.f',
                              desc=('lambda weighting value of the '
                                    'regularisation term'))
    ssqlambda = traits.Enum(1,
                            0,
                            argstr='--ssqlambda=%d',
                            desc=('Weight lambda by the current value of the '
                                  'ssd. If used (=1), the effective weight of '
                                  'regularisation term becomes higher for the '
                                  'initial iterations, therefore initial steps'
                                  ' are a little smoother than they would '
                                  'without weighting. This reduces the '
                                  'risk of finding a local minimum.'))
    regmod = traits.Enum('bending_energy',
                         'membrane_energy',
                         argstr='--regmod=%s',
                         desc=('Regularisation term implementation. Defaults '
                               'to bending_energy. Note that the two functions'
                               ' have vastly different scales. The membrane '
                               'energy is based on the first derivatives and '
                               'the bending energy on the second derivatives. '
                               'The second derivatives will typically be much '
                               'smaller than the first derivatives, so input '
                               'lambda will have to be larger for '
                               'bending_energy to yield approximately the same'
                               ' level of regularisation.'))
    estmov = traits.Enum(1,
                         0,
                         argstr='--estmov=%d',
                         desc='estimate movements if set')
    minmet = traits.Enum(0,
                         1,
                         argstr='--minmet=%d',
                         desc=('Minimisation method 0=Levenberg-Marquardt, '
                               '1=Scaled Conjugate Gradient'))
    splineorder = traits.Int(3,
                             argstr='--splineorder=%d',
                             desc=('order of spline, 2->Qadratic spline, '
                                   '3->Cubic spline'))
    numprec = traits.Enum('double',
                          'float',
                          argstr='--numprec=%s',
                          desc=('Precision for representing Hessian, double '
                                'or float.'))
    interp = traits.Enum('spline',
                         'linear',
                         argstr='--interp=%s',
                         desc='Image interpolation model, linear or spline.')
    scale = traits.Enum(0,
                        1,
                        argstr='--scale=%d',
                        desc=('If set (=1), the images are individually scaled'
                              ' to a common mean'))
    regrid = traits.Enum(1,
                         0,
                         argstr='--regrid=%d',
                         desc=('If set (=1), the calculations are done in a '
                               'different grid'))
Example #30
0
class RegistrationImageInputSpec(BaseInterfaceInputSpec):
    fixed_img = File(desc='Fixed image')
    moving_img = File(desc='Moving image')
    mask_img = File(desc='Mask of interest')
    out_dir = Directory(desc='output directory')
    cuts = traits.Int(default_value=7)