niworkflows.interfaces.fixes module

class niworkflows.interfaces.fixes.FixHeaderApplyTransforms(**inputs)[source]

Bases: ApplyTransforms

Wrapped executable: antsApplyTransforms.

A replacement for nipype.interfaces.ants.resampling.ApplyTransforms that fixes the resampled image header to match the xform of the reference image

Mandatory Inputs:
  • input_image (a pathlike object or string representing an existing file) – Image to apply transformation to (generally a coregistered functional). Maps to a command-line argument: --input %s.

  • reference_image (a pathlike object or string representing an existing file) – Reference image space that you wish to warp INTO. Maps to a command-line argument: --reference-image %s.

  • transforms (a list of items which are a pathlike object or string representing an existing file or ‘identity’) – Transform files: will be applied in reverse order. For example, the last specified transform will be applied first. Maps to a command-line argument: %s.

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • default_value (a float) – Maps to a command-line argument: --default-value %g. (Nipype default value: 0.0)

  • dimension (2 or 3 or 4) – This option forces the image to be treated as a specified-dimensional image. If not specified, antsWarp tries to infer the dimensionality from the input image. Maps to a command-line argument: --dimensionality %d.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • float (a boolean) – Use float instead of double for computations. Maps to a command-line argument: --float %d. (Nipype default value: False)

  • input_image_type (0 or 1 or 2 or 3) – Option specifying the input image type of scalar (default), vector, tensor, or time series. Maps to a command-line argument: --input-image-type %d.

  • interpolation (‘Linear’ or ‘NearestNeighbor’ or ‘CosineWindowedSinc’ or ‘WelchWindowedSinc’ or ‘HammingWindowedSinc’ or ‘LanczosWindowedSinc’ or ‘MultiLabel’ or ‘Gaussian’ or ‘BSpline’) – Maps to a command-line argument: %s. (Nipype default value: Linear)

  • interpolation_parameters (a tuple of the form: (an integer) or a tuple of the form: (a float, a float))

  • invert_transform_flags (a list of items which are a boolean)

  • num_threads (an integer) – Number of ITK threads to use. (Nipype default value: 1)

  • out_postfix (a string) – Postfix that is appended to all output files (default = _trans). (Nipype default value: _trans)

  • output_image (a string) – Output file name. Maps to a command-line argument: --output %s.

  • print_out_composite_warp_file (a boolean) – Output a composite warp file instead of a transformed image. Requires inputs: output_image.

Outputs:

output_image (a pathlike object or string representing an existing file) – Warped image.

class niworkflows.interfaces.fixes.FixHeaderRegistration(**inputs)[source]

Bases: Registration

Wrapped executable: antsRegistration.

A replacement for nipype.interfaces.ants.registration.Registration that fixes the resampled image header to match the xform of the reference image

Mandatory Inputs:
  • fixed_image (a list of items which are a pathlike object or string representing an existing file) – Image to which the moving_image should be transformed(usually a structural image).

  • metric (a list of items which are ‘CC’ or ‘MeanSquares’ or ‘Demons’ or ‘GC’ or ‘MI’ or ‘Mattes’ or a list of items which are ‘CC’ or ‘MeanSquares’ or ‘Demons’ or ‘GC’ or ‘MI’ or ‘Mattes’) – The metric(s) to use for each stage. Note that multiple metrics per stage are not supported in ANTS 1.9.1 and earlier.

  • metric_weight (a list of items which are a float or a list of items which are a float) – The metric weight(s) for each stage. The weights must sum to 1 per stage. Requires inputs: metric. (Nipype default value: [1.0])

  • moving_image (a list of items which are a pathlike object or string representing an existing file) – Image that will be registered to the space of fixed_image. This is theimage on which the transformations will be applied to.

  • shrink_factors (a list of items which are a list of items which are an integer)

  • smoothing_sigmas (a list of items which are a list of items which are a float)

  • transforms (a list of items which are ‘Rigid’ or ‘Affine’ or ‘CompositeAffine’ or ‘Similarity’ or ‘Translation’ or ‘BSpline’ or ‘GaussianDisplacementField’ or ‘TimeVaryingVelocityField’ or ‘TimeVaryingBSplineVelocityField’ or ‘SyN’ or ‘BSplineSyN’ or ‘Exponential’ or ‘BSplineExponential’) – Maps to a command-line argument: %s.

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • collapse_output_transforms (a boolean) – Collapse output transforms. Specifically, enabling this option combines all adjacent linear transforms and composes all adjacent displacement field transforms before writing the results to disk. Maps to a command-line argument: --collapse-output-transforms %d. (Nipype default value: True)

  • convergence_threshold (a list of at least 1 items which are a float) – Requires inputs: number_of_iterations. (Nipype default value: [1e-06])

  • convergence_window_size (a list of at least 1 items which are an integer) – Requires inputs: convergence_threshold. (Nipype default value: [10])

  • dimension (3 or 2) – Image dimension (2 or 3). Maps to a command-line argument: --dimensionality %d. (Nipype default value: 3)

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • fixed_image_mask (a pathlike object or string representing an existing file) – Mask used to limit metric sampling region of the fixed imagein all stages. Maps to a command-line argument: %s. Mutually exclusive with inputs: fixed_image_masks.

  • fixed_image_masks (a list of items which are a pathlike object or string representing an existing file or ‘NULL’) – Masks used to limit metric sampling region of the fixed image, defined per registration stage(Use “NULL” to omit a mask at a given stage). Mutually exclusive with inputs: fixed_image_mask.

  • float (a boolean) – Use float instead of double for computations. Maps to a command-line argument: --float %d.

  • initial_moving_transform (a list of items which are a pathlike object or string representing an existing file) – A transform or a list of transforms that should be applied before the registration begins. Note that, when a list is given, the transformations are applied in reverse order. Maps to a command-line argument: %s. Mutually exclusive with inputs: initial_moving_transform_com.

  • initial_moving_transform_com (0 or 1 or 2) – Align the moving_image and fixed_image before registration using the geometric center of the images (=0), the image intensities (=1), or the origin of the images (=2). Maps to a command-line argument: %s. Mutually exclusive with inputs: initial_moving_transform.

  • initialize_transforms_per_stage (a boolean) – Initialize linear transforms from the previous stage. By enabling this option, the current linear stage transform is directly initialized from the previous stages linear transform; this allows multiple linear stages to be run where each stage directly updates the estimated linear transform from the previous stage. (e.g. Translation -> Rigid -> Affine). . Maps to a command-line argument: --initialize-transforms-per-stage %d. (Nipype default value: False)

  • interpolation (‘Linear’ or ‘NearestNeighbor’ or ‘CosineWindowedSinc’ or ‘WelchWindowedSinc’ or ‘HammingWindowedSinc’ or ‘LanczosWindowedSinc’ or ‘BSpline’ or ‘MultiLabel’ or ‘Gaussian’ or ‘GenericLabel’) – Maps to a command-line argument: %s. (Nipype default value: Linear)

  • interpolation_parameters (a tuple of the form: (an integer) or a tuple of the form: (a float, a float) or a tuple of the form: (a string))

  • invert_initial_moving_transform (a list of items which are a boolean) – One boolean or a list of booleans that indicatewhether the inverse(s) of the transform(s) definedin initial_moving_transform should be used. Mutually exclusive with inputs: initial_moving_transform_com. Requires inputs: initial_moving_transform.

  • metric_item_trait (‘CC’ or ‘MeanSquares’ or ‘Demons’ or ‘GC’ or ‘MI’ or ‘Mattes’)

  • metric_stage_trait (‘CC’ or ‘MeanSquares’ or ‘Demons’ or ‘GC’ or ‘MI’ or ‘Mattes’ or a list of items which are ‘CC’ or ‘MeanSquares’ or ‘Demons’ or ‘GC’ or ‘MI’ or ‘Mattes’)

  • metric_weight_item_trait (a float) – (Nipype default value: 1.0)

  • metric_weight_stage_trait (a float or a list of items which are a float)

  • moving_image_mask (a pathlike object or string representing an existing file) – Mask used to limit metric sampling region of the moving imagein all stages. Mutually exclusive with inputs: moving_image_masks. Requires inputs: fixed_image_mask.

  • moving_image_masks (a list of items which are a pathlike object or string representing an existing file or ‘NULL’) – Masks used to limit metric sampling region of the moving image, defined per registration stage(Use “NULL” to omit a mask at a given stage). Mutually exclusive with inputs: moving_image_mask.

  • num_threads (an integer) – Number of ITK threads to use. (Nipype default value: 1)

  • number_of_iterations (a list of items which are a list of items which are an integer)

  • output_inverse_warped_image (a boolean or a pathlike object or string representing a file) – Requires inputs: output_warped_image.

  • output_transform_prefix (a string) – Maps to a command-line argument: %s. (Nipype default value: transform)

  • output_warped_image (a boolean or a pathlike object or string representing a file)

  • radius_bins_item_trait (an integer) – (Nipype default value: 5)

  • radius_bins_stage_trait (an integer or a list of items which are an integer)

  • radius_or_number_of_bins (a list of items which are an integer or a list of items which are an integer) – The number of bins in each stage for the MI and Mattes metric, the radius for other metrics. Requires inputs: metric_weight. (Nipype default value: [5])

  • random_seed (an integer) – Fixed seed for random number generation. Maps to a command-line argument: --random-seed %d.

  • restore_state (a pathlike object or string representing an existing file) – Filename for restoring the internal restorable state of the registration. Maps to a command-line argument: --restore-state %s.

  • restrict_deformation (a list of items which are a list of items which are 0.0 <= a floating point number <= 1.0) – This option allows the user to restrict the optimization of the displacement field, translation, rigid or affine transform on a per-component basis. For example, if one wants to limit the deformation or rotation of 3-D volume to the first two dimensions, this is possible by specifying a weight vector of ‘1x1x0’ for a deformation field or ‘1x1x0x1x1x0’ for a rigid transformation. Low-dimensional restriction only works if there are no preceding transformations.

  • sampling_percentage (a list of items which are 0.0 <= a floating point number <= 1.0 or None or a list of items which are 0.0 <= a floating point number <= 1.0 or None) – The metric sampling percentage(s) to use for each stage. Requires inputs: sampling_strategy.

  • sampling_percentage_item_trait (0.0 <= a floating point number <= 1.0 or None)

  • sampling_percentage_stage_trait (0.0 <= a floating point number <= 1.0 or None or a list of items which are 0.0 <= a floating point number <= 1.0 or None)

  • sampling_strategy (a list of items which are ‘None’ or ‘Regular’ or ‘Random’ or None or a list of items which are ‘None’ or ‘Regular’ or ‘Random’ or None) – The metric sampling strategy (strategies) for each stage. Requires inputs: metric_weight.

  • sampling_strategy_item_trait (‘None’ or ‘Regular’ or ‘Random’ or None)

  • sampling_strategy_stage_trait (‘None’ or ‘Regular’ or ‘Random’ or None or a list of items which are ‘None’ or ‘Regular’ or ‘Random’ or None)

  • save_state (a pathlike object or string representing a file) – Filename for saving the internal restorable state of the registration. Maps to a command-line argument: --save-state %s.

  • sigma_units (a list of items which are ‘mm’ or ‘vox’) – Units for smoothing sigmas. Requires inputs: smoothing_sigmas.

  • transform_parameters (a list of items which are a tuple of the form: (a float) or a tuple of the form: (a float, a float, a float) or a tuple of the form: (a float, an integer, an integer, an integer) or a tuple of the form: (a float, an integer, a float, a float, a float, a float) or a tuple of the form: (a float, a float, a float, an integer) or a tuple of the form: (a float, an integer, an integer, an integer, an integer))

  • use_estimate_learning_rate_once (a list of items which are a boolean)

  • use_histogram_matching (a boolean or a list of items which are a boolean) – Histogram match the images before registration. (Nipype default value: True)

  • verbose (a boolean) – Maps to a command-line argument: -v. (Nipype default value: False)

  • winsorize_lower_quantile (0.0 <= a floating point number <= 1.0) – The Lower quantile to clip image ranges. Maps to a command-line argument: %s. (Nipype default value: 0.0)

  • winsorize_upper_quantile (0.0 <= a floating point number <= 1.0) – The Upper quantile to clip image ranges. Maps to a command-line argument: %s. (Nipype default value: 1.0)

  • write_composite_transform (a boolean) – Maps to a command-line argument: --write-composite-transform %d. (Nipype default value: False)

Outputs:
  • composite_transform (a pathlike object or string representing an existing file) – Composite transform file.

  • elapsed_time (a float) – The total elapsed time as reported by ANTs.

  • forward_invert_flags (a list of items which are a boolean) – List of flags corresponding to the forward transforms.

  • forward_transforms (a list of items which are a pathlike object or string representing an existing file) – List of output transforms for forward registration.

  • inverse_composite_transform (a pathlike object or string representing a file) – Inverse composite transform file.

  • inverse_warped_image (a pathlike object or string representing a file) – Outputs the inverse of the warped image.

  • metric_value (a float) – The final value of metric.

  • reverse_forward_invert_flags (a list of items which are a boolean) – List of flags corresponding to the forward transforms reversed for antsApplyTransform.

  • reverse_forward_transforms (a list of items which are a pathlike object or string representing an existing file) – List of output transforms for forward registration reversed for antsApplyTransform.

  • reverse_invert_flags (a list of items which are a boolean) – List of flags corresponding to the reverse transforms.

  • reverse_transforms (a list of items which are a pathlike object or string representing an existing file) – List of output transforms for reverse registration.

  • save_state (a pathlike object or string representing a file) – The saved registration state to be restored.

  • warped_image (a pathlike object or string representing a file) – Outputs warped image.

class niworkflows.interfaces.fixes.FixN4BiasFieldCorrection(*args, **kwargs)[source]

Bases: N4BiasFieldCorrection

Wrapped executable: N4BiasFieldCorrection.

Checks and fixes for nonpositive values in the input to N4BiasFieldCorrection.

Mandatory Inputs:
  • copy_header (a boolean) – Copy headers of the original image into the output (corrected) file. (Nipype default value: False)

  • input_image (a pathlike object or string representing a file) – Input for bias correction. Negative values or values close to zero should be processed prior to correction. Maps to a command-line argument: --input-image %s.

  • save_bias (a boolean) – True if the estimated bias should be saved to file. Mutually exclusive with inputs: bias_image. (Nipype default value: False)

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • bias_image (a pathlike object or string representing a file) – Filename for the estimated bias.

  • bspline_fitting_distance (a float) – Maps to a command-line argument: --bspline-fitting %s.

  • bspline_order (an integer) – Requires inputs: bspline_fitting_distance.

  • convergence_threshold (a float) – Requires inputs: n_iterations.

  • dimension (3 or 2 or 4) – Image dimension (2, 3 or 4). Maps to a command-line argument: -d %d. (Nipype default value: 3)

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • histogram_sharpening (a tuple of the form: (a float, a float, an integer)) – Three-values tuple of histogram sharpening parameters (FWHM, wienerNose, numberOfHistogramBins). These options describe the histogram sharpening parameters, i.e. the deconvolution step parameters described in the original N3 algorithm. The default values have been shown to work fairly well. Maps to a command-line argument: --histogram-sharpening [%g,%g,%d].

  • mask_image (a pathlike object or string representing a file) – Image to specify region to perform final bias correction in. Maps to a command-line argument: --mask-image %s.

  • n_iterations (a list of items which are an integer) – Maps to a command-line argument: --convergence %s.

  • num_threads (an integer) – Number of ITK threads to use. (Nipype default value: 1)

  • output_image (a string) – Output file name. Maps to a command-line argument: --output %s.

  • rescale_intensities (a boolean) – [NOTE: Only ANTs>=2.1.0] At each iteration, a new intensity mapping is calculated and applied but there is nothing which constrains the new intensity range to be within certain values. The result is that the range can “drift” from the original at each iteration. This option rescales to the [min,max] range of the original image intensities within the user-specified mask. Maps to a command-line argument: -r. (Nipype default value: False)

  • shrink_factor (an integer) – Maps to a command-line argument: --shrink-factor %d.

  • weight_image (a pathlike object or string representing a file) – Image for relative weighting (e.g. probability map of the white matter) of voxels during the B-spline fitting. . Maps to a command-line argument: --weight-image %s.

Outputs:
  • bias_image (a pathlike object or string representing an existing file) – Estimated bias.

  • negative_values (a boolean) – Indicates whether the input was corrected for nonpositive values by adding a constant offset. (Nipype default value: False)

  • output_image (a pathlike object or string representing an existing file) – Warped image.