nipype.interfaces.niftyreg.reg module

The reg module provides classes for interfacing with the niftyreg registration command line tools.

The interfaces were written to work with niftyreg version 1.5.10

class nipype.interfaces.niftyreg.reg.RegAladin(required_version=None, **inputs)

Bases: NiftyRegCommand

Wrapped executable: reg_aladin.

Interface for executable reg_aladin from NiftyReg platform.

Block Matching algorithm for symmetric global registration. Based on Modat et al., “Global image registration using asymmetric block-matching approach” J. Med. Img. 1(2) 024003, 2014, doi: 10.1117/1.JMI.1.2.024003

Source code

Examples

>>> from nipype.interfaces import niftyreg
>>> node = niftyreg.RegAladin()
>>> node.inputs.ref_file = 'im1.nii'
>>> node.inputs.flo_file = 'im2.nii'
>>> node.inputs.rmask_file = 'mask.nii'
>>> node.inputs.omp_core_val = 4
>>> node.cmdline
'reg_aladin -aff im2_aff.txt -flo im2.nii -omp 4 -ref im1.nii -res im2_res.nii.gz -rmask mask.nii'
Mandatory Inputs:
  • flo_file (a pathlike object or string representing an existing file) – The input floating/source image. Maps to a command-line argument: -flo %s.

  • ref_file (a pathlike object or string representing an existing file) – The input reference/target image. Maps to a command-line argument: -ref %s.

Optional Inputs:
  • aff_direct_flag (a boolean) – Directly optimise the affine parameters. Maps to a command-line argument: -affDirect.

  • aff_file (a pathlike object or string representing a file) – The output affine matrix file. Maps to a command-line argument: -aff %s.

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

  • cog_flag (a boolean) – Use the masks centre of mass to initialise the transformation. Maps to a command-line argument: -cog.

  • 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: {})

  • flo_low_val (a float) – Lower threshold value on floating image. Maps to a command-line argument: -floLowThr %f.

  • flo_up_val (a float) – Upper threshold value on floating image. Maps to a command-line argument: -floUpThr %f.

  • fmask_file (a pathlike object or string representing an existing file) – The input floating mask. Maps to a command-line argument: -fmask %s.

  • gpuid_val (an integer) – Device to use id. Maps to a command-line argument: -gpuid %i.

  • i_val (an integer >= 0) – Percent of inlier blocks. Maps to a command-line argument: -pi %d.

  • in_aff_file (a pathlike object or string representing an existing file) – The input affine transformation. Maps to a command-line argument: -inaff %s.

  • ln_val (an integer >= 0) – Number of resolution levels to create. Maps to a command-line argument: -ln %d.

  • lp_val (an integer >= 0) – Number of resolution levels to perform. Maps to a command-line argument: -lp %d.

  • maxit_val (an integer >= 0) – Maximum number of iterations. Maps to a command-line argument: -maxit %d.

  • nac_flag (a boolean) – Use nifti header to initialise transformation. Maps to a command-line argument: -nac.

  • nosym_flag (a boolean) – Turn off symmetric registration. Maps to a command-line argument: -noSym.

  • omp_core_val (an integer) – Number of openmp thread to use. Maps to a command-line argument: -omp %i. (Nipype default value: 1)

  • platform_val (an integer) – Platform index. Maps to a command-line argument: -platf %i.

  • ref_low_val (a float) – Lower threshold value on reference image. Maps to a command-line argument: -refLowThr %f.

  • ref_up_val (a float) – Upper threshold value on reference image. Maps to a command-line argument: -refUpThr %f.

  • res_file (a pathlike object or string representing a file) – The affine transformed floating image. Maps to a command-line argument: -res %s.

  • rig_only_flag (a boolean) – Do only a rigid registration. Maps to a command-line argument: -rigOnly.

  • rmask_file (a pathlike object or string representing an existing file) – The input reference mask. Maps to a command-line argument: -rmask %s.

  • smoo_f_val (a float) – Amount of smoothing to apply to floating image. Maps to a command-line argument: -smooF %f.

  • smoo_r_val (a float) – Amount of smoothing to apply to reference image. Maps to a command-line argument: -smooR %f.

  • v_val (an integer >= 0) – Percent of blocks that are active. Maps to a command-line argument: -pv %d.

  • verbosity_off_flag (a boolean) – Turn off verbose output. Maps to a command-line argument: -voff.

Outputs:
  • aff_file (a pathlike object or string representing a file) – The output affine file.

  • avg_output (a string) – Output string in the format for reg_average.

  • res_file (a pathlike object or string representing a file) – The output transformed image.

class nipype.interfaces.niftyreg.reg.RegF3D(required_version=None, **inputs)

Bases: NiftyRegCommand

Wrapped executable: reg_f3d.

Interface for executable reg_f3d from NiftyReg platform.

Fast Free-Form Deformation (F3D) algorithm for non-rigid registration. Initially based on Modat et al., “Fast Free-Form Deformation using graphics processing units”, CMPB, 2010

Source code

Examples

>>> from nipype.interfaces import niftyreg
>>> node = niftyreg.RegF3D()
>>> node.inputs.ref_file = 'im1.nii'
>>> node.inputs.flo_file = 'im2.nii'
>>> node.inputs.rmask_file = 'mask.nii'
>>> node.inputs.omp_core_val = 4
>>> node.cmdline
'reg_f3d -cpp im2_cpp.nii.gz -flo im2.nii -omp 4 -ref im1.nii -res im2_res.nii.gz -rmask mask.nii'
Mandatory Inputs:
  • flo_file (a pathlike object or string representing an existing file) – The input floating/source image. Maps to a command-line argument: -flo %s.

  • ref_file (a pathlike object or string representing an existing file) – The input reference/target image. Maps to a command-line argument: -ref %s.

Optional Inputs:
  • aff_file (a pathlike object or string representing an existing file) – The input affine transformation file. Maps to a command-line argument: -aff %s.

  • amc_flag (a boolean) – Use additive NMI. Maps to a command-line argument: -amc.

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

  • be_val (a float) – Bending energy value. Maps to a command-line argument: -be %f.

  • cpp_file (a pathlike object or string representing a file) – The output CPP file. Maps to a command-line argument: -cpp %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: {})

  • fbn2_val (a tuple of the form: (an integer >= 0, an integer >= 0)) – Number of bins in the histogram for reference image for given time point. Maps to a command-line argument: -fbn %d %d.

  • fbn_val (an integer >= 0) – Number of bins in the histogram for reference image. Maps to a command-line argument: --fbn %d.

  • flo_smooth_val (a float) – Smoothing kernel width for floating image. Maps to a command-line argument: -smooF %f.

  • flwth2_thr_val (a tuple of the form: (an integer >= 0, a float)) – Lower threshold for floating image at the specified time point. Maps to a command-line argument: -fLwTh %d %f.

  • flwth_thr_val (a float) – Lower threshold for floating image. Maps to a command-line argument: --fLwTh %f.

  • fmask_file (a pathlike object or string representing an existing file) – Floating image mask. Maps to a command-line argument: -fmask %s.

  • fupth2_thr_val (a tuple of the form: (an integer >= 0, a float)) – Upper threshold for floating image at the specified time point. Maps to a command-line argument: -fUpTh %d %f.

  • fupth_thr_val (a float) – Upper threshold for floating image. Maps to a command-line argument: --fUpTh %f.

  • incpp_file (a pathlike object or string representing an existing file) – The input cpp transformation file. Maps to a command-line argument: -incpp %s.

  • jl_val (a float) – Log of jacobian of deformation penalty value. Maps to a command-line argument: -jl %f.

  • kld2_flag (an integer >= 0) – Use KL divergence as the similarity measure for a given time point. Maps to a command-line argument: -kld %d.

  • kld_flag (a boolean) – Use KL divergence as the similarity measure. Maps to a command-line argument: --kld.

  • le_val (a float) – Linear elasticity penalty term. Maps to a command-line argument: -le %f.

  • ln_val (an integer >= 0) – Number of resolution levels to create. Maps to a command-line argument: -ln %d.

  • lncc2_val (a tuple of the form: (an integer >= 0, a float)) – SD of the Gaussian for computing LNCC for a given time point. Maps to a command-line argument: -lncc %d %f.

  • lncc_val (a float) – SD of the Gaussian for computing LNCC. Maps to a command-line argument: --lncc %f.

  • lp_val (an integer >= 0) – Number of resolution levels to perform. Maps to a command-line argument: -lp %d.

  • maxit_val (an integer >= 0) – Maximum number of iterations per level. Maps to a command-line argument: -maxit %d.

  • nmi_flag (a boolean) – Use NMI even when other options are specified. Maps to a command-line argument: --nmi.

  • no_app_jl_flag (a boolean) – Do not approximate the log of jacobian penalty at control points only. Maps to a command-line argument: -noAppJL.

  • noconj_flag (a boolean) – Use simple GD optimization. Maps to a command-line argument: -noConj.

  • nopy_flag (a boolean) – Do not use the multiresolution approach. Maps to a command-line argument: -nopy.

  • nox_flag (a boolean) – Don’t optimise in x direction. Maps to a command-line argument: -nox.

  • noy_flag (a boolean) – Don’t optimise in y direction. Maps to a command-line argument: -noy.

  • noz_flag (a boolean) – Don’t optimise in z direction. Maps to a command-line argument: -noz.

  • omp_core_val (an integer) – Number of openmp thread to use. Maps to a command-line argument: -omp %i. (Nipype default value: 1)

  • pad_val (a float) – Padding value. Maps to a command-line argument: -pad %f.

  • pert_val (an integer >= 0) – Add perturbation steps after each optimization step. Maps to a command-line argument: -pert %d.

  • rbn2_val (a tuple of the form: (an integer >= 0, an integer >= 0)) – Number of bins in the histogram for reference image for given time point. Maps to a command-line argument: -rbn %d %d.

  • rbn_val (an integer >= 0) – Number of bins in the histogram for reference image. Maps to a command-line argument: --rbn %d.

  • ref_smooth_val (a float) – Smoothing kernel width for reference image. Maps to a command-line argument: -smooR %f.

  • res_file (a pathlike object or string representing a file) – The output resampled image. Maps to a command-line argument: -res %s.

  • rlwth2_thr_val (a tuple of the form: (an integer >= 0, a float)) – Lower threshold for reference image at the specified time point. Maps to a command-line argument: -rLwTh %d %f.

  • rlwth_thr_val (a float) – Lower threshold for reference image. Maps to a command-line argument: --rLwTh %f.

  • rmask_file (a pathlike object or string representing an existing file) – Reference image mask. Maps to a command-line argument: -rmask %s.

  • rupth2_thr_val (a tuple of the form: (an integer >= 0, a float)) – Upper threshold for reference image at the specified time point. Maps to a command-line argument: -rUpTh %d %f.

  • rupth_thr_val (a float) – Upper threshold for reference image. Maps to a command-line argument: --rUpTh %f.

  • smooth_grad_val (a float) – Kernel width for smoothing the metric gradient. Maps to a command-line argument: -smoothGrad %f.

  • ssd2_flag (an integer >= 0) – Use SSD as the similarity measure for a given time point. Maps to a command-line argument: -ssd %d.

  • ssd_flag (a boolean) – Use SSD as the similarity measure. Maps to a command-line argument: --ssd.

  • sx_val (a float) – Final grid spacing along the x axes. Maps to a command-line argument: -sx %f.

  • sy_val (a float) – Final grid spacing along the y axes. Maps to a command-line argument: -sy %f.

  • sz_val (a float) – Final grid spacing along the z axes. Maps to a command-line argument: -sz %f.

  • vel_flag (a boolean) – Use velocity field integration. Maps to a command-line argument: -vel.

  • verbosity_off_flag (a boolean) – Turn off verbose output. Maps to a command-line argument: -voff.

Outputs:
  • avg_output (a string) – Output string in the format for reg_average.

  • cpp_file (a pathlike object or string representing a file) – The output CPP file.

  • invcpp_file (a pathlike object or string representing a file) – The output inverse CPP file.

  • invres_file (a pathlike object or string representing a file) – The output inverse res file.

  • res_file (a pathlike object or string representing a file) – The output resampled image.