nipype.interfaces.elastix.registration module¶
Interfaces to perform image registrations and to apply the resulting displacement maps to images and points.
AnalyzeWarp¶
Bases: ApplyWarp
Wrapped executable:
transformix
.Use transformix to get details from the input transform (generate the corresponding deformation field, generate the determinant of the Jacobian map or the Jacobian map itself)
Example
>>> from nipype.interfaces.elastix import AnalyzeWarp >>> reg = AnalyzeWarp() >>> reg.inputs.transform_file = 'TransformParameters.0.txt' >>> reg.cmdline 'transformix -def all -jac all -jacmat all -threads 1 -out ./ -tp TransformParameters.0.txt'
- Mandatory Inputs:
output_path (a pathlike object or string representing an existing directory) – Output directory. Maps to a command-line argument:
-out %s
. (Nipype default value:./
)transform_file (a pathlike object or string representing an existing file) – Transform-parameter file, only 1. Maps to a command-line argument:
-tp %s
.- Optional Inputs:
args (a string) – Additional parameters to the command. Maps to a command-line argument:
%s
.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:
{}
)jac (‘all’) – Generate an image with the determinant of the spatial Jacobian. Maps to a command-line argument:
-jac %s
. (Nipype default value:all
)jacmat (‘all’) – Generate an image with the spatial Jacobian matrix at each voxel. Maps to a command-line argument:
-jacmat %s
. (Nipype default value:all
)moving_image (a pathlike object or string representing an existing file) – Input image to deform (not used). Maps to a command-line argument:
-in %s
.num_threads (an integer) – Set the maximum number of threads of elastix. Maps to a command-line argument:
-threads %01d
. (Nipype default value:1
)points (‘all’) – Transform all points from the input-image, which effectively generates a deformation field. Maps to a command-line argument:
-def %s
(position: 0). (Nipype default value:all
)- Outputs:
disp_field (a pathlike object or string representing a file) – Displacements field.
jacdet_map (a pathlike object or string representing a file) – Det(Jacobian) map.
jacmat_map (a pathlike object or string representing a file) – Jacobian matrix map.
ApplyWarp¶
Bases: CommandLine
Wrapped executable:
transformix
.Use
transformix
to apply a transform on an input image. The transform is specified in the transform-parameter file.Example
>>> from nipype.interfaces.elastix import ApplyWarp >>> reg = ApplyWarp() >>> reg.inputs.moving_image = 'moving1.nii' >>> reg.inputs.transform_file = 'TransformParameters.0.txt' >>> reg.cmdline 'transformix -in moving1.nii -threads 1 -out ./ -tp TransformParameters.0.txt'
- Mandatory Inputs:
moving_image (a pathlike object or string representing an existing file) – Input image to deform. Maps to a command-line argument:
-in %s
.output_path (a pathlike object or string representing an existing directory) – Output directory. Maps to a command-line argument:
-out %s
. (Nipype default value:./
)transform_file (a pathlike object or string representing an existing file) – Transform-parameter file, only 1. Maps to a command-line argument:
-tp %s
.- Optional Inputs:
args (a string) – Additional parameters to the command. Maps to a command-line argument:
%s
.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:
{}
)num_threads (an integer) – Set the maximum number of threads of elastix. Maps to a command-line argument:
-threads %01d
. (Nipype default value:1
)- Outputs:
warped_file (a pathlike object or string representing a file) – Input moving image warped to fixed image.
PointsWarp¶
Bases: CommandLine
Wrapped executable:
transformix
.Use
transformix
to apply a transform on an input point set. The transform is specified in the transform-parameter file.Example
>>> from nipype.interfaces.elastix import PointsWarp >>> reg = PointsWarp() >>> reg.inputs.points_file = 'surf1.vtk' >>> reg.inputs.transform_file = 'TransformParameters.0.txt' >>> reg.cmdline 'transformix -threads 1 -out ./ -def surf1.vtk -tp TransformParameters.0.txt'
- Mandatory Inputs:
output_path (a pathlike object or string representing an existing directory) – Output directory. Maps to a command-line argument:
-out %s
. (Nipype default value:./
)points_file (a pathlike object or string representing an existing file) – Input points (accepts .vtk triangular meshes). Maps to a command-line argument:
-def %s
.transform_file (a pathlike object or string representing an existing file) – Transform-parameter file, only 1. Maps to a command-line argument:
-tp %s
.- Optional Inputs:
args (a string) – Additional parameters to the command. Maps to a command-line argument:
%s
.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:
{}
)num_threads (an integer) – Set the maximum number of threads of elastix. Maps to a command-line argument:
-threads %01d
. (Nipype default value:1
)- Outputs:
warped_file (a pathlike object or string representing a file) – Input points displaced in fixed image domain.
Registration¶
Bases: CommandLine
Wrapped executable:
elastix
.Elastix nonlinear registration interface
Example
>>> from nipype.interfaces.elastix import Registration >>> reg = Registration() >>> reg.inputs.fixed_image = 'fixed1.nii' >>> reg.inputs.moving_image = 'moving1.nii' >>> reg.inputs.parameters = ['elastix.txt'] >>> reg.cmdline 'elastix -f fixed1.nii -m moving1.nii -threads 1 -out ./ -p elastix.txt'
- Mandatory Inputs:
fixed_image (a pathlike object or string representing an existing file) – Fixed image. Maps to a command-line argument:
-f %s
.moving_image (a pathlike object or string representing an existing file) – Moving image. Maps to a command-line argument:
-m %s
.output_path (a pathlike object or string representing an existing directory) – Output directory. Maps to a command-line argument:
-out %s
. (Nipype default value:./
)parameters (a list of items which are a pathlike object or string representing an existing file) – Parameter file, elastix handles 1 or more -p. Maps to a command-line argument:
-p %s...
.- Optional Inputs:
args (a string) – Additional parameters to the command. Maps to a command-line argument:
%s
.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_mask (a pathlike object or string representing an existing file) – Mask for fixed image. Maps to a command-line argument:
-fMask %s
.initial_transform (a pathlike object or string representing an existing file) – Parameter file for initial transform. Maps to a command-line argument:
-t0 %s
.moving_mask (a pathlike object or string representing an existing file) – Mask for moving image. Maps to a command-line argument:
-mMask %s
.num_threads (an integer) – Set the maximum number of threads of elastix. Maps to a command-line argument:
-threads %01d
. (Nipype default value:1
)- Outputs:
transform (a list of items which are a pathlike object or string representing an existing file) – Output transform.
warped_file (a pathlike object or string representing a file) – Input moving image warped to fixed image.
warped_files (a list of items which are a pathlike object or string representing a file) – Input moving image warped to fixed image at each level.
warped_files_flags (a list of items which are a boolean) – Flag indicating if warped image was generated.