-
Notifications
You must be signed in to change notification settings - Fork 286
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
Added Mask 3D edit #822
base: master
Are you sure you want to change the base?
Added Mask 3D edit #822
Conversation
The absence of the channel was causing pytorch not to be found on a windows installation (windows 10 22H2, miniconda3, conda 24.4.0)
task_slice.py: - Checkbox for enabling the 3D mask edit - Button for performing the edit - Combobox for choosing the edit mode constants.py: - Style ID for mask edit - Operation constants and mode strings (not localized yet)
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.
I think it's better to remove the files non related to your work in this PR. Like files from folders bundle_tools, docs/devel and scripts
invesalius_cy/mask_cut.pyx
Outdated
DTYPEF64 = np.float64 | ||
ctypedef np.float64_t DTYPEF64_t | ||
|
||
ctypedef fused image_t: | ||
np.float64_t | ||
np.int16_t | ||
np.uint8_t | ||
|
||
ctypedef np.uint8_t mask_t |
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.
You can import the types from cy_my_types https://github.com/invesalius/invesalius3/blob/master/invesalius_cy/cy_my_types.pxd. Like here https://github.com/invesalius/invesalius3/blob/master/invesalius_cy/floodfill.pyx#L21
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.
Thank you, I have solved that. Please check the new code
UI modifications to allow drawing a polygon in the volume renderer - Canvas Handler for simple polygon selection and rendering; - Interaction style to create this polygon and communicate to mask edit.
d7d94e9
to
bf646f0
Compare
Functionality for using the polygon drawn in the volume viewer to cut the mask has been implemented.
bf646f0
to
7aeb2f3
Compare
I also removed that PR. I had run ruff on all files, but that is probably unneeded. |
The user can now select multiple polygons in the volume renderer to perform the edit.
Added controls in task_slice for toggling the "3D mask cut with depth" functionality. Added the button for cleaning up the polygons in the volume viewer.
Implemented with a spin control from 0 to 1. Function parameter improvements in mask_3d_edit.py
0ba3912
to
c479d4a
Compare
Fixed the problem by inverting the Y axis
3D edit of masks in InVesalius
These improvements are the result of the Google Summer of Code 2024 project for the InVesalius organization.
The proposal of this project was to include a tool for editing masks in 3D for InVesalius, which can speed up the process of reviewing and adjusting scans. For more information, please visit my blog post.
In a nutshell, the changes I have made in the project were:
Said so, when the "Edit in 3D" checkbox is toggled, the user can draw several polygons on the volume viewer, and when "Cut" is clicked, the operation will be performed. Note that several polygons can be added, as well as arbitrary complex polygons can be used.
Visual demo:
Different modes for mask cut:
Remaining Work
Future improvements