You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm working on a new registration method, and decided to use learn2reg_nlst_paired_lung_ct.ipynb as a base.
However, the conversion from keypoints from voxel coordinates to warping coordinates in the range [-1, 1] seems incorrect to me.
It is done like this (in the forward function):
But in the Warp class of Monai, the conversion is done like this:
for i, dim in enumerate(grid.shape[1:-1]):
grid[..., i] = grid[..., i] * 2 / (dim - 1) - 1
index_ordering: list[int] = list(range(spatial_dims - 1, -1, -1))
grid = grid[..., index_ordering] # z, y, x -> x, y, z
Which seems correct to me, since voxel coordinates should max out at dim - 1 for indexing.
The two are almost equivalent, except that in the notebook, image.shape is used and not image.shape - 1, so I think the notebook is wrong.
Feel free to correct me if I'm wrong, because I'm lacking info on what exactly are those keypoints and how they were obtained.
Hi @coolteemf it's possible the notebook is incorrect, could you provide a correcting code snippet? @nvahmadi could you have a look at this issue? Also the images the notebook used in the description are no longer available, would have these elsewhere? Thanks!
Activity
ericspod commentedon Sep 5, 2025
Hi @coolteemf it's possible the notebook is incorrect, could you provide a correcting code snippet? @nvahmadi could you have a look at this issue? Also the images the notebook used in the description are no longer available, would have these elsewhere? Thanks!
flecomet commentedon Sep 5, 2025
Hi @ericspod
correcting code snippet:
I added the -1 to the offset computation, which is now equivalent to the dim - 1 in the Warp function
hmeixx commentedon Sep 12, 2026
Hi @ericspod, I’m interested in working on this issue. I noticed that it has been inactive for a while. Is this issue still available to work on?
If so, I’d be happy to investigate the keypoint coordinate convention and verify whether the proposed
dim - 1fix is correct. Thanks!Fix NLST keypoint warping coordinates (Project-MONAI#2073)