API Documentation

hierarchy

class qidicom.hierarchy.ImageHierarchy(*files)

Bases: qiutil.dictionary_hierarchy.DictionaryHierarchy

ImageHierarchy wraps the DICOM image subject/study/series/image hierarchy.

:param the input DICOM files

__init__(*files)

:param the input DICOM files

add(ds)

Adds the subject-study-series-image hierarchy entries from the given DICOM dataset.

Parameters:ds – the DICOM dataset
qidicom.hierarchy.group_by(tag, *files)

Groups DICOM files by the given tag description. Subtraction images, indicated by a SUB DICOM Image Type, are ignored. The tag can elide blanks, e.g. ‘SeriesNumber’.

Parameters:
  • tag – the DICOM tag
  • dicom_files – the DICOM files or directories
Returns:

a {tag value: [DICOM file names]} dictionary

qidicom.hierarchy.read_hierarchy(*files)

Returns the ImageHierarchy for the DICOM files in the given locations.

Parameters:files – the files or directories to walk for DICOM files
Returns:the image hierarchy
Return type:qiutil.image_hierarchy.ImageHierarchy

meta

class qidicom.meta.Editor(**edits)

Bases: object

DICOM tag editor.

Creates a new DICOM tag editor.

Parameters:edits – the edits tag value modifications
__init__(**edits)

Creates a new DICOM tag editor.

Parameters:edits – the edits tag value modifications
edit(dataset)

Applies this editor’s edits tag value modifications.

Parameters:dataset – the pydicom dicom dataset object
qidicom.meta.select(ds, *tags)

Reads the given DICOM dataset tags.

Parameters:
  • ds – the pydicom dicom object
  • tags – the names of tags to read (default all unbracketed tags)
Returns:

the tag name => value dictionary

reader

class qidicom.reader.DicomHeaderIterator(*dicom_files)

Bases: qidicom.reader.DicomIterator

DicomHeaderIterator is a generator class for reading the pydicom non-pixel data sets from DICOM files.

__init__(*dicom_files)
class qidicom.reader.DicomIterator(*dicom_files, **opts)

Bases: qiutil.file.FileIterator

DicomIterator is a generator class for reading the pydicom data sets from DICOM files.

Parameters:dicom_files – the DICOM files to include
__init__(*dicom_files, **opts)
Parameters:dicom_files – the DICOM files to include
qidicom.reader.iter_dicom(*dicom_files)

Iterates over the DICOM data sets for DICOM files at the given locations.

Parameters:dicom_files – the DICOM files or directories containing DICOM files
qidicom.reader.iter_dicom_headers(*dicom_files)

Iterates over the DICOM headers for DICOM files at the given locations.

Parameters:dicom_files – the DICOM files or directories containing DICOM files

writer

qidicom.writer.edit(*in_files, **opts)

Edits the given DICOM files. The dest option can be either the destination directory path or an output file namer function. If dest is a directory path, then the output file location is a file in the given destination directory with the same unqualified file name as the input file. If the dest option is a function, then the output file location is the result of calling that function with the input file path as an argument. The default is to edit the file in-place.

Parameters:
  • in_files – the input DICOM files or directories containing DICOM files
  • opts – the following options:
  • dest – the destination directory or file namer function
Yield:

the :meth`qidicom.reader.next` pydicom dicom object