Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

learn2reg_nlst_paired_lung_ct.ipynb keypoints warping #2021

Copy link
Copy link

Description

@coolteemf
Issue body actions

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):

offset = torch.as_tensor(fixed_image.shape[-3:]).to(fixed_keypoints.device) / 2
offset = offset[None][None]
ddf_keypoints = torch.flip((fixed_keypoints - offset) / offset, (-1,))

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.