Skip to main content

Usage

Vicom can parse MRI data stored in three different formats into volumes:

  • DICOM files (.dcm typically)
  • Nifti files (.nii, .nii.gz typically)
  • "Volume" files (.nii.gz + .json): our representation of a volume, which contains the entire image data and metadata

Note that storing a volume to a Nifti alone will result in a loss of metadata, as the nifti standard is not equipped to store all the metadata that is present in a DICOM/Volume.

Moreover, vicom can transform SITK images to Volumes and vice versa.

Vicom provides a central function to load these medical images:

from vicom.data_management import load_volumes
volumes = load_volumes(path="/path/to/volume/folder", file_type="VOLUME")

The following table provides an overview over what functions to use for what load/write/convert scenario:

VolumeNiftiDICOMSITK
Read file/dirload_volumes(path=..., file_type="VOLUME")load_volumes(path=..., file_type="NIFTI")load_volumes(path=..., file_type="DICOM")--
Write volume to file/dirstore_volumes_to_file(path=..., file_type="VOLUME")store_volumes_to_file(path=..., file_type="NIFTI")store_volumes_to_file(path=..., file_type="DICOM")--
Write to file in original format--nibabel.loadpydicom.dcmwritesitk.WriteImage
Convert to Volume--load_volume_from_niftiload_volumes_from_dicoms-- (convert to nifti, then sitk)
Convert from Volume--convert_volume_to_nifticonvert_volume_to_dicomconvert_volume_to_sitk

!!! warning Vicom used to provide functionality for loading data from the Orthanc instances. This functionality has been moved to the virdx_client package.

To explore volumes in a notebook, consider using the methods volume.plot() and volume.print_summary().

For documentation on the core vicom functions, see Reading/Writing. For many helpful functions to work with volumes, see Processing Volumes and Pytest fixtures.