-
Notifications
You must be signed in to change notification settings - Fork 1
FIX: Converting mm to voxels wrong for dilation in registration #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -187,7 +187,7 @@ def set_fixed_mask(self, fixed_mask: Optional[itk.Image]) -> None: | |
| if self.mask_dilation_mm > 0: | ||
| imMath = ttk.ImageMath.New(self.fixed_mask) | ||
| imMath.Dilate( | ||
| int(self.fixed_image.GetSpacing()[0] / self.mask_dilation_mm), 1, 0 | ||
| int(self.mask_dilation_mm / self.fixed_image.GetSpacing()[0]), 1, 0 | ||
| ) | ||
|
Comment on lines
187
to
191
|
||
| self.fixed_mask = imMath.GetOutputUChar() | ||
|
|
||
|
|
@@ -320,7 +320,7 @@ def register( | |
| if self.mask_dilation_mm > 0: | ||
| imMath = ttk.ImageMath.New(new_moving_mask) | ||
| imMath.Dilate( | ||
| int(moving_image.GetSpacing()[0] / self.mask_dilation_mm), 1, 0 | ||
| int(self.mask_dilation_mm / moving_image.GetSpacing()[0]), 1, 0 | ||
| ) | ||
|
Comment on lines
320
to
324
|
||
| new_moving_mask = imMath.GetOutputUChar() | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change fixes a unit conversion that affects mask preprocessing across all registrars, but there are no tests asserting the mm→voxel dilation behavior (search in tests found no references to mask_dilation). Adding a focused unit test that checks the computed voxel radius for a known spacing would help prevent regressions.