interfaces.dcm2nii¶
Dcm2nii¶
Wraps the executable command dcm2nii
.
Uses MRIcron’s dcm2nii to convert dicom files
Examples¶
>>> from nipype.interfaces.dcm2nii import Dcm2nii
>>> converter = Dcm2nii()
>>> converter.inputs.source_names = ['functional_1.dcm', 'functional_2.dcm']
>>> converter.inputs.gzip_output = True
>>> converter.inputs.output_dir = '.'
>>> converter.cmdline # doctest: +ELLIPSIS
'dcm2nii -a y -c y -b config.ini -v y -d y -e y -g y -i n -n y -o . -p y -x n -f n functional_1.dcm'
Inputs:
[Mandatory]
source_names: (a list of items which are a pathlike object or string
representing an existing file)
argument: ``%s``, position: -1
mutually_exclusive: source_dir
source_dir: (a pathlike object or string representing an existing
directory)
argument: ``%s``, position: -1
mutually_exclusive: source_names
[Optional]
anonymize: (a boolean, nipype default value: True)
Remove identifying information
argument: ``-a``
config_file: (a pathlike object or string representing an existing
file)
Load settings from specified inifile
argument: ``-b %s``
collapse_folders: (a boolean, nipype default value: True)
Collapse input folders
argument: ``-c``
date_in_filename: (a boolean, nipype default value: True)
Date in filename
argument: ``-d``
events_in_filename: (a boolean, nipype default value: True)
Events (series/acq) in filename
argument: ``-e``
source_in_filename: (a boolean, nipype default value: False)
Source filename
argument: ``-f``
gzip_output: (a boolean, nipype default value: False)
Gzip output (.gz)
argument: ``-g``
id_in_filename: (a boolean, nipype default value: False)
ID in filename
argument: ``-i``
nii_output: (a boolean, nipype default value: True)
Save as .nii - if no, create .hdr/.img pair
argument: ``-n``
output_dir: (a pathlike object or string representing an existing
directory)
Output dir - if unspecified, source directory is used
argument: ``-o %s``
protocol_in_filename: (a boolean, nipype default value: True)
Protocol in filename
argument: ``-p``
reorient: (a boolean)
Reorient image to nearest orthogonal
argument: ``-r``
spm_analyze: (a boolean)
SPM2/Analyze not SPM5/NIfTI
argument: ``-s``
mutually_exclusive: nii_output
convert_all_pars: (a boolean, nipype default value: True)
Convert every image in directory
argument: ``-v``
reorient_and_crop: (a boolean, nipype default value: False)
Reorient and crop 3D images
argument: ``-x``
args: (a unicode string)
Additional parameters to the command
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', nipype default value: {})
Environment variables
Outputs:
converted_files: (a list of items which are a pathlike object or
string representing an existing file)
reoriented_files: (a list of items which are a pathlike object or
string representing an existing file)
reoriented_and_cropped_files: (a list of items which are a pathlike
object or string representing an existing file)
bvecs: (a list of items which are a pathlike object or string
representing an existing file)
bvals: (a list of items which are a pathlike object or string
representing an existing file)
Dcm2niix¶
Wraps the executable command dcm2niix
.
Uses Chris Rorden’s dcm2niix to convert dicom files
Examples¶
>>> from nipype.interfaces.dcm2nii import Dcm2niix
>>> converter = Dcm2niix()
>>> converter.inputs.source_dir = 'dicomdir'
>>> converter.inputs.compression = 5
>>> converter.inputs.output_dir = 'ds005'
>>> converter.cmdline
'dcm2niix -b y -z y -5 -x n -t n -m n -o ds005 -s n -v n dicomdir'
>>> converter.run() # doctest: +SKIP
In the example below, we note that the current version of dcm2niix converts any files in the directory containing the files in the list. We also do not support nested filenames with this option. Thus all files must have a common root directory.
>>> converter = Dcm2niix()
>>> converter.inputs.source_names = ['functional_1.dcm', 'functional_2.dcm']
>>> converter.inputs.compression = 5
>>> converter.inputs.output_dir = 'ds005'
>>> converter.cmdline
'dcm2niix -b y -z y -5 -x n -t n -m n -o ds005 -s n -v n .'
>>> converter.run() # doctest: +SKIP
Inputs:
[Mandatory]
source_names: (a list of items which are a pathlike object or string
representing an existing file)
A set of filenames to be converted. Note that the current version
(1.0.20180328) of dcm2niix converts any files in the directory. To
only convert specific files they should be in an isolated directory
argument: ``%s``, position: -1
mutually_exclusive: source_dir
source_dir: (a pathlike object or string representing an existing
directory)
A directory containing dicom files to be converted
argument: ``%s``, position: -1
mutually_exclusive: source_names
[Optional]
out_filename: (a unicode string)
Output filename template (%a=antenna (coil) number, %c=comments,
%d=description, %e=echo number, %f=folder name, %i=ID of patient,
%j=seriesInstanceUID, %k=studyInstanceUID, %m=manufacturer, %n=name
of patient, %p=protocol, %s=series number, %t=time, %u=acquisition
number, %v=vendor, %x=study ID; %z=sequence name)
argument: ``-f %s``
output_dir: (a pathlike object or string representing an existing
directory, nipype default value: .)
Output directory
argument: ``-o %s``
bids_format: (a boolean, nipype default value: True)
Create a BIDS sidecar file
argument: ``-b``
anon_bids: (a boolean)
Anonymize BIDS
argument: ``-ba``
requires: bids_format
compress: ('y' or 'i' or 'n' or '3', nipype default value: y)
Gzip compress images - [y=pigz, i=internal, n=no, 3=no,3D]
argument: ``-z %s``
merge_imgs: (a boolean, nipype default value: False)
merge 2D slices from same series
argument: ``-m``
single_file: (a boolean, nipype default value: False)
Single file mode
argument: ``-s``
verbose: (a boolean, nipype default value: False)
Verbose output
argument: ``-v``
crop: (a boolean, nipype default value: False)
Crop 3D T1 acquisitions
argument: ``-x``
has_private: (a boolean, nipype default value: False)
Text notes including private patient details
argument: ``-t``
compression: (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9)
Gz compression level (1=fastest, 9=smallest)
argument: ``-%d``
comment: (a unicode string)
Comment stored as NIfTI aux_file
argument: ``-c %s``
ignore_deriv: (a boolean)
Ignore derived, localizer and 2D images
argument: ``-i``
series_numbers: (a list of items which are a unicode string)
Selectively convert by series number - can be used up to 16 times
argument: ``-n %s...``
philips_float: (a boolean)
Philips precise float (not display) scaling
argument: ``-p``
to_nrrd: (a boolean)
Export as NRRD instead of NIfTI
argument: ``-e``
args: (a unicode string)
Additional parameters to the command
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', nipype default value: {})
Environment variables
Outputs:
converted_files: (a list of items which are a pathlike object or
string representing an existing file)
bvecs: (a list of items which are a pathlike object or string
representing an existing file)
bvals: (a list of items which are a pathlike object or string
representing an existing file)
bids: (a list of items which are a pathlike object or string
representing an existing file)