xcp_d.interfaces.c3.C3d

class xcp_d.interfaces.c3.C3d(**inputs)[source]

Wrapped executable: c3d.

A wrapper for the c3d command.

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

Examples

>>> 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 an existing 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: -mcs (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 substituion). 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 an existing file)

__init__(**inputs)[source]

Subclasses must implement __init__

Methods

__init__(**inputs)

Subclasses must implement __init__

aggregate_outputs([runtime, needed_outputs])

Collate expected outputs and apply output traits validation.

help([returnhelp])

Prints class help

load_inputs_from_json(json_file[, overwrite])

A convenient way to load pre-set inputs from a JSON file.

raise_exception(runtime)

run([cwd, ignore_exception])

Execute this interface.

save_inputs_to_json(json_file)

A convenient way to save current inputs to a JSON file.

set_default_terminal_output(output_type)

Set the default terminal output for CommandLine Interfaces.

version_from_command([flag, cmd])

Attributes

always_run

Should the interface be always run even if the inputs were not changed? Only applies to interfaces being run within a workflow context.

can_resume

Defines if the interface can reuse partial results after interruption.

cmd

sets base command, immutable

cmdline

command plus any arguments (args) validates arguments and generates command line

resource_monitor

terminal_output

version

interfaces should implement a version property

write_cmdline