cmtklib.interfaces.fsl module
The FSL module provides Nipype interfaces for FSL functions missing in Nipype or modified.
ApplymultipleWarp
Bases: nipype.interfaces.base.core.BaseInterface
Apply a deformation field estimated by FSL
fnirt
to a list of images.Example
>>> from cmtklib.interfaces import fsl >>> apply_warp = fsl.ApplymultipleWarp() >>> apply_warp.inputs.in_files = ['/path/to/sub-01_atlas-L2018_desc-scale1_dseg.nii.gz', >>> '/path/to/sub-01_atlas-L2018_desc-scale2_dseg.nii.gz', >>> '/path/to/sub-01_atlas-L2018_desc-scale3_dseg.nii.gz', >>> '/path/to/sub-01_atlas-L2018_desc-scale4_dseg.nii.gz', >>> '/path/to/sub-01_atlas-L2018_desc-scale5_dseg.nii.gz'] >>> apply_warp.inputs.field_file = '/path/to/fnirt_deformation.nii.gz' >>> apply_warp.inputs.ref_file = '/path/to/sub-01_meanBOLD.nii.gz' >>> apply_warp.run()
- field_filea pathlike object or string representing an existing file
Deformation field.
- ref_filea pathlike object or string representing an existing file
Reference image used for target space.
- in_filesa list of items which are a pathlike object or string representing an existing file
Files to be registered.
- interp‘nn’ or ‘trilinear’ or ‘sinc’ or ‘spline’
Interpolation method. Maps to a command-line argument:
--interp=%s
(position: -2).
- out_filesa list of items which are a pathlike object or string representing a file
Warped files.
ApplymultipleXfm
Bases: nipype.interfaces.base.core.BaseInterface
Apply an XFM transform estimated by FSL
flirt
to a list of images.Example
>>> from cmtklib.interfaces import fsl >>> apply_xfm = fsl.ApplymultipleXfm >>> apply_xfm.inputs.in_files = ['/path/to/sub-01_atlas-L2018_desc-scale1_dseg.nii.gz', >>> '/path/to/sub-01_atlas-L2018_desc-scale2_dseg.nii.gz', >>> '/path/to/sub-01_atlas-L2018_desc-scale3_dseg.nii.gz', >>> '/path/to/sub-01_atlas-L2018_desc-scale4_dseg.nii.gz', >>> '/path/to/sub-01_atlas-L2018_desc-scale5_dseg.nii.gz'] >>> apply_xfm.inputs.xfm_file = '/path/to/flirt_transform.xfm' >>> apply_xfm.inputs.reference = '/path/to/sub-01_meanBOLD.nii.gz' >>> apply_xfm.run()
- referencea pathlike object or string representing an existing file
Reference image used for target space.
- xfm_filea pathlike object or string representing an existing file
Transform file.
- in_filesa list of items which are a pathlike object or string representing an existing file
Files to be registered.
- interp‘nearestneighbour’ or ‘spline’
Interpolation used.
- out_filesa list of items which are a pathlike object or string representing a file
Transformed files.
BinaryThreshold
Bases: nipype.interfaces.fsl.base.FSLCommand
Wrapped executable:
fslmaths
.Use
fslmaths
to apply a threshold to an image in a variety of ways.Examples
>>> from cmtklib.interfaces.fsl import BinaryThreshold >>> thresh = BinaryThreshold() >>> thresh.inputs.in_file = '/path/to/probseg.nii.gz' >>> thresh.inputs.thresh = 0.5 >>> thresh.inputs.out_file = '/path/to/output_binseg.nii.gz' >>> thresh.run()
- in_filea pathlike object or string representing an existing file
Image to operate on. Maps to a command-line argument:
%s
(position: 2).- out_filea pathlike object or string representing a file
Image to write. Maps to a command-line argument:
%s
(position: 5).- thresha float
Threshold value. Maps to a command-line argument:
-thr %s
(position: 3).
- argsa string
Additional parameters to the command. Maps to a command-line argument:
%s
.- binarizea boolean
Maps to a command-line argument:
-bin
(position: 4).- 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_type‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’
FSL output type.
- out_filea pathlike object or string representing an existing file
Image written after calculations.
CreateAcqpFile
Bases: nipype.interfaces.base.core.BaseInterface
Create an acquisition
Acqp
file for FSLeddy
.Note
This value can be extracted from dMRI data acquired on Siemens scanner
Examples
>>> from cmtklib.interfaces.fsl import CreateAcqpFile >>> create_acqp = CreateAcqpFile() >>> create_acqp.inputs.total_readout = 0.28 >>> create_acqp.run()total_readout : a float
acqp : a pathlike object or string representing an existing file
CreateIndexFile
Bases: nipype.interfaces.base.core.BaseInterface
Create an index file for FSL
eddy
from amrtrix
diffusion gradient table.Examples
>>> from cmtklib.interfaces.fsl import CreateIndexFile >>> create_index = CreateIndexFile() >>> create_index.inputs.in_grad_mrtrix = 'grad.txt' >>> create_index.run()
- in_grad_mrtrixa pathlike object or string representing an existing file
Input DWI gradient table in MRTrix format.
index : a pathlike object or string representing an existing file
Eddy
Bases: nipype.interfaces.fsl.base.FSLCommand
Wrapped executable:
eddy
.Performs eddy current distorsion correction using FSL
eddy
.Example
>>> from cmtklib.interfaces import fsl >>> eddyc = fsl.Eddy(in_file='diffusion.nii', >>> bvecs='diffusion.bvecs', >>> bvals='diffusion.bvals', >>> out_file="diffusion_eddyc.nii") >>> eddyc.run()
- acqpa pathlike object or string representing an existing file
File containing acquisition parameters. Maps to a command-line argument:
--acqp=%s
(position: 3).- bvalsa pathlike object or string representing an existing file
File containing the b-values for all volumes in –imain. Maps to a command-line argument:
--bvals=%s
(position: 5).- bvecsa pathlike object or string representing an existing file
File containing the b-vectors for all volumes in –imain. Maps to a command-line argument:
--bvecs=%s
(position: 4).- in_filea pathlike object or string representing an existing file
File containing all the images to estimate distortions for. Maps to a command-line argument:
--imain=%s
(position: 0).- indexa pathlike object or string representing an existing file
File containing indices for all volumes in –imain into –acqp and –topup. Maps to a command-line argument:
--index=%s
(position: 2).- maska pathlike object or string representing an existing file
Mask to indicate brain. Maps to a command-line argument:
--mask=%s
(position: 1).
- argsa 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
Basename for output. Maps to a command-line argument:
--out=%s
(position: 6).- output_type‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’
FSL output type.
- verbosea boolean
Display debugging messages. Maps to a command-line argument:
--verbose
(position: 7).
- bvecs_rotateda pathlike object or string representing an existing file
Path/name of rotated DWI gradient bvecs file.
- eddy_correcteda pathlike object or string representing an existing file
Path/name of 4D eddy corrected DWI file.
EddyOpenMP
Bases: nipype.interfaces.fsl.base.FSLCommand
Wrapped executable:
eddy_openmp
.Performs eddy current distorsion correction using FSL
eddy_openmp
.Example
>>> from cmtklib.interfaces import fsl >>> eddyc = fsl.EddyOpenMP(in_file='diffusion.nii', >>> bvecs='diffusion.bvecs', >>> bvals='diffusion.bvals', >>> out_file="diffusion_eddyc.nii") >>> eddyc.run()
- acqpa pathlike object or string representing an existing file
File containing acquisition parameters. Maps to a command-line argument:
--acqp=%s
(position: 3).- bvalsa pathlike object or string representing an existing file
File containing the b-values for all volumes in –imain. Maps to a command-line argument:
--bvals=%s
(position: 5).- bvecsa pathlike object or string representing an existing file
File containing the b-vectors for all volumes in –imain. Maps to a command-line argument:
--bvecs=%s
(position: 4).- in_filea pathlike object or string representing an existing file
File containing all the images to estimate distortions for. Maps to a command-line argument:
--imain=%s
(position: 0).- indexa pathlike object or string representing an existing file
File containing indices for all volumes in –imain into –acqp and –topup. Maps to a command-line argument:
--index=%s
(position: 2).- maska pathlike object or string representing an existing file
Mask to indicate brain. Maps to a command-line argument:
--mask=%s
(position: 1).
- argsa 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
Basename for output. Maps to a command-line argument:
--out=%s
(position: 6).- output_type‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’
FSL output type.
- verbosea boolean
Display debugging messages. Maps to a command-line argument:
--verbose
(position: 7).
- bvecs_rotateda pathlike object or string representing an existing file
Path/name of rotated DWI gradient bvecs file.
- eddy_correcteda pathlike object or string representing an existing file
Path/name of 4D eddy corrected DWI file.
FSLCreateHD
Bases: nipype.interfaces.base.core.CommandLine
Wrapped executable:
fslcreatehd
.Calls the
fslcreatehd
command to create an image for space / dimension reference.Examples
>>> from cmtklib.interfaces.fsl import FSLCreateHD >>> fsl_create = FSLCreateHD() >>> fsl_create.inputs.im_size = [256, 256, 256, 1] >>> fsl_create.inputs.vox_size = [1, 1, 1] >>> fsl_create.inputs.tr = 0 >>> fsl_create.inputs.origin = [0, 0, 0] >>> fsl_create.inputs.datatype = '16' # 16: float >>> fsl_create.inputs.out_filename = '/path/to/generated_image.nii.gz' >>> fsl_create.run()
- datatype‘2’ or ‘4’ or ‘8’ or ‘16’ or ‘32’ or ‘64’
Datatype values: 2=char, 4=short, 8=int, 16=float, 64=double. Maps to a command-line argument:
%s
(position: 5).- im_sizea list of from 4 to 4 items which are an integer
Image size : xsize , ysize, zsize, tsize . Maps to a command-line argument:
%s
(position: 1).- origina list of from 3 to 3 items which are an integer
Origin coordinates : xorig, yorig, zorig. Maps to a command-line argument:
%s
(position: 4).- out_filenamea pathlike object or string representing a file
the output temp reference image created.
Maps to a command-line argument:
%s
(position: 6).- tran integer
<tr>. Maps to a command-line argument:
%s
(position: 3).- vox_sizea list of from 3 to 3 items which are an integer
Voxel size : xvoxsize, yvoxsize, zvoxsize. Maps to a command-line argument:
%s
(position: 2).
- argsa 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 an existing file
Path/name of the output reference image created.
MathsCommand
Bases: nipype.interfaces.fsl.base.FSLCommand
Wrapped executable:
fslmaths
.Calls the
fslmaths
command in a variety of ways.Examples
>>> from cmtklib.interfaces.fsl import MathsCommand >>> fsl_maths = MathsCommand() >>> fsl_maths.inputs.in_file = '/path/to/image_with_nans.nii.gz' >>> fsl_maths.inputs.nan2zeros = True >>> fsl_maths.inputs.out_file = '/path/to/image_with_no_nans.nii.gz' >>> fsl_maths.run()
- in_filea pathlike object or string representing an existing file
Image to operate on. Maps to a command-line argument:
%s
(position: 2).
- argsa 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:
{}
)- internal_datatype‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’
Datatype to use for calculations (default is float). Maps to a command-line argument:
-dt %s
(position: 1).- nan2zerosa boolean
Change NaNs to zeros before doing anything. Maps to a command-line argument:
-nan
(position: 3).- out_filea pathlike object or string representing a file
Image to write. Maps to a command-line argument:
%s
(position: -2).- output_datatype‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’
Datatype to use for output (default uses input type). Maps to a command-line argument:
-odt %s
(position: -1).- output_type‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’
FSL output type.
- out_filea pathlike object or string representing an existing file
Image written after calculations.
Orient
Bases: nipype.interfaces.fsl.base.FSLCommand
Wrapped executable:
fslorient
.Use fslorient to get/set orientation information from an image’s header.
Advanced tool that reports or sets the orientation information in a file. Note that only in NIfTI files can the orientation be changed - Analyze files are always treated as “radiological” (meaning that they could be simply rotated into the same alignment as the MNI152 standard images - equivalent to the appropriate sform or qform in a NIfTI file having a negative determinant).
Examples
>>> from cmtklib.interfaces.fsl import Orient >>> fsl_orient = Orient() >>> fsl_orient.inputs.in_file = 'input_image.nii.gz' >>> fsl_orient.inputs.force_radiological = True >>> fsl_orient.inputs.out_file = 'output_image.nii.gz' >>> fsl_orient.run()
- in_filea pathlike object or string representing an existing file
Input image. Maps to a command-line argument:
%s
(position: 2).
- argsa string
Additional parameters to the command. Maps to a command-line argument:
%s
.- copy_qform2sforma boolean
Sets the sform equal to the qform - code and matrix. Maps to a command-line argument:
-copyqform2sform
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- copy_sform2qforma boolean
Sets the qform equal to the sform - code and matrix. Maps to a command-line argument:
-copysform2qform
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- delete_orienta boolean
Removes orient info from header. Maps to a command-line argument:
-deleteorient
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- 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:
{}
)- force_neurologicala boolean
Makes FSL neurological header - not Analyze. Maps to a command-line argument:
-forceneurological
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- force_radiologicala boolean
Makes FSL radiological header. Maps to a command-line argument:
-forceradiological
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- get_orienta boolean
Gets FSL left-right orientation. Maps to a command-line argument:
-getorient
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- get_qforma boolean
Gets the 16 elements of the qform matrix. Maps to a command-line argument:
-getqform
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- get_qformcodea boolean
Gets the qform integer code. Maps to a command-line argument:
-getqformcode
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- get_sforma boolean
Gets the 16 elements of the sform matrix. Maps to a command-line argument:
-getsform
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- get_sformcodea boolean
Gets the sform integer code. Maps to a command-line argument:
-getsformcode
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- output_type‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’
FSL output type.
- set_qforma list of from 16 to 16 items which are a float
<m11 m12 … m44> sets the 16 elements of the qform matrix. Maps to a command-line argument:
-setqform %f
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- set_qformcodean integer
<code> sets qform integer code. Maps to a command-line argument:
-setqormcode %d
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- set_sforma list of from 16 to 16 items which are a float
<m11 m12 … m44> sets the 16 elements of the sform matrix. Maps to a command-line argument:
-setsform %f
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- set_sformcodean integer
<code> sets sform integer code. Maps to a command-line argument:
-setformcode %d
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.- swap_orienta boolean
Swaps FSL radiological and FSL neurological. Maps to a command-line argument:
-swaporient
(position: 1). Mutually exclusive with inputs:get_orient
,get_sform
,get_qform
,set_sform
,set_qform
,get_sformcode
,get_qformcode
,set_sformcode
,set_qformcode
,copy_sform2qform
,copy_qform2sform
,delete_orient
,force_radiological
,force_neurological
,swap_orient
.
- orienta string
FSL left-right orientation.
- out_filea pathlike object or string representing an existing file
Image with modified orientation.
- qforma list of from 16 to 16 items which are a float
The 16 elements of the qform matrix.
- qformcodean integer
Qform integer code.
- sforma list of from 16 to 16 items which are a float
The 16 elements of the sform matrix.
- sformcodean integer
Sform integer code.