Module that provides tools to reorganize DICOM files.

pydcmio.dcmconverter.spliter.cleanup(attribute)[source]

Get rid of illegal characters in DICOM attributes.

Replace characters that are illegal in pathnames. - Windows reserved characters - ‘_’ since it is reserved by Brainvisa - spaces, tab, newline and null character

Parameters:

attribute : unicode

Decoded string.

Returns:

unicode

String with illegal characters replaced.

pydcmio.dcmconverter.spliter.decode(attribute)[source]

Decode DICOM attributes from ISO_IR 100.

DICOM headers are routinely encoded with ISO_IR 100 which is equivalent to IS0 8859-1.

We currently expect all our DICOM headers to be encoded using ISO_IR 100. In this context DICOM string attributes returned by pydicom are 8-bit strings encoded with ISO_IR 100.

Parameters:

attribute : str

The 8-bit string to decode from ISO_IR 100.

Returns:

unicode

The decoded string.

pydcmio.dcmconverter.spliter.split_series(dicom_dir, outdir)[source]

Split all the folder Dicom files by series in different folders.

Dicom files are searched recursively in the input folder and all files are expected to be Dicom files.

Expect to split files from a single session.

Parameters:

dicom_dir: str (mandatory)

a folder containing Dicom files to organize by series.

outdir: str (mandatory)

the destination folder.