dcm2niixpy package

Submodules

dcm2niixpy.dcm2niix module

class DCM2NIIX(version, container_backend='singularity', download=False, download_folder=None)[source]

Bases: object

__init__(version, container_backend='singularity', download=False, download_folder=None)[source]

Initialize the DCM2NIIX object.

Parameters
  • container_backend (str, optional) – Either “docker” or “singularity”. Defaults to “singularity”.

  • version (str) – Docker tag of version to use. Defaults to None.

  • download (bool, optional) – Whether to download the container instead of pulling and running everytime. Defaults to False.

  • download_folder (str, optional) – Location to download the container to. Defaults to None.

property container_backend: str

Get the container backend.

Returns

Either “docker” or “singularity”.

Return type

str

property compression_level: int

gz compression level (1=fastest, 9=smallest).

Corresonds with ‘-1’ through ‘-9’ setting of dcm2niix.

Returns

compression level. Defaults to 6

Return type

int

property adjacent_dicoms: bool

Whether all DICOMs are adjacent (images from same series are always in same folder).

Corresponds to ‘-a’ setting of dcm2niix.

Returns

Whether all DICOMs are in same folder. Defaults to False

Return type

bool

property bids_sidecar: str

Whether to generate a bids sidecar.

y = yes, o = only bids sidecar, no nifti, n = no.

Corresponds to ‘-b’ setting of dcm2niix

Returns

the bids sidecar setting. Defaults to y

Return type

str

property anonymize_bids_sidecar: str

Whether to anonymize the bids sidecar.

y = yes, n = no.

Corresponds to ‘-ba’ setting of dcm2niix.

Returns

the bids sidecar anonymization setting. Defaults to y

Return type

str

property comments_in_aux: str

Whether to store comments in a NIfTI aux_file.

Provide up to 24 characters, e.g. first_visit.

Corresponds to ‘-c’ setting of dcm2niix

Returns

the aux setting. No default

Return type

str

property directory_search_depth: str

Set the directory search depth.

Value can range from 0 to 9.

Corresponds to ‘-d’ setting of dcm2niix

Returns

The directory search depth. Defaults to 5

Return type

str

property export_as_nrrd: str

Whether to save the file as NRRD instead of NIfTI.

y = yes, n = no.

Corresponds to ‘-e’ setting of dcm2niix.

Returns

Whether to save as NRRD. Defaults to n.

Return type

str

property filename: str

The filename used to save the file.

The following parameters can be used and will be replaced in the string:

  • %a=antenna (coil) name

  • %b=basename

  • %c=comments

  • %d=description

  • %e=echo number

  • %f=folder name

  • %i=ID of patient

  • %j=seriesInstanceUID

  • %k=studyInstanceUID

  • %m=manufacturer

  • %n=name of patient

  • %o=mediaObjectInstanceUID

  • %p=protocol

  • %r=instance number

  • %s=series number

  • %t=time

  • %u=acquisition number

  • %v=vendor

  • %x=study ID

  • %z=sequence name

Corresponds to ‘-f’ setting of dcm2niix.

Returns

The filename. Defaults to %f_%p_%t_%s

Return type

str

property generate_defaults: str

reset and write defaults; i=ignore: reset defaults], default n)

Type

generate defaults file (y/n/o/i [o=only

Return type

str

property ignore_derived: str

ignore derived, localizer and 2D images (y/n, default n)

Return type

str

property losslessly_scale: str

losslessly scale 16-bit integers to use dynamic range (y/n/o [yes=scale, no=no, but uint16->int16, o=original], default n)

Return type

str

property merge_2d_slices: str

merge 2D slices from same series regardless of echo, exposure, etc. (n/y or 0/1/2, default 2) [no, yes, auto]

Return type

str

property convert_only_this_crc: str

only convert this series CRC number - can be used up to 16 times (default convert all)

Return type

str

property output_directory: None

output directory (omit to save to input folder)

Return type

None

property philips_precise_float_scaling: str

Philips precise float (not display) scaling (y/n, default y)

Return type

str

property rename: str

rename instead of convert DICOMs (y/n, default n)

Return type

str

property single_file_mode: str

single file mode, do not convert other images in folder (y/n, default n)

Return type

str

property private_text_notes: str

text notes includes private patient details (y/n, default n)

Return type

str

property verbose: str

verbose (n/y or 0/1/2, default 0) [no, yes, logorrheic]

Return type

str

property conflict_write_behavior: str

0=skip duplicates, 1=overwrite, 2=add suffix)

Type

write behavior for name conflicts (0,1,2, default 2

Return type

str

property crop_3D: str

crop 3D acquisitions (y/n/i, default n, use ‘i’gnore to neither crop nor rotate 3D acquistions)

Return type

str

property compress: str
Return type

str

property byte_order: str
Return type

str

property progress: str
Return type

str

property terse: str
Return type

str

convert(input_path, output_path=None, options=None)[source]
class DCM2NIIX_OUTPUT[source]

Bases: object

parse_output(output)[source]

Module contents