Core API¶
MedicalVolume¶
The class for medical images. |
Image I/O¶
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 easily interpretable 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.data_io.MedicalVolume.
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 |
|
Function: \(f(x) = a * e^{b*x}\). |
|
Function: \(f(x) = a1*e^{b1*x} + a2*e^{b2*x}\). |
Quantitative MR Fitter classes:
Fit quantitative values using mono-exponential fit of model \(a*exp(t/tc)\). |