Non-diffeomorphic volume and non-diffeomorphic area computation
Project description
Digital diffeomorphism volume and Non-diffeomorphic area
This is an implementation of the digital diffeomorphism volume and non-diffeomorphic area computation we introduced in our paper:
Motivation
The Jacobian determinant $|J|$ of spatial transformations is a widely used metric in deformable image registration, but the details of its computation are often overlooked. Contrary to what one might expect, the commonly used central difference base $|J|$ does not reflect if the transformation is diffeomorphic or not. We proposed the definition of digital diffeomorphism that solves several errors that inherent in the central difference based $|J|$. We further propose to use non-diffeomorphic volume to measure the irregularity of 3D transformations.
An failure case of the central difference based $|J|$. The center pixel has central difference based $|J|=1$ but it is not diffeomorphic. In fact, the transformation at the center pixel has no effect on the computation of central difference based $|J|$, even if it moves outside the field of view.
Getting Started
Installation
The easiest way to install the package is through the following command:
pip install digital-diffeomorphism
To install from the source:
- Clone this repo:
git clone https://github.com/yihao6/digital_diffeomorphism.git
cd digital_diffeomorphism
- Install the dependencies:
python setup.py install
Usage
To evaluate a 3D sampling grid with dimension $H\times W\times D\times 3$
ndv grid_3d.nii.gz
This will calculate
- non-diffeomorphic volume; and
- non-diffeomorphic voxels computed by the central difference.
If the transformation is stored as a displacement field:
ndv disp_3d.nii.gz --disp
To evaluate a 2D sampling grid with dimension $H\times W\times 2$
nda grid_2d.nii.gz
This will calculate
- non-diffeomorphic area; and
- non-diffeomorphic pixels computed by the central difference.
If the transformation is stored as a displacement field:
ndv disp_2d.nii.gz --disp
Potential Pitfalls
- Several packages implement spatial transformations using a normalized sampling grid. For example, torch.nn.functional.grid_sample. In this package, we use un-normalized coordinates to represent transformations. Therefore, the input sampling grid or displacement field should be in voxel or pixel units. In case the input is normalized, it must be unnormalized prior to using this package.
Citation
If you use this code, please cite our paper.
@article{liu2022finite,
title={On Finite Difference Jacobian Computation in Deformable Image Registration},
author={Liu, Yihao and Chen, Junyu and Wei, Shuwen and Carass, Aaron and Prince, Jerry},
journal={arXiv preprint arXiv:2212.06060},
year={2022}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for digital_diffeomorphism-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | aca29dc860f140237c292e715278141febee067d12e47689d6f7f39370c60e6b |
|
MD5 | d40aa77f243e0320e9dfeca7db0907f0 |
|
BLAKE2b-256 | d9bce63d008ae3e75b57b14b69ffd9b0cdea3d5507e1ea19b57b7c7a2d8631cd |
Hashes for digital_diffeomorphism-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ee3b0f7e676295cb3a395d3f7ffec3b18a85899a05f92097813d2e3cc6a61b6 |
|
MD5 | 602e279fa8b3489c566d054f4ca984e3 |
|
BLAKE2b-256 | 320e4e0ff75ad8f6963688bd6ea86dfaab97c89331e89fcd532e0a2ec64afd72 |