nipype.interfaces.camino.convert module¶
AnalyzeHeader¶
Bases: StdOutCommandLine
Wrapped executable:
analyzeheader
.Create or read an Analyze 7.5 header file.
Analyze image header, provides support for the most common header fields. Some fields, such as patient_id, are not currently supported. The program allows three nonstandard options: the field image_dimension.funused1 is the image scale. The intensity of each pixel in the associated .img file is (image value from file) * scale. Also, the origin of the Talairach coordinates (midline of the anterior commisure) are encoded in the field data_history.originator. These changes are included for compatibility with SPM.
All headers written with this program are big endian by default.
Example
>>> import nipype.interfaces.camino as cmon >>> hdr = cmon.AnalyzeHeader() >>> hdr.inputs.in_file = 'tensor_fitted_data.Bdouble' >>> hdr.inputs.scheme_file = 'A.scheme' >>> hdr.inputs.data_dims = [256,256,256] >>> hdr.inputs.voxel_dims = [1,1,1] >>> hdr.run()
- datatype‘byte’ or ‘char’ or ‘[u]short’ or ‘[u]int’ or ‘float’ or ‘complex’ or ‘double’
The char datatype is 8 bit (not the 16 bit char of Java), as specified by the Analyze 7.5 standard. The byte, ushort and uint types are not part of the Analyze specification but are supported by SPM. Maps to a command-line argument:
-datatype %s
.- in_filea pathlike object or string representing an existing file
Tensor-fitted data filename. Maps to a command-line argument:
< %s
(position: 1).
- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- centrea list of from 3 to 3 items which are an integer (int or long)
Voxel specifying origin of Talairach coordinate system for SPM, default [0 0 0]. Maps to a command-line argument:
-centre %s
.- data_dimsa list of from 3 to 3 items which are an integer (int or long)
Data dimensions in voxels. Maps to a command-line argument:
-datadims %s
.- descriptiona string
Short description - No spaces, max length 79 bytes. Will be null terminated automatically. Maps to a command-line argument:
-description %s
.- environa 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:
{}
)- greylevelsa list of from 2 to 2 items which are an integer (int or long)
Minimum and maximum greylevels. Stored as shorts in the header. Maps to a command-line argument:
-gl %s
.- initfromheadera pathlike object or string representing an existing file
Reads header information from file and intializes a new header with the values read from the file. You may replace any combination of fields in the new header by specifying subsequent options. Maps to a command-line argument:
-initfromheader %s
(position: 3).- intelbyteordera boolean
Write header in intel byte order (little-endian). Maps to a command-line argument:
-intelbyteorder
.- networkbyteordera boolean
Write header in network byte order (big-endian). This is the default for new headers. Maps to a command-line argument:
-networkbyteorder
.- nimagesan integer (int or long)
Number of images in the img file. Default 1. Maps to a command-line argument:
-nimages %d
.- offsetan integer (int or long)
According to the Analyze 7.5 standard, this is the byte offset in the .img file at which voxels start. This value can be negative to specify that the absolute value is applied for every image in the file. Maps to a command-line argument:
-offset %d
.- out_filea pathlike object or string representing a file
Maps to a command-line argument:
> %s
(position: -1).- picoseeda list of from 3 to 3 items which are an integer (int or long)
Voxel specifying the seed (for PICo maps), default [0 0 0]. Maps to a command-line argument:
-picoseed %s
.- printbigendiana pathlike object or string representing an existing file
Prints 1 if the header is big-endian, 0 otherwise. Maps to a command-line argument:
-printbigendian %s
(position: 3).- printimagedimsa pathlike object or string representing an existing file
Prints image data and voxel dimensions as Camino arguments and exits. Maps to a command-line argument:
-printimagedims %s
(position: 3).- printintelbyteordera pathlike object or string representing an existing file
Prints 1 if the header is little-endian, 0 otherwise. Maps to a command-line argument:
-printintelbyteorder %s
(position: 3).- printprogargsa pathlike object or string representing an existing file
Prints data dimension (and type, if relevant) arguments for a specific Camino program, where prog is one of shredder, scanner2voxel, vcthreshselect, pdview, track. Maps to a command-line argument:
-printprogargs %s
(position: 3).- readheadera pathlike object or string representing an existing file
Reads header information from file and prints to stdout. If this option is not specified, then the program writes a header based on the other arguments. Maps to a command-line argument:
-readheader %s
(position: 3).- scaleintera float
Constant to add to the image intensities. Used by SPM and MRIcro. Maps to a command-line argument:
-scaleinter %d
.- scaleslopea float
Intensities in the image are scaled by this factor by SPM and MRICro. Default is 1.0. Maps to a command-line argument:
-scaleslope %d
.- scheme_filea pathlike object or string representing an existing file
Camino scheme file (b values / vectors, see camino.fsl2scheme). Maps to a command-line argument:
%s
(position: 2).- voxel_dimsa list of from 3 to 3 items which are a float
Voxel dimensions in mm. Maps to a command-line argument:
-voxeldims %s
.
- headera pathlike object or string representing an existing file
Analyze header.
DT2NIfTI¶
Bases: CommandLine
Wrapped executable:
dt2nii
.Converts camino tensor data to NIfTI format
Reads Camino diffusion tensors, and converts them to NIFTI format as three .nii files.
- header_filea pathlike object or string representing an existing file
A Nifti .nii or .hdr file containing the header information.
Maps to a command-line argument:
-header %s
(position: 3).- in_filea pathlike object or string representing an existing file
Tract file. Maps to a command-line argument:
-inputfile %s
(position: 1).
- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- environa 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:
{}
)- output_roota pathlike object or string representing a file
Filename root prepended onto the names of three output files. Maps to a command-line argument:
-outputroot %s
(position: 2).
- dta pathlike object or string representing an existing file
Diffusion tensors in NIfTI format.
- exitcodea pathlike object or string representing an existing file
Exit codes from Camino reconstruction in NIfTI format.
- lns0a pathlike object or string representing an existing file
Estimated lns0 from Camino reconstruction in NIfTI format.
FSL2Scheme¶
Bases: StdOutCommandLine
Wrapped executable:
fsl2scheme
.Converts b-vectors and b-values from FSL format to a Camino scheme file.
Examples
>>> import nipype.interfaces.camino as cmon >>> makescheme = cmon.FSL2Scheme() >>> makescheme.inputs.bvec_file = 'bvecs' >>> makescheme.inputs.bvec_file = 'bvals' >>> makescheme.run()
- bval_filea pathlike object or string representing an existing file
B value file. Maps to a command-line argument:
-bvalfile %s
(position: 2).- bvec_filea pathlike object or string representing an existing file
B vector file. Maps to a command-line argument:
-bvecfile %s
(position: 1).
- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- bscalea float
Scaling factor to convert the b-values into different units. Default is 10^6. Maps to a command-line argument:
-bscale %d
.- diffusiontimea float
Diffusion time. Maps to a command-line argument:
-diffusiontime %f
.- environa 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:
{}
)- flipxa boolean
Negate the x component of all the vectors. Maps to a command-line argument:
-flipx
.- flipya boolean
Negate the y component of all the vectors. Maps to a command-line argument:
-flipy
.- flipza boolean
Negate the z component of all the vectors. Maps to a command-line argument:
-flipz
.- interleavea boolean
Interleave repeated scans. Only used with -numscans. Maps to a command-line argument:
-interleave
.- numscansan integer (int or long)
Output all measurements numerous (n) times, used when combining multiple scans from the same imaging session. Maps to a command-line argument:
-numscans %d
.- out_filea pathlike object or string representing a file
Maps to a command-line argument:
> %s
(position: -1).- usegradmoda boolean
Use the gradient magnitude to scale b. This option has no effect if your gradient directions have unit magnitude. Maps to a command-line argument:
-usegradmod
.
- schemea pathlike object or string representing an existing file
Scheme file.
Image2Voxel¶
Bases: StdOutCommandLine
Wrapped executable:
image2voxel
.Converts Analyze / NIFTI / MHA files to voxel order.
Converts scanner-order data in a supported image format to voxel-order data. Either takes a 4D file (all measurements in single image) or a list of 3D images.
Examples
>>> import nipype.interfaces.camino as cmon >>> img2vox = cmon.Image2Voxel() >>> img2vox.inputs.in_file = '4d_dwi.nii' >>> img2vox.run()
- in_filea pathlike object or string representing an existing file
4d image file. Maps to a command-line argument:
-4dimage %s
(position: 1).
- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- environa 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:
{}
)- out_filea pathlike object or string representing a file
Maps to a command-line argument:
> %s
(position: -1).- out_type‘float’ or ‘char’ or ‘short’ or ‘int’ or ‘long’ or ‘double’
“i.e. Bfloat”. Can be “char”, “short”, “int”, “long”, “float” or “double”. Maps to a command-line argument:
-outputdatatype %s
(position: 2). (Nipype default value:float
)
- voxel_ordera pathlike object or string representing an existing file
Path/name of 4D volume in voxel order.
NIfTIDT2Camino¶
Bases: CommandLine
Wrapped executable:
niftidt2camino
.Converts NIFTI-1 diffusion tensors to Camino format. The program reads the NIFTI header but does not apply any spatial transformations to the data. The NIFTI intensity scaling parameters are applied.
The output is the tensors in Camino voxel ordering: [exit, ln(S0), dxx, dxy, dxz, dyy, dyz, dzz].
The exit code is set to 0 unless a background mask is supplied, in which case the code is 0 in brain voxels and -1 in background voxels.
The value of ln(S0) in the output is taken from a file if one is supplied, otherwise it is set to 0.
NOTE FOR FSL USERS - FSL’s dtifit can output NIFTI tensors, but they are not stored in the usual way (which is using NIFTI_INTENT_SYMMATRIX). FSL’s tensors follow the ITK / VTK “upper-triangular” convention, so you will need to use the -uppertriangular option to convert these correctly.
- in_filea pathlike object or string representing an existing file
A NIFTI-1 dataset containing diffusion tensors. The tensors are assumed to be in lower-triangular order as specified by the NIFTI standard for the storage of symmetric matrices. This file should be either a .nii or a .hdr file. Maps to a command-line argument:
-inputfile %s
(position: 1).
- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- bgmaska pathlike object or string representing an existing file
Binary valued brain / background segmentation, may be a raw binary file (specify type with -maskdatatype) or a supported image file. Maps to a command-line argument:
-bgmask %s
.- environa 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:
{}
)- lns0_filea pathlike object or string representing an existing file
File containing the log of the unweighted signal for each voxel, may be a raw binary file (specify type with -inputdatatype) or a supported image file. Maps to a command-line argument:
-lns0 %s
.- out_filea pathlike object or string representing a file
Maps to a command-line argument:
> %s
(position: -1).- s0_filea pathlike object or string representing an existing file
File containing the unweighted signal for each voxel, may be a raw binary file (specify type with -inputdatatype) or a supported image file. Maps to a command-line argument:
-s0 %s
.- scaleintera float
A value v in the diffusion tensor is scaled to v * s + i. This is applied after any scaling specified by the input image. Default is 0.0. Maps to a command-line argument:
-scaleinter %s
.- scaleslopea float
A value v in the diffusion tensor is scaled to v * s + i. This is applied after any scaling specified by the input image. Default is 1.0. Maps to a command-line argument:
-scaleslope %s
.- uppertriangulara boolean
Specifies input in upper-triangular (VTK style) order. Maps to a command-line argument:
-uppertriangular %s
.
- out_filea pathlike object or string representing a file
Diffusion tensors data in Camino format.
ProcStreamlines¶
Bases: StdOutCommandLine
Wrapped executable:
procstreamlines
.Process streamline data
- This program does post-processing of streamline output from track. It can either output streamlines or connection probability maps.
Examples
>>> import nipype.interfaces.camino as cmon >>> proc = cmon.ProcStreamlines() >>> proc.inputs.in_file = 'tract_data.Bfloat' >>> proc.run()
- in_filea pathlike object or string representing an existing file
Data file. Maps to a command-line argument:
-inputfile %s
(position: 1).
- allowmultitargetsa boolean
Allows streamlines to connect to multiple target volumes. Maps to a command-line argument:
-allowmultitargets
.- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- datadimsa list of from 3 to 3 items which are an integer (int or long)
Data dimensions in voxels. Maps to a command-line argument:
-datadims %s
.- directionala list of from 3 to 3 items which are an integer (int or long)
Splits the streamlines at the seed point and computes separate connection probabilities for each segment. Streamline segments are grouped according to their dot product with the vector (X, Y, Z). The ideal vector will be tangential to the streamline trajectory at the seed, such that the streamline projects from the seed along (X, Y, Z) and -(X, Y, Z). However, it is only necessary for the streamline trajectory to not be orthogonal to (X, Y, Z). Maps to a command-line argument:
-directional %s
.- discardloopsa boolean
This option allows streamlines to enter a waypoint exactly once. After the streamline leaves the waypoint, the entire streamline is discarded upon a second entry to the waypoint. Maps to a command-line argument:
-discardloops
.- endpointfilea pathlike object or string representing a file
Image containing endpoint ROIs. This should be an Analyze 7.5 header / image file.hdr and file.img. Maps to a command-line argument:
-endpointfile %s
.- environa 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:
{}
)- exclusionfilea pathlike object or string representing a file
Image containing exclusion ROIs. This should be an Analyze 7.5 header / image file.hdr and file.img. Maps to a command-line argument:
-exclusionfile %s
.- gzipa boolean
Save the output image in gzip format. Maps to a command-line argument:
-gzip
.- inputmodel‘raw’ or ‘voxels’
Input model type (raw or voxels). Maps to a command-line argument:
-inputmodel %s
. (Nipype default value:raw
)- iterationsa float
Number of streamlines generated for each seed. Not required when outputting streamlines, but needed to create PICo images. The default is 1 if the output is streamlines, and 5000 if the output is connection probability images. Maps to a command-line argument:
-iterations %d
.- maxtractlengthan integer (int or long)
Maximum length of tracts. Maps to a command-line argument:
-maxtractlength %d
.- maxtractpointsan integer (int or long)
Maximum number of tract points. Maps to a command-line argument:
-maxtractpoints %d
.- mintractlengthan integer (int or long)
Minimum length of tracts. Maps to a command-line argument:
-mintractlength %d
.- mintractpointsan integer (int or long)
Minimum number of tract points. Maps to a command-line argument:
-mintractpoints %d
.- noresamplea boolean
Disables resampling of input streamlines. Resampling is automatically disabled if the input model is voxels. Maps to a command-line argument:
-noresample
.- out_filea pathlike object or string representing a file
Maps to a command-line argument:
> %s
(position: -1).- outputacma boolean
Output all tracts in a single connection probability map (Analyze image). Maps to a command-line argument:
-outputacm
. Requires inputs:outputroot
,seedfile
.- outputcbsa boolean
Outputs connectivity-based segmentation maps; requires target outputfile. Maps to a command-line argument:
-outputcbs
. Requires inputs:outputroot
,targetfile
,seedfile
.- outputcpa boolean
Output the connection probability map (Analyze image, float). Maps to a command-line argument:
-outputcp
. Requires inputs:outputroot
,seedfile
.- outputroota pathlike object or string representing a file
Prepended onto all output file names. Maps to a command-line argument:
-outputroot %s
.- outputsca boolean
Output the connection probability map (raw streamlines, int). Maps to a command-line argument:
-outputsc
. Requires inputs:outputroot
,seedfile
.- outputtractsa boolean
Output streamlines in raw binary format. Maps to a command-line argument:
-outputtracts
.- regionindexan integer (int or long)
Index of specific region to process. Maps to a command-line argument:
-regionindex %d
.- resamplestepsizea float
Each point on a streamline is tested for entry into target, exclusion or waypoint volumes. If the length between points on a tract is not much smaller than the voxel length, then streamlines may pass through part of a voxel without being counted. To avoid this, the program resamples streamlines such that the step size is one tenth of the smallest voxel dimension in the image. This increases the size of raw or oogl streamline output and incurs some performance penalty. The resample resolution can be controlled with this option or disabled altogether by passing a negative step size or by passing the -noresample option. Maps to a command-line argument:
-resamplestepsize %d
.- seedfilea pathlike object or string representing a file
Image Containing Seed Points. Maps to a command-line argument:
-seedfile %s
.- seedpointmma list of from 3 to 3 items which are an integer (int or long)
The coordinates of a single seed point for tractography in mm. Maps to a command-line argument:
-seedpointmm %s
.- seedpointvoxa list of from 3 to 3 items which are an integer (int or long)
The coordinates of a single seed point for tractography in voxels. Maps to a command-line argument:
-seedpointvox %s
.- targetfilea pathlike object or string representing a file
Image containing target volumes. Maps to a command-line argument:
-targetfile %s
.- truncateinexclusiona boolean
Retain segments of a streamline before entry to an exclusion ROI. Maps to a command-line argument:
-truncateinexclusion
.- truncateloopsa boolean
This option allows streamlines to enter a waypoint exactly once. After the streamline leaves the waypoint, it is truncated upon a second entry to the waypoint. Maps to a command-line argument:
-truncateloops
.- voxeldimsa list of from 3 to 3 items which are an integer (int or long)
Voxel dimensions in mm. Maps to a command-line argument:
-voxeldims %s
.- waypointfilea pathlike object or string representing a file
Image containing waypoints. Waypoints are defined as regions of the image with the same intensity, where 0 is background and any value > 0 is a waypoint. Maps to a command-line argument:
-waypointfile %s
.outputroot_files : a list of items which are a pathlike object or string representing an existing file proc : a pathlike object or string representing an existing file
Processed Streamlines.
Shredder¶
Bases: StdOutCommandLine
Wrapped executable:
shredder
.Extracts periodic chunks from a data stream.
Shredder makes an initial offset of offset bytes. It then reads and outputs chunksize bytes, skips space bytes, and repeats until there is no more input.
If the chunksize is negative, chunks of size chunksize are read and the byte ordering of each chunk is reversed. The whole chunk will be reversed, so the chunk must be the same size as the data type, otherwise the order of the values in the chunk, as well as their endianness, will be reversed.
Examples
>>> import nipype.interfaces.camino as cam >>> shred = cam.Shredder() >>> shred.inputs.in_file = 'SubjectA.Bfloat' >>> shred.inputs.offset = 0 >>> shred.inputs.chunksize = 1 >>> shred.inputs.space = 2 >>> shred.run()
- in_filea pathlike object or string representing an existing file
Raw binary data file. Maps to a command-line argument:
< %s
(position: -2).
- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- chunksizean integer (int or long)
Reads and outputs a chunk of chunksize bytes. Maps to a command-line argument:
%d
(position: 2).- environa 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:
{}
)- offsetan integer (int or long)
Initial offset of offset bytes. Maps to a command-line argument:
%d
(position: 1).- out_filea pathlike object or string representing a file
Maps to a command-line argument:
> %s
(position: -1).- spacean integer (int or long)
Skips space bytes. Maps to a command-line argument:
%d
(position: 3).
- shreddeda pathlike object or string representing an existing file
Shredded binary data file.
TractShredder¶
Bases: StdOutCommandLine
Wrapped executable:
tractshredder
.Extracts bunches of streamlines.
tractshredder works in a similar way to shredder, but processes streamlines instead of scalar data. The input is raw streamlines, in the format produced by track or procstreamlines.
The program first makes an initial offset of offset tracts. It then reads and outputs a group of bunchsize tracts, skips space tracts, and repeats until there is no more input.
Examples
>>> import nipype.interfaces.camino as cmon >>> shred = cmon.TractShredder() >>> shred.inputs.in_file = 'tract_data.Bfloat' >>> shred.inputs.offset = 0 >>> shred.inputs.bunchsize = 1 >>> shred.inputs.space = 2 >>> shred.run()
- in_filea pathlike object or string representing an existing file
Tract file. Maps to a command-line argument:
< %s
(position: -2).
- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- bunchsizean integer (int or long)
Reads and outputs a group of bunchsize tracts. Maps to a command-line argument:
%d
(position: 2).- environa 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:
{}
)- offsetan integer (int or long)
Initial offset of offset tracts. Maps to a command-line argument:
%d
(position: 1).- out_filea pathlike object or string representing a file
Maps to a command-line argument:
> %s
(position: -1).- spacean integer (int or long)
Skips space tracts. Maps to a command-line argument:
%d
(position: 3).
- shreddeda pathlike object or string representing an existing file
Shredded tract file.
VtkStreamlines¶
Bases: StdOutCommandLine
Wrapped executable:
vtkstreamlines
.Use vtkstreamlines to convert raw or voxel format streamlines to VTK polydata
Examples
>>> import nipype.interfaces.camino as cmon >>> vtk = cmon.VtkStreamlines() >>> vtk.inputs.in_file = 'tract_data.Bfloat' >>> vtk.inputs.voxeldims = [1,1,1] >>> vtk.run()
- in_filea pathlike object or string representing an existing file
Data file. Maps to a command-line argument:
< %s
(position: -2).
- argsa unicode string
Additional parameters to the command. Maps to a command-line argument:
%s
.- colourorienta boolean
Each point on the streamline is coloured by the local orientation. Maps to a command-line argument:
-colourorient
.- environa 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:
{}
)- inputmodel‘raw’ or ‘voxels’
Input model type (raw or voxels). Maps to a command-line argument:
-inputmodel %s
. (Nipype default value:raw
)- interpolatea boolean
The scalar value at each point on the streamline is calculated by trilinear interpolation. Maps to a command-line argument:
-interpolate
.- interpolatescalarsa boolean
The scalar value at each point on the streamline is calculated by trilinear interpolation. Maps to a command-line argument:
-interpolatescalars
.- out_filea pathlike object or string representing a file
Maps to a command-line argument:
> %s
(position: -1).- scalar_filea pathlike object or string representing a file
Image that is in the same physical space as the tracts. Maps to a command-line argument:
-scalarfile %s
(position: 3).- seed_filea pathlike object or string representing a file
Image containing seed points. Maps to a command-line argument:
-seedfile %s
(position: 1).- target_filea pathlike object or string representing a file
Image containing integer-valued target regions. Maps to a command-line argument:
-targetfile %s
(position: 2).- voxeldimsa list of from 3 to 3 items which are an integer (int or long)
Voxel dimensions in mm. Maps to a command-line argument:
-voxeldims %s
(position: 4).
- vtka pathlike object or string representing an existing file
Streamlines in VTK format.