Skip to content

Commit 2733afb

Browse files
committed
Fix NLST keypoint warping coordinates
1 parent b3c6c99 commit 2733afb

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎3d_registration/learn2reg_nlst_paired_lung_ct.ipynb‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,11 +660,15 @@
660660
" # warp vectors for keypoints (optional)\n",
661661
" if fixed_keypoints is not None:\n",
662662
" with torch.no_grad():\n",
663-
" offset = torch.as_tensor(fixed_image.shape[-3:]).to(fixed_keypoints.device) / 2\n",
663+
" offset = (torch.as_tensor(fixed_image.shape[-3:]).to(fixed_keypoints.device) - 1) / 2\n",
664664
" offset = offset[None][None]\n",
665665
" ddf_keypoints = torch.flip((fixed_keypoints - offset) / offset, (-1,))\n",
666666
" ddf_keypoints = (\n",
667-
" F.grid_sample(ddf_image, ddf_keypoints.view(batch_size, -1, 1, 1, 3))\n",
667+
" F.grid_sample(\n",
668+
" ddf_image,\n",
669+
" ddf_keypoints.view(batch_size, -1, 1, 1, 3),\n",
670+
" align_corners=True,\n",
671+
" )\n",
668672
" .view(batch_size, 3, -1)\n",
669673
" .permute((0, 2, 1))\n",
670674
" )\n",

0 commit comments

Comments
 (0)