Image formats
There are numerous image formats for medical images: DICOM, Nifti, NRRD, among others. The de-facto standard format for MRI images coming from the PACS is DICOM. In vicom however, we internally convert DICOM images to Nifti images for easier processing. In the process, the coordinate and orientation systems are also transformed to conform to the Nifti standard. Pixel arrays inside Volume objects are therefore most likely appearing rotated and flipped. We have decided to follow the nifti standard orientation internally, but we are re-orienting images into the DICOM-specific format once we export our data to DICOMs.
For a more in-depth explanation of coordinate systems and how they are used in different standards check out our intranet page Medical imaging.
We provide functions to transform a Volume to a Nifti image, a SITK image, or a DICOM image:
::: vicom.nifti.convert_volume_to_nifti options: show_root_heading: true
::: vicom.sitk.convert_volume_to_sitk options: show_root_heading: true
::: vicom.dicom.convert_volume_to_dicom options: show_root_heading: true
Exporting Volumes to DICOM
A core functionality of VICOM is the ability to export Volumes to DICOM files. We use this feature extensively as we aim to upload every processed image to the Orthanc PACS and re-use it later on from there.
Any DICOM that is exported from VICOM will adhere to our "Virdx-specific" schema and will not follow the structure the original DICOM had. This makes us less dependent on the vendor-specific implementation of the DICOM standard and ensures that we have consistent DICOM files available for our internal use.
Some tags, such as deltas for DWI acquisitions are not supported by the DICOM standard and therefore not commonly stored in DICOM tags. If we have delta information available, we store them in private tags. A full list of our private tags can be found in this Google Sheet.
When exporting a volume to DICOM, we first ensure that attributes of the volume
that are relevant for the DICOM standard are correctly set (e.g. the
BitsAllocated or the PhotometricInterpretation tags - these have no value for
our typical processing of MRIs, but the DICOM standard requries these tags to
be set in a specific way to ensure compatibility with other DICOM instances).
These tags are set in vicom.dicom.write.dicom_conformity.
We then create a dictionary describing the structure of the DICOM file we want to create. This dictionary is populated with the volume's attributes and then converted into a valid pydicom.Dataset object. Private tags are then written, and file metadata information set. Finally, the pixel data is written to the DICOM file.