Understanding Trade-Offs in Continuous Neural Representations for Diffeomorphic Image Registration: A Comparative Study of Implicit Neural Representations and Neural Ordinary Differential Equations.
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Python · 107 lines · 3.8 KB · no license
- import torch
- import torch.nn.functional as F
- class NCC(torch.nn.Module):
- """
- NCC with cumulative sum implementation for acceleration. local (over window) normalized cross correlation.
- """
- def __init__(self, win=21, eps=1e-5):
- super(NCC, self).__init__()
- self.eps = eps
- self.win = win
- self.win_raw = win
- def window_sum_cs3D(self, I, win_size):
- half_win = int(win_size / 2)
- pad = [half_win + 1, half_win] * 3
- I_padded = F.pad(I, pad=pad, mode='constant', value=0) # [x+pad, y+pad, z+pad]
- # Run the cumulative sum across all 3 dimensions
- I_cs_x = torch.cumsum(I_padded, dim=2)
- I_cs_xy = torch.cumsum(I_cs_x, dim=3)
- I_cs_xyz = torch.cumsum(I_cs_xy, dim=4)
- x, y, z = I.shape[2:]
- # Use subtraction to calculate the window sum
- I_win = I_cs_xyz[:, :, win_size:, win_size:, win_size:] \
- - I_cs_xyz[:, :, win_size:, win_size:, :z] \
- - I_cs_xyz[:, :, win_size:, :y, win_size:] \
- - I_cs_xyz[:, :, :x, win_size:, win_size:] \
- + I_cs_xyz[:, :, win_size:, :y, :z] \
- + I_cs_xyz[:, :, :x, win_size:, :z] \
- + I_cs_xyz[:, :, :x, :y, win_size:] \
- - I_cs_xyz[:, :, :x, :y, :z]
- return I_win
- def forward(self, I, J):
- # compute CC squares
- I = I.double()
- J = J.double()
- I2 = I * I
- J2 = J * J
- IJ = I * J
- # compute local sums via cumsum trick
- I_sum_cs = self.window_sum_cs3D(I, self.win)
- J_sum_cs = self.window_sum_cs3D(J, self.win)
- I2_sum_cs = self.window_sum_cs3D(I2, self.win)
- J2_sum_cs = self.window_sum_cs3D(J2, self.win)
- IJ_sum_cs = self.window_sum_cs3D(IJ, self.win)
- win_size_cs = (self.win * 1.) ** 3
- u_I_cs = I_sum_cs / win_size_cs
- u_J_cs = J_sum_cs / win_size_cs
- cross_cs = IJ_sum_cs - u_J_cs * I_sum_cs - u_I_cs * J_sum_cs + u_I_cs * u_J_cs * win_size_cs
- I_var_cs = I2_sum_cs - 2 * u_I_cs * I_sum_cs + u_I_cs * u_I_cs * win_size_cs
- J_var_cs = J2_sum_cs - 2 * u_J_cs * J_sum_cs + u_J_cs * u_J_cs * win_size_cs
- cc_cs = cross_cs * cross_cs / (I_var_cs * J_var_cs + self.eps)
- cc2 = cc_cs # cross correlation squared
- # return negative cc.
- return 1. - torch.mean(cc2).float()
- def JacboianDet(J):
- if J.size(-1) != 3:
- J = J.permute(0, 2, 3, 4, 1)
- J = J + 1
- J = J / 2.
- scale_factor = torch.tensor([J.size(1), J.size(2), J.size(3)]).to(J).view(1, 1, 1, 1, 3) * 1.
- J = J * scale_factor
- dy = J[:, 1:, :-1, :-1, :] - J[:, :-1, :-1, :-1, :]
- dx = J[:, :-1, 1:, :-1, :] - J[:, :-1, :-1, :-1, :]
- dz = J[:, :-1, :-1, 1:, :] - J[:, :-1, :-1, :-1, :]
- Jdet0 = dx[:, :, :, :, 0] * (dy[:, :, :, :, 1] * dz[:, :, :, :, 2] - dy[:, :, :, :, 2] * dz[:, :, :, :, 1])
- Jdet1 = dx[:, :, :, :, 1] * (dy[:, :, :, :, 0] * dz[:, :, :, :, 2] - dy[:, :, :, :, 2] * dz[:, :, :, :, 0])
- Jdet2 = dx[:, :, :, :, 2] * (dy[:, :, :, :, 0] * dz[:, :, :, :, 1] - dy[:, :, :, :, 1] * dz[:, :, :, :, 0])
- Jdet = Jdet0 - Jdet1 + Jdet2
- return Jdet
- def neg_Jdet_loss(J):
- Jdet = JacboianDet(J)
- neg_Jdet = -1.0 * (Jdet - 0.5)
- selected_neg_Jdet = F.relu(neg_Jdet)
- return torch.mean(selected_neg_Jdet ** 2)
- def smoothloss_loss(df):
- return (((df[:, :, 1:, :, :] - df[:, :, :-1, :, :]) ** 2).mean() + \
- ((df[:, :, :, 1:, :] - df[:, :, :, :-1, :]) ** 2).mean() + \
- ((df[:, :, :, :, 1:] - df[:, :, :, :, :-1]) ** 2).mean())
- def magnitude_loss(all_v):
- all_v_x_2 = all_v[:, :, 0, :, :, :] * all_v[:, :, 0, :, :, :]
- all_v_y_2 = all_v[:, :, 1, :, :, :] * all_v[:, :, 1, :, :, :]
- all_v_z_2 = all_v[:, :, 2, :, :, :] * all_v[:, :, 2, :, :, :]
- all_v_magnitude = torch.mean(all_v_x_2 + all_v_y_2 + all_v_z_2)
- return all_v_magnitude
Loss.py at commit fb01066, no license · at the source
Overview
- Aragon Institute of Engineering Research (I3A), University of Zaragoza (UZ), 50018 Zaragoza, Spain; (S.R.-S.); (C.P.-L.)
- Computer Science and Systems Engineering Department, University of Zaragoza (UZ), 50018 Zaragoza, Spain
Abstract
Non-rigid image registration is a fundamental problem in medical imaging and a representative example of continuous transformation modeling in image processing. Diffeomorphic registration methods, such as Large Deformation Diffeomorphic Metric Mapping (LDDMM) and its PDE-constrained variants (PDE-LDDMM), provide mathematically grounded formulations with strong geometric guarantees for transformation quality. However, existing approaches face persistent trade-offs between numerical stability, accuracy, and computational efficiency. Recent work has explored implicit neural representations (INRs) and neural ordinary differential equations (NODEs) as flexible neural representations for modeling continuous transformations. Despite their increasing adoption, their practical behavior and limitations in diffeomorphic registration remain insufficiently understood. In this paper, we present a unified formulation of INR- and NODE-based registration methods within LDDMM and PDE-LDDMM, enabling a systematic and controlled comparison across architectures, sampling strategies, and numerical solvers. Our analysis reveals fundamental trade-offs between these approaches. In particular, we show that MLP-based INR formulations introduce significant computational overhead and rely on sampling strategies that can degrade smoothness and lead to the increased occurrence of non-diffeomorphic transformations at higher resolutions. Moreover, these approximations do not fully alleviate the computational cost, with some variants exceeding the costs of expensive classical optimization-based methods. In contrast, NODE-based formulations and downsampling strategies consistently provide transformations with more controlled Jacobian extrema while maintaining competitive computational performance. Among the evaluated methods, the original NODE-LDDMM and NODE-PDE-LDDMM formulations achieve the most favorable trade-offs between registration accuracy, geometric consistency, and computational efficiency. These findings provide clear insights into the design of neural representations for continuous transformation modeling, with practical implications for diffeomorphic registration and computational anatomy applications.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above.
yifannnwu/NODEO-DIR
fb010664d02ca6c6bca01c0f50f2de17f61d23ed, 4 February 2024Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
6 files
- Loss.py, Python, 107 lines
- Network.py, Python, 146 lines
- NeuralODE.py, Python, 184 lines
- Registration.py, Python, 197 lines
- Utils.py, Python, 88 lines
- README.md, Text, 22 lines
MIAGroupUT/IDIR
9ab3ccfbbf09dc8fc65fa848332e7d9a0b3b81b3, 23 March 2022Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
14 files
- __init__.py, Python, 1 line
- models/
__init__.py , Python, 1 line - models/
models.py , Python, 414 lines - networks/
__init__.py , Python, 1 line - networks/
networks.py , Python, 77 lines - objectives/
__init__.py , Python, 1 line - objectives/
ncc.py , Python, 46 lines - objectives/
regularizers.py , Python, 117 lines - run.py, Python, 38 lines
- utils/
__init__.py , Python, 1 line - utils/
general.py , Python, 208 lines - visualization/
__init__.py , Python, 1 line - LICENSE, License, 21 lines
- README.md, Text, 45 lines
BrainImageAnalysis/INRsRegExp
74036e2b761b252375dfda40dca3fd6bfa19deaa, 5 December 2023Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
9 files
- example_custom.ipynb, Jupyter, 240 lines
- example_functions.ipynb, Jupyter, 96 lines
- libs/
__init__.py , Python, 1 line - libs/
codes.py , Python, 1,693 lines - libs/
data.py , Python, 325 lines - libs/
losses.py , Python, 190 lines - libs/
networks.py , Python, 1,578 lines - LICENSE, License, 21 lines
- README.md, Text, 31 lines
mhglddmm/INRvsNODE_LDDMM
cc9b0536f74f33bc05dab0d46abe76c994ed6e11, 28 July 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
1 file
- LICENSE, License, 674 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 4 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 24 scripts, each with its path and the digest of its content;
- no match between paragraphs and code yet;
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- github.com/
andreasmang/ , at github.com; found in “Data Availability Statement”nirep
Data Availability Statement
The NIREP dataset is publicly available through the repository maintained by Andreas Mang https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 6 keywords, 5 funders, 38 references.
Cite
This paper
Rodriguez-Sanz, S., Paesa-Lia, C., & Hernandez, M. (2026). Understanding Trade-Offs in Continuous Neural Representations for Diffeomorphic Image Registration: A Comparative Study of Implicit Neural Representations and Neural Ordinary Differential Equations. Journal of imaging, 12(8), 384. https://
BibTeX
@article{rodriguezsanz20
author = {Rodriguez-Sanz, Salvador and Paesa-Lia, Carlos and Hernandez, Monica},
title = {{Understanding Trade-Offs in Continuous Neural Representations for Diffeomorphic Image Registration: A Comparative Study of Implicit Neural Representations and Neural Ordinary Differential Equations}},
journal = {Journal of imaging},
year = {2026},
month = aug,
volume = {12},
number = {8},
pages = {384},
publisher = {Multidisciplinary Digital Publishing Institute (MDPI)},
issn = {2313-433X},
doi = {10.3390/
url = {https://
pmid = {42645983},
pmcid = {PMC13514420}
}
RIS
TY - JOUR
AU - Rodriguez-Sanz, Salvador
AU - Paesa-Lia, Carlos
AU - Hernandez, Monica
TI - Understanding Trade-Offs in Continuous Neural Representations for Diffeomorphic Image Registration: A Comparative Study of Implicit Neural Representations and Neural Ordinary Differential Equations
T2 - Journal of imaging
J2 - J Imaging
PY - 2026
DA - 2026/
VL - 12
IS - 8
SP - 384
SN - 2313-433X
PB - Multidisciplinary Digital Publishing Institute (MDPI)
DO - 10.3390/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.3390/
"type": "article-journal",
"title": "Understanding Trade-Offs in Continuous Neural Representations for Diffeomorphic Image Registration: A Comparative Study of Implicit Neural Representations and Neural Ordinary Differential Equations",
"container-title": "Journal of imaging",
"author": [
{
"family": "Rodriguez-Sanz",
"given": "Salvador"
},
{
"family": "Paesa-Lia",
"given": "Carlos"
},
{
"family": "Hernandez",
"given": "Monica"
}
],
"container-title-short":
"volume": "12",
"issue": "8",
"page": "384",
"DOI": "10.3390/
"PMID": "42645983",
"PMCID": "PMC13514420",
"ISSN": "2313-433X",
"publisher": "Multidisciplinary Digital Publishing Institute (MDPI)",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
14
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1371/journal.pdig.0001339 [code]
- An effective deep learning algorithm for medical image registration.Journal: PLOS digital healthIn common: NiBabel, PyTorch, SciPy, 1 other tool, 9 references
- [2] doi:10.3390/jimaging12070276 [code]
- Hyperelastic Regularization for Near-Diffeomorphic Transformer-Based Brain MRI Registration.Journal: Journal of imagingIn common: SimpleITK, NiBabel, PyTorch, 3 other tools, 7 references
- [3] doi:10.1016/j.isci.2026.117446 [code]
- Volume-inflation registration (INFREG) for morphometric analysis of human focal cortical dysplasia type II.Journal: iScienceIn common: SimpleITK, NiBabel, PyTorch, 3 other tools, 3 references
- [4] doi:10.2463/mrms.mp.2024-0149 [code]
- Image Distortion Correction for Diffusion MR Imaging Using a Transformer-based U-Net.Journal: Magnetic resonance in medical sciences : MRMS : an official journal of Japan Society of Magnetic Resonance in MedicineIn common: NiBabel, PyTorch, SciPy, 2 other tools, 2 references
- [5] doi:10.1002/advs.76596 [code]
- DDSurfer: A Weakly-Supervised Dual-Stream Deep Learning Framework for Cortical Surface Reconstruction From Diffusion MRI.Journal: Advanced science (Weinheim, Baden-Wurttemberg, Germany)In common: SimpleITK, NiBabel, PyTorch, 2 other tools, 1 reference
- [6] doi:10.1162/imag.a.1366 [code]
- MICAFlow: Fast and robust MRI preprocessing bridging research neuroimaging and clinical practice.Journal: Imaging neuroscience (Cambridge, Mass.)In common: NiBabel, PyTorch, SciPy, 2 other tools, 2 references
- [7] doi:10.1038/s41467-026-76011-7 [code]
- Human cortex organizes dynamic co-fluctuations along the sensorimotor-association
axis. Journal: Nature communicationsIn common: SimpleITK, NiBabel, PyTorch, 3 other tools, systems - [8] doi:10.1007/s12021-026-09817-x [code]
- Circle of Willis-Guided Localization for Simultaneous Detection and Classification of Large Vessel Occlusions in Brain CTA.Journal: NeuroinformaticsIn common: SimpleITK, NiBabel, PyTorch, 3 other tools
- [9] doi:10.1002/hipo.70124 [code]
- Association Between Anterior Hippocampal Gyrification and Episodic Memory Performance in Neurotypical Young Adults.Journal: HippocampusIn common: SimpleITK, NiBabel, PyTorch, 3 other tools
- [10] doi:10.3390/jcm15176501 [code]
- Saliency-Curated Deep Learning for Predicting Receptor Status in Breast Cancer Brain Metastases.Journal: Journal of clinical medicineIn common: SimpleITK, NiBabel, PyTorch, 3 other tools
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 4 repositories of the authors' code, each at its verified commit and with its license, 24 scripts, and 0 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:bfe9b3fdd5ff0de0…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
