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
The example above demonstrate a failure case of the central difference based
We proposed the definition of digital diffeomorphism that solves several errors that inherent in
the central difference based
The center pixel in all three cases shown above would be considered diffeomorphic
because of the checkerboard problem. The forward difference based
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
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
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}
}