Highdicom Release 0.28.0 with ITK/SimpleITK and NiBabel Interoperability and Legacy Converted Enhanced Image Conversion

I am happy to announce that a couple of weeks ago we released a new version of our highdicom Python library, version 0.28.0 (and more recently 0.28.1) with major features that may be of interest to this community.

Two features in particular worth highlighting are:

Integration with ITK, SimpleITK, and NiBabel

Highdicom has always been a powerful tool for creating and reading DICOM objects, but until now it has existed in a self-contained silo. It worked well if you just wanted to keep everything in DICOM from start to end and use only the capabilities of highdicom itself or plain NumPy operations, but the minute you needed to reach out for more powerful image processing/AI tools elsewhere in the ecosystem, you had to write fiddly “glue code” and handle type conversions and spatial metadata conversions yourself. Well, with this release we are starting to change that, starting with ITK, SimpleITK and NiBabel.

Highdicom’s Volume class, which combines a voxel array and its spatial affine matrix, provides the bridge. It now has methods to convert to and from ITK, SimpleITK, and NiBabel image classes. This allows you to use highdicom’s advanced capabilities for DICOM reading (particularly for Segmentations and Parametric Maps) and use the resulting object in downstream pipelines. For example:

import highdicom as hd

# Here we load in an example DICOM segmentation from the highdicom repo test
# data that contains two segments. Parameters of the get_volume() method
# control the volume that is extracted. For example, here we choose one of the
# two segments before converting to ITK
itk_image = (
    hd.seg.segread("data/test_files/seg_image_ct_binary_overlap.dcm")
    .get_volume(
        segment_numbers=[2],
        relabel=True,
        combine_segments=True,
    )
    .to_itk()
)

Furthermore, you can also easily take a result from a processing pipeline in ITK/SimpleITK and encode it in a DICOM Segmentation or Parametric Map, and highdicom handles transferring spatial metadata, performing coordinate system conversions, etc for you. See the ITK, SimpleITK, and NiBabel doc pages for more examples.

We are currently planning similar integrations for monai and pynrrd. Please reach out to us on our issue tracker if you have feedback or suggestions for other integrations

Legacy Converted Enhanced Images

Legacy Converted Enhanced images are a type of DICOM object that is designed to take “legacy” series of single frame objects (such as are commonly found in CT, MRI, and PET), and convert them to a single multi-frame DICOM object that is more convenient to store and work with. Technically, highdicom has provided routines to convert legacy CT/MRI/PET images to Legacy Converted Enhanced images for many years, but the implementation had some important limitations and was not widely advertised as a result.

In this latest releases, we have rewritten the implementation from the ground up to make it considerably more capable, extensible, and carefully tested. We have also provided a new documentation page describing the capabilities of the new implementation. We are currently working on improving this implementation to additionally harmonize free-text and private attributes from various vendors into standardized attributes. This is challenging undertaking and we are particularly seeking community involvement to compile a list of rules for doing this. Please reach out on the issue tracker if you can help!

About Highdicom

Highdicom is a pure Python package for working with DICOM objects, particularly (but not only) derived objects such as Segmentations, Parametric Maps, and Structured Reports. It can be installed directly from PyPI (pip install highdicom). You can find the highdicom repo here and the full documentation with API reference and user guide here.

Many thanks to all the highdicom contributors, especially Mason Cleveland and Andrey Fedorov for their work and support for this release!

2 Likes