SimpleITK
SimpleITK provides a simplified interface for the algorithms and data structures
of ITK. In order to use ITK with highdicom, the SimpleITK python package must
be installed separately. Version 2.2.1 or later is required.
Volume Conversions
Highdicom supports conversions with the SimpleITK.Image class through the
highdicom.Volume.to_sitk() and highdicom.Volume.from_sitk() methods.
Like highdicom, SimpleITK uses the “LPS” convention. However, when converting to
and from NumPy arrays, SimpleITK reverses the order of dimensions. This permutation
is handled automatically by highdicom and requires no intervention by the user.
Creating a SimpleITK Image from a Volume:
import highdicom as hd
vol = hd.Volume(...)
simpleitk_image = vol.to_simpleitk()
Creating a volume from a SimpleITK Image:
import SimpleITK as sitk
import highdicom as hd
simpleitk_image = sitk.Image(...)
vol = hd.Volume.from_simpleitk(
simpleitk_image=simpleitk_image,
coordinate_system='PATIENT',
frame_of_reference_uid=None
)