Skip to content
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

get_contour_fill_mask: truncating contour data #22

Closed
clarkbab opened this issue May 17, 2021 · 6 comments · Fixed by #23
Closed

get_contour_fill_mask: truncating contour data #22

clarkbab opened this issue May 17, 2021 · 6 comments · Fixed by #23

Comments

@clarkbab
Copy link

clarkbab commented May 17, 2021

Hi there,

It seems perhaps that you're rounding the contour data too early in your code. The contour_data is changed to type 'int' here, before being converted to the pixel coordinates. I think you can just remove .astype(int) as it's converted to 'int32' further on.

This change can make a difference to the resulting mask, please see attached example where I forked the code and applied the change to the fork:

https://colab.research.google.com/drive/1anBcwIGgrGcPDbsyIDrNqgb0H9UZxJhC?usp=sharing

@clarkbab clarkbab changed the title get_contour_fill_mask: truncating countour data get_contour_fill_mask: truncating contour data May 17, 2021
@asim-shrestha
Copy link
Contributor

I forget why exactly we performed the conversion at that stage. Most likely we can just remove it but I'll bring this up with the rest of the team.

Would you mind attaching you result images directly in this issue just so that they are easier to reference?

@clarkbab
Copy link
Author

Sure, here's a 'Parotid-Left' slice with the current codebase first, and the forked codebase second:

main
fork

@clarkbab
Copy link
Author

clarkbab commented May 18, 2021

The other thing I would add, is that it might be an idea to round translated_contour_data before typecasting to avoid simply truncating floating point values.

@asim-shrestha
Copy link
Contributor

@clarkbab I've testing the rounding change and it actually lead to some less accurate results within our basic mask accuracy tests like this one. In these tests we just compare the IOU over a new mask with that of the same mask just loaded from the RTStruct. What do you think?

@clarkbab
Copy link
Author

@asim-shrestha is that the right link? Just took me to the original code we were discussing.

@clarkbab
Copy link
Author

Not sure about your tests, but it seems the ITK library rounds the voxel index according to their docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants