qsiprep.interfaces.niworkflows module
Image tools interfaces
- class qsiprep.interfaces.niworkflows.ANTSRegistrationRPT(generate_report=False, **kwargs)[source]
Bases:
RegistrationRC,RegistrationWrapped executable:
antsRegistration.- 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)compress_report (‘auto’ or True or False) – Compress the reportlet using SVGO orWEBP. ‘auto’ - compress if relevant software is installed, True = force,False - don’t attempt to compress. (Nipype default value:
auto)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)
out_report (a pathlike object or string representing a file) – Filename for the visual report. (Nipype default value:
report.svg)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.
out_report (a pathlike object or string representing a file) – Filename for the visual report.
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 qsiprep.interfaces.niworkflows.FUGUEvsm2ANTSwarp(from_file=None, resource_monitor=None, **inputs)[source]
Bases:
SimpleInterfaceConvert a voxel-shift-map to ants warp.
- Mandatory Inputs:
in_file (a pathlike object or string representing an existing file) – Input displacements field map.
- Optional Inputs:
pe_dir (‘i’ or ‘i-’ or ‘j’ or ‘j-’ or ‘k’ or ‘k-’) – Phase-encoding axis.
- Outputs:
out_file (a pathlike object or string representing a file) – The output warp field.
- class qsiprep.interfaces.niworkflows.RobustMNINormalizationRPT(generate_report=False, **kwargs)[source]
Bases:
RegistrationRC,SpatialNormalization- Mandatory Inputs:
moving (‘T1w’ or ‘boldref’) – Registration type. (Nipype default value:
T1w)moving_image (a pathlike object or string representing an existing file) – Image to apply transformation to.
orientation (‘LPS’) – Modify template orientation (should match input image). (Nipype default value:
LPS)reference (‘T1w’ or ‘T2w’ or ‘boldref’ or ‘PDw’) – Set the reference modality for registration. (Nipype default value:
T1w)
- Optional Inputs:
compress_report (‘auto’ or True or False) – Compress the reportlet using SVGO orWEBP. ‘auto’ - compress if relevant software is installed, True = force,False - don’t attempt to compress. (Nipype default value:
auto)explicit_masking (a boolean) – 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. (Nipype default value:
True)flavor (‘precise’ or ‘testing’ or ‘fast’) – Registration settings parameter set. (Nipype default value:
precise)float (a boolean) – Use single precision calculations. (Nipype default value:
False)initial_moving_transform (a pathlike object or string representing an existing file) – Transform for initialization.
lesion_mask (a pathlike object or string representing an existing file) – Lesion mask image.
moving_mask (a pathlike object or string representing an existing file) – Moving image mask.
num_threads (an integer) – Number of ITK threads to use. (Nipype default value:
2)out_report (a pathlike object or string representing a file) – Filename for the visual report. (Nipype default value:
report.svg)reference_image (a pathlike object or string representing an existing file) – Override the reference image.
reference_mask (a pathlike object or string representing an existing file) – Reference image mask.
settings (a list of items which are a pathlike object or string representing an existing file) – Pass on the list of settings files.
template (a string) – Define the template to be used. (Nipype default value:
MNI152NLin2009cAsym)template_resolution (1 or 2 or None) – (DEPRECATED) template resolution.
template_spec (a dictionary with keys which are a value of class ‘str’ and with values which are any value) – Template specifications.
- 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.
out_report (a pathlike object or string representing a file) – Filename for the visual report.
reference_image (a string or os.PathLike object) – The output reference image.
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.
- qsiprep.interfaces.niworkflows.confoundplot(tseries, gs_ts, gs_dist=None, name=None, units=None, tr=None, hide_x=True, color='b', nskip=0, cutoff=None, ylims=None)[source]
- class qsiprep.interfaces.niworkflows.dMRIPlot(sliceqc_file, mask_file, confounds, usecols=None, units=None, vlines=None, spikes_files=None, min_slice_size_percentile=10.0)[source]
Bases:
objectGenerates the dMRI Summary Plot
- qsiprep.interfaces.niworkflows.plot_sliceqc(slice_data, nperslice, size=(950, 800), subplot=None, title=None, output_file=None, lut=None, tr=None)[source]
Plot an image representation of voxel intensities across time also know as the “carpet plot” or “Power plot”. See Jonathan Power Neuroimage 2017 Jul 1; 154:150-158.
- Parameters:
slice_data (2d array) – errors in each slice for each volume
nperslice (1d array) – number of voxels included in each slice
axes (matplotlib axes, optional) – The axes used to display the plot. If None, the complete figure is used.
title (string, optional) – The title displayed on the figure.
output_file (string, or None, optional) – The name of an image file to export the plot to. Valid extensions are .png, .pdf, .svg. If output_file is not None, the plot is saved to a file, and the display is closed.
tr (float , optional) – Specify the TR, if specified it uses this value. If left as None, # Frames is plotted instead of time.