Core API (dosma.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. |
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
dosma.core.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 dosma orientation format. |
|
Convert standard dosma orientation format to Nibabel orientation. |
Image Registration
For details on using registration, see the Registration Guide.
Register moving image(s) to the target. |
|
Apply transform(s) to moving image using transformix. |
|
Symlinks elastix/transformix files to the dosma library. |
|
Unlinks all elastix/transformix files in the dosma library. |
Fitting
For details on using fitting functions, see the Fitting Guide.
General fitting functions:
Use non-linear least squares to fit a function |
|
Use linear least squares to fit a polynomial of degree |
|
Function: \(f(x) = a * e^{b*x}\). |
|
Function: \(f(x) = a1*e^{b1*x} + a2*e^{b2*x}\). |
Fitter classes:
The class using non-linear least squares to fit a function to data. |
|
The class using linear least squares to fit a polynomial to data. |
|
Fit quantitative values using mono-exponential fit of model \(y=a*exp(-x/tc)\). |
Device
Device class. |
|
Get Device from input array. |
|
Move input to device. |
Preferences
A pseudo-Singleton class implementation to track preferences. |
|
A pseudo-Singleton class implementation to track preferences. |
(BETA) Quantitative Values
Utilities for different quantitative parameters. Note, this feature is in beta and will likely change in future releases.
This class handles tracking volumes associated with different quantitative values. |
|
T1Rho MRI parameter. |
|
T2 MRI parameter. |
|
T2Star MRI parameter. |