Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
xor=('reg_file', 'reg_header', 'identity'),
desc='label template volume')
identity = traits.Bool(
argstr='--identity',
xor=('reg_file', 'reg_header', 'identity'),
desc='set R=I')
invert_mtx = traits.Bool(
argstr='--invertmtx', desc='Invert the registration matrix')
fill_thresh = traits.Range(
0., 1., argstr='--fillthresh %g', desc='thresh : between 0 and 1')
label_voxel_volume = traits.Float(
argstr='--labvoxvol %f', desc='volume of each label point (def 1mm3)')
proj = traits.Tuple(
traits.Enum('abs', 'frac'),
traits.Float,
traits.Float,
traits.Float,
argstr='--proj %s %f %f %f',
requires=('subject_id', 'hemi'),
desc='project along surface normal')
subject_id = traits.Str(argstr='--subject %s', desc='subject id')
hemi = traits.Enum(
'lh', 'rh', argstr='--hemi %s', desc='hemisphere to use lh or rh')
surface = traits.Str(
argstr='--surf %s', desc='use surface instead of white')
vol_label_file = File(argstr='--o %s', genfile=True, desc='output volume')
label_hit_file = File(
argstr='--hits %s', desc='file with each frame is nhits for a label')
map_label_stat = File(
argstr='--label-stat %s',
desc='map the label stats field into the vol')
native_vox2ras = traits.Bool(
reg_file = File(
desc="registers volume to surface anatomical ",
argstr="--reg %s",
mandatory=True,
exists=True,
)
smoothed_file = File(desc="output volume", argstr="--o %s", genfile=True)
proj_frac_avg = traits.Tuple(
traits.Float,
traits.Float,
traits.Float,
xor=["proj_frac"],
desc="average a long normal min max delta",
argstr="--projfrac-avg %.2f %.2f %.2f",
)
proj_frac = traits.Float(
desc="project frac of thickness a long surface normal",
xor=["proj_frac_avg"],
argstr="--projfrac %s",
)
surface_fwhm = traits.Range(
low=0.0,
requires=["reg_file"],
mandatory=True,
xor=["num_iters"],
desc="surface FWHM in mm",
argstr="--fwhm %f",
)
num_iters = traits.Range(
low=1,
xor=["surface_fwhm"],
mandatory=True,
splineGridSize = InputMultiPath(traits.Int, desc="The number of subdivisions of the BSpline Grid to be centered on the image space. Each dimension must have at least 3 subdivisions for the BSpline to be correctly computed. ", sep=",", argstr="--splineGridSize %s")
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.", exists=True, argstr="--fixedBinaryVolume %s")
movingBinaryVolume = File(desc="Moving Image binary mask volume, ONLY FOR MANUAL ROI mode.", 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.", argstr="--outputFixedVolumeROI %s")
outputMovingVolumeROI = traits.Either(traits.Bool, File(), hash_files=False, desc="The ROI automatically found in moving image, ONLY FOR ROIAUTO mode.", 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 --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 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, and BSpline. 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.", 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")
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="Using mode AUTO means OFF for BSplineDeformableTransforms and ON for the linear transforms. The ON alternative uses more memory to sometimes do a better job.", 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. At 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")
argstr='-o %s',
hash_files=False,
genfile=True)
outputMaskFile = File(
desc=
'save smooth brain mask. If unspecified, output file name will be auto generated.',
argstr='--mask %s',
hash_files=False,
genfile=True)
diffusionConstant = traits.Float(
25, usedefault=True, desc='diffusion constant', argstr='-d %f')
diffusionIterations = traits.Int(
3, usedefault=True, desc='diffusion iterations', argstr='-n %d')
edgeDetectionConstant = traits.Float(
0.64, usedefault=True, desc='edge detection constant', argstr='-s %f')
radius = traits.Float(
1,
usedefault=True,
desc='radius of erosion/dilation filter',
argstr='-r %f')
dilateFinalMask = traits.Bool(
True, usedefault=True, desc='dilate final mask', argstr='-p')
trim = traits.Bool(
True, usedefault=True, desc='trim brainstem', argstr='--trim')
outputDiffusionFilter = File(
desc='diffusion filter output', argstr='--adf %s', hash_files=False)
outputEdgeMap = File(
desc='edge map output', argstr='--edge %s', hash_files=False)
outputDetailedBrainMask = File(
desc='save detailed brain mask', argstr='--hires %s', hash_files=False)
outputCortexFile = File(
desc='cortex file', argstr='--cortex %s', hash_files=False)
transform = traits.Tuple(
traits.Enum('Affine', 'Rigid', 'Similarity'),
traits.Range(value=0.1, low=0.0, exclude_low=True),
argstr='-t %s[%f]', usedefault=True,
desc='Several transform options are available')
principal_axes = traits.Bool(False, usedefault=True, argstr='-p %d', xor=['blobs'],
desc='align using principal axes')
search_factor = traits.Tuple(
traits.Float(20), traits.Range(value=0.12, low=0.0, high=1.0),
usedefault=True, argstr='-s [%f,%f]', desc='search factor')
search_grid = traits.Either(
traits.Tuple(traits.Float, traits.Tuple(traits.Float, traits.Float, traits.Float)),
traits.Tuple(traits.Float, traits.Tuple(traits.Float, traits.Float)),
argstr='-g %s', desc='Translation search grid in mm')
convergence = traits.Tuple(
traits.Range(low=1, high=10000, value=10),
traits.Float(1e-6),
traits.Range(low=1, high=100, value=10),
usedefault=True, argstr='-c [%d,%f,%d]', desc='convergence')
output_transform = traits.File(
'initialization.mat', usedefault=True, argstr='-o %s',
desc='output file name')
class AIOuputSpec(base.TraitedSpec):
output_transform = traits.File(exists=True, desc='output file name')
argstr='--pava', desc='estimates autocorr using PAVA')
autocorr_noestimate = traits.Bool(
argstr='--noest', xor=_estimate_xor, desc='do not estimate autocorrs')
output_pwdata = traits.Bool(
argstr='--outputPWdata',
desc=('output prewhitened data and average '
'design matrix'))
results_dir = Directory(
'results',
argstr='--rn=%s',
usedefault=True,
desc='directory to store results in')
class FILMGLSInputSpec507(FILMGLSInputSpec505):
threshold = traits.Float(
default=-1000.,
argstr='--thr=%f',
position=-1,
usedefault=True,
desc='threshold')
tcon_file = File(
exists=True,
argstr='--con=%s',
desc='contrast file containing T-contrasts')
fcon_file = File(
exists=True,
argstr='--fcon=%s',
desc='contrast file containing F-contrasts')
mode = traits.Enum(
'volumetric',
'surface',
)
maximumStepLength = traits.Float(
desc="Starting step length of the optimizer. In general, higher values allow for recovering larger initial misalignments but there is an increased chance that the registration will not converge.",
argstr="--maximumStepLength %f",
)
minimumStepLength = InputMultiPath(
traits.Float,
desc="Each step in the optimization takes steps at least this big. When none are possible, registration is complete. Smaller values allows the optimizer to make smaller adjustments, but the registration time may increase.",
sep=",",
argstr="--minimumStepLength %s",
)
relaxationFactor = traits.Float(
desc="Specifies how quickly the optimization step length is decreased during registration. The value must be larger than 0 and smaller than 1. Larger values result in slower step size decrease, which allow for recovering larger initial misalignments but it increases the registration time and the chance that the registration will not converge.",
argstr="--relaxationFactor %f",
)
translationScale = traits.Float(
desc="How much to scale up changes in position (in mm) compared to unit rotational changes (in radians) -- decrease this to allow for more rotation in the search pattern.",
argstr="--translationScale %f",
)
reproportionScale = traits.Float(
desc="ScaleVersor3D 'Scale' compensation factor. Increase this to allow for 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 allow for more skew in a ScaleSkewVersor3D search pattern. 1.0 works well with a translationScale of 1000.0",
argstr="--skewScale %f",
)
maxBSplineDisplacement = traits.Float(
desc="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",
)
fixedVolumeTimeIndex = traits.Int(
"- NN: Nearest-neighbour interpolation, just "
"uses the local voxel data directly."
"- PROB_NN: Probabilistic nearest-neighbor "
"interpolation, similar to the method pro- "
"posed by Behrens et al [Magnetic Resonance "
"in Medicine, 50:1077-1088, 2003]. The data "
"is not interpolated, but at each point we "
"randomly choose one of the 8 voxels sur- "
"rounding a point. The probability of choosing "
"a particular voxel is based on how close the "
"point is to the centre of that voxel."
"- LINEAR: Linear interpolation of the vector "
"field containing the principal directions at "
"each point."))
stepsize = traits.Float(
argstr='-stepsize %f',
requires=['tracker'],
desc=('Step size for EULER and RK4 tracking. '
'The default is 1mm.'))
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 "
)
bias_fwhm = traits.Enum(
60,
(30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, "Inf"),
field="estwrite.opts.biasfwhm",
usedefault=True,
desc="FWHM of Gaussian smoothness of bias",
)
sampling_distance = traits.Float(
3,
usedefault=True,
field="estwrite.opts.samp",
desc="Sampling distance on data for parameter estimation",
)
warping_regularization = traits.Float(
4,
usedefault=True,
field="estwrite.opts.warpreg",
desc="Controls balance between parameters and data",
)
spatial_normalization = traits.Enum("high", "low", usedefault=True,)
dartel_template = ImageFileSPM(
exists=True, field="estwrite.extopts.dartelwarp.normhigh.darteltpm"
)
use_sanlm_denoising_filter = traits.Range(
0,
2,
2,
usedefault=True,
field="estwrite.extopts.sanlm",
'Percentage of points accessible to the sampling strategy over which '
'to optimize the metric.')
fixed_image_mask = File(
exists=True,
argstr='%s',
desc='mask used to limit metric sampling region of the fixed image',
)
moving_image_mask = File(
exists=True,
requires=['fixed_image_mask'],
desc='mask used to limit metric sampling region of the moving image',
)
class MeasureImageSimilarityOutputSpec(TraitedSpec):
similarity = traits.Float()
class MeasureImageSimilarity(ANTSCommand):
"""
Examples
--------
>>> from nipype.interfaces.ants import MeasureImageSimilarity
>>> sim = MeasureImageSimilarity()
>>> sim.inputs.dimension = 3
>>> sim.inputs.metric = 'MI'
>>> sim.inputs.fixed_image = 'T1.nii'
>>> sim.inputs.moving_image = 'resting.nii'
>>> sim.inputs.metric_weight = 1.0