nipype.interfaces.c3 module

Convert3D is a command-line tool for converting 3D images between common file formats.

C3d

Link to code

Bases: CommandLine

Wrapped executable: c3d.

Convert3d is a command-line tool for converting 3D (or 4D) images between common file formats. The tool also includes a growing list of commands for image manipulation, such as thresholding and resampling. The tool can also be used to obtain information about image files. More information on Convert3d can be found at: https://sourceforge.net/p/c3d/git/ci/master/tree/doc/c3d.md

Example

>>> from nipype.interfaces.c3 import C3d
>>> c3 = C3d()
>>> c3.inputs.in_file = "T1.nii"
>>> c3.inputs.pix_type = "short"
>>> c3.inputs.out_file = "T1.img"
>>> c3.cmdline
'c3d T1.nii -type short -o T1.img'
>>> c3.inputs.is_4d = True
>>> c3.inputs.in_file = "epi.nii"
>>> c3.inputs.out_file = "epi.img"
>>> c3.cmdline
'c4d epi.nii -type short -o epi.img'
Mandatory Inputs:

in_file (a list of items which are a pathlike object or string representing a file) – Input file (wildcard and multiple are supported). Maps to a command-line argument: %s (position: 1).

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

  • interp (‘Linear’ or ‘NearestNeighbor’ or ‘Cubic’ or ‘Sinc’ or ‘Gaussian’) – Specifies the interpolation used with -resample and other commands. Default is Linear. Maps to a command-line argument: -interpolation %s.

  • is_4d (a boolean) – Changes command to support 4D file operations (default is false). (Nipype default value: False)

  • multicomp_split (a boolean) – Enable reading of multi-component images. Maps to a command-line argument: -mcr (position: 0). (Nipype default value: False)

  • out_file (a pathlike object or string representing a file) – Output file of last image on the stack. Maps to a command-line argument: -o %s (position: -1). Mutually exclusive with inputs: out_files.

  • out_files (a list of items which are a pathlike object or string representing a file) – Write all images on the convert3d stack as multiple files. Supports both list of output files or a pattern for the output filenames (using %d substitution). Maps to a command-line argument: -oo %s (position: -1). Mutually exclusive with inputs: out_file.

  • pix_type (‘float’ or ‘char’ or ‘uchar’ or ‘short’ or ‘ushort’ or ‘int’ or ‘uint’ or ‘double’) – Specifies the pixel type for the output image. By default, images are written in floating point (float) format. Maps to a command-line argument: -type %s.

  • resample (a string) – Resamples the image, keeping the bounding box the same, but changing the number of voxels in the image. The dimensions can be specified as a percentage, for example to double the number of voxels in each direction. The -interpolation flag affects how sampling is performed. Maps to a command-line argument: -resample %s.

  • scale (an integer or a float) – Multiplies the intensity of each voxel in the last image on the stack by the given factor. Maps to a command-line argument: -scale %s.

  • shift (an integer or a float) – Adds the given constant to every voxel. Maps to a command-line argument: -shift %s.

  • smooth (a string) – Applies Gaussian smoothing to the image. The parameter vector specifies the standard deviation of the Gaussian kernel. Maps to a command-line argument: -smooth %s.

Outputs:

out_files (a list of items which are a pathlike object or string representing a file)

C3dAffineTool

Link to code

Bases: SEMLikeCommandLine

Wrapped executable: c3d_affine_tool.

Converts fsl-style Affine registration into ANTS compatible itk format

Example

>>> from nipype.interfaces.c3 import C3dAffineTool
>>> c3 = C3dAffineTool()
>>> c3.inputs.source_file = 'cmatrix.mat'
>>> c3.inputs.itk_transform = 'affine.txt'
>>> c3.inputs.fsl2ras = True
>>> c3.cmdline
'c3d_affine_tool -src cmatrix.mat -fsl2ras -oitk affine.txt'
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: {})

  • fsl2ras (a boolean) – Maps to a command-line argument: -fsl2ras (position: 4).

  • itk_transform (a boolean or a pathlike object or string representing a file) – Export ITK transform. Maps to a command-line argument: -oitk %s (position: 5).

  • reference_file (a pathlike object or string representing an existing file) – Maps to a command-line argument: -ref %s (position: 1).

  • source_file (a pathlike object or string representing an existing file) – Maps to a command-line argument: -src %s (position: 2).

  • transform_file (a pathlike object or string representing an existing file) – Maps to a command-line argument: %s (position: 3).

Outputs:

itk_transform (a pathlike object or string representing an existing file)