import SimpleITK as sitk
%matplotlib notebook
DICOM is the standard for the communication and management of medical imaging information and related data.
DICOM is most commonly used for storing and transmitting medical images enabling the integration of medical imaging devices such as scanners, servers, workstations, printers, network hardware, and picture archiving and communication systems (PACS) from multiple manufacturers
ct_image = sitk.ReadImage('Data/ct_example.nii.gz')
mri_image = sitk.ReadImage('Data/mri_t1_example.nii.gz')
import gui
gui.MultiImageDisplay(image_list=[ct_image, mri_image], title_list=['CT Head', 'MRI T1 Head'])
Hounsfield units (HU) are a dimensionless unit universally used in computed tomography (CT) scanning to express CT numbers in a standardized and convenient form. Hounsfield units are obtained from a linear transformation of the measured attenuation coefficients 1
The process of partitioning an image into multiple segments.
Typically used to locate objects and boundaries in images.
We use thresholding (selecting a range of image intesities), but SimpleITK has a variety of algorithms
from myshow import myshow, myshow3d
ct_bone = ct_image>200
# To visualize the labels image in RGB with needs a image with 0-255 range
ct255_image = sitk.Cast(sitk.IntensityWindowing(ct_bone,0,500.0,0.,255.),
sitk.sitkUInt8)
ct255_bone = sitk.Cast(ct_bone, sitk.sitkUInt8)
myshow(sitk.LabelOverlay(ct255_image, ct255_bone), "Basic Thresholding")
Extract a polygonal surface from a 3D image. The most well known algorithm is Marching Cubes (Lorenson & Cline, SIGGRAPH 1987). The 2D version is Marching Squares, shown below
SimpleITK image processing pipeline
VTK mesh pipeline
import itkwidgets
head = sitk.ReadImage("Data/ct_head.nii.gz")
itkwidgets.view(head)
import sys, os
# download dicom2stl if it's not here already
if not os.path.isdir('dicom2stl'):
!{'git clone https://github.com/dave3d/dicom2stl.git'}
!{sys.executable} dicom2stl/dicom2stl.py -h
!{sys.executable} dicom2stl/dicom2stl.py -i 400 -o bone.stl Data/ct_head.nii.gz
from dicom2stl.utils import vtkutils
mesh = vtkutils.readMesh('bone.stl')
itkwidgets.view(head, geometries=[mesh])