Digital diffeomorphism: Non-diffeomorphic volume and non-diffeomorphic area computation
Project description
Digital Diffeomorphism: Non-diffeomorphic volume and Non-diffeomorphic area
This is an implementation of the non-diffeomorphic volume and non-diffeomorphic area computation we introduced in our paper:
Motivation
The Jacobian determinant $|J|$ of spatial transformations is a widely used measure in deformable image registration, but the details of its computation are often overlooked. Contrary to what one might expect, when approximated using the central difference, the number of pixels/voxels with negative $|J|$ does not reflect if the transformation is diffeomorphic or not.
The example above demonstrate a 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.
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 (NDV) and non-diffeomorphic area (NDA) to measure the irregularity of 3D/2D transformations. The proposed NDV and NDA also measures the severity of the irregularity whereas the central difference approximated $|J|$ is only a binary indicator.
The center pixel in all three cases shown above would be considered diffeomorphic because of the checkerboard problem. The forward difference based $|J|$ is able to identiy that (b) and (c) exhibit folding, but only NDA can provide the observation that the non-diffeomorphic space caused by the transformation shown in (c) is larger than (b). The transformation shown in (b) is obviously more favorable than the one shown in (c) in terms of regularity. As such it is important for us to be able to draw distinctions between there two senarios.
Getting Started
Installation
The easiest way to install the package is through the following command:
pip install digital-diffeomorphism
To install from the source:
git clone https://github.com/yihao6/digital_diffeomorphism.git
cd digital_diffeomorphism
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
Example inputs can be found at https://iacl.ece.jhu.edu/index.php?title=Digital_diffeomorphism
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
File details
Details for the file digital_diffeomorphism-1.0.1.tar.gz
.
File metadata
- Download URL: digital_diffeomorphism-1.0.1.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c962235326196959a222696984585dfe8ffe2fc621a087fb3a8ccb24edb5b02 |
|
MD5 | 6d445d0adeacbaf40dcd933fe80462d3 |
|
BLAKE2b-256 | 83e874d5eb66b5ad4746e0b816143ca13294183c873ecc14676f4b0b956f165c |
File details
Details for the file digital_diffeomorphism-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: digital_diffeomorphism-1.0.1-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3034be0034ef939bb0296bdfe70f2003b8cdb44ad3ded833471c6363992b46be |
|
MD5 | 62339cd035bb808e0a228351a4ac1ff2 |
|
BLAKE2b-256 | 86a021216fed37f9fbb93ea724ee8ccd59d2b0b00642b80637ba4e45366bdc10 |