Core
MedicalVolume
The class for medical images. |
Numpy Routines
Numpy operations that are supported on MedicalVolumes.
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
Round medical image pixel data (and optionally affine) to the given number of decimals. |
|
Clip the values in the array. |
|
Concatenate medical images. |
|
Expand across non-spatial dimensions. |
|
Determine if two medical volumes may share memory. |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
Implementation of |
|
Determine if two medical volumes share memory. |
|
Squeeze non-spatial dimensions. |
|
Stack medical images across non-spatial dimensions. |
|
See |
|
See |
|
See |
|
See |
Standard universal functions that act element-wise on the array are also supported. A (incomplete) list is shown below:
numpy.power |
numpy.sign |
numpy.remainder |
numpy.mod |
numpy.abs |
numpy.log |
numpy.exp |
numpy.sqrt |
numpy.square |
numpy.reciprocal |
numpy.sin |
numpy.cos |
numpy.tan |
numpy.bitwise_and |
numpy.bitwise_or |
numpy.isfinite |
numpy.isinf |
numpy.isnan |
numpy.floor |
numpy.ceil |
Image I/O
Read MedicalVolume(s) from file. |
|
Write MedicalVolume to file. |
|
A class for reading NIfTI files. |
|
A class for writing volumes in NIfTI format. |
|
A class for reading DICOM files. |
|
A class for writing volumes in DICOM format. |
|
A class for reading DICOMs from HTTP requests with DICOMweb support. |
Image Orientation
Standardized orientation convention and utilities.
Medical image orientation convention is library and image format (DICOM, NIfTI, etc.) dependent and is often difficult to interpret. This makes it challenging to intelligently and rapidly reformat images.
We adopt a human readable orientation representation for the dimensions and define utilities to convert between different orientation formats from current libraries (Nibabel, PyDicom, ITK, etc).
Orientations are represented by string axis codes:
"LR": left to right;"RL": right to left"PA": posterior to anterior;"AP": anterior to posterior"IS": inferior to superior;"SI": superior to inferior
A MedicalVolume object with orientation ("SI", "AP", "LR") has an
array where the first dimension spans superior -> inferior, the second dimension
spans anterior -> posterior, and the third dimension spans left -> right. Voxel
at (i,j,k) index (0,0,0) would be the (superior, anterior, left) corner.
In many cases, images are not acquired in the standard plane convention, but rather in a rotated frame. In this case, the orientations correspond to the closest axis the a particular dimension.
Two general conventions are followed:
All orientations are in patient voxel coordinates. Image data from (i, j, k) corresponds to the voxel at array position
arr[i,j,k].Left: corresponds to patient (not observer) left, right: corresponds to patient (not observer) right.
We adopt the RAS+ standard (as defined by NIfTI) for orienting our images.
The + in RAS+ indicates that all directions point to the increasing direction.
i.e. from -x to x:.
Image spacing, direction, and global origin are represented by a 4x4 affine matrix (\(A\)) and is identical to the nibabel affine matrix (see nibabel). The affine matrix converts pixel coordinates (i, j, k) into world (NIfTI) coordinates (x, y, z).
For example,
For details on how the affine matrix is used for reformatting see
voxel.MedicalVolume.
Convert orientation, spacing, and origin data into affine matrix. |
|
Get indices for reordering planes from |
|
Get indices to flip from |
|
Convert Nibabel orientation to the standard voxel orientation format. |
|
Convert standard voxel orientation format to Nibabel orientation. |
Device
Device class. |
|
Get Device from input array. |
|
Move input to device. |