Page MenuHomePhabricator

[MultiLabel Segmentation] Paint tool does not show the correct contour color
Closed, ResolvedPublic

Description

Typically our manual segmentation tools show a green contour for the "area-to-be-masked" when adding an area to the label and a red contour when removing an area from the label.
This also works when using "STRG", see Add / Erase tools.

The paint tool also shows a green / red circle, depending on the brush size and if the user uses "STRG" or not.
However, when moving the mouse the "area-to-be-masked" is outline in red, regardless of the brush mode (add or remove).

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

kalali triaged this task as Normal priority.Feb 17 2022, 5:40 PM
kalali created this task.

Inside void mitk::PaintbrushTool::CheckIfCurrentSliceHasChanged(const InteractionPositionEvent *event) there is a call m_WorkingNode->SetProperty("color", workingNode->GetProperty("color"));, where the m_WorkingNode is the node that contains the data of the already painted (but not confirmed - no mouse released) segmentation mask.
workingNode is the currently selected segmentation node. As mentioned in T29013: [MultiLabel Segmentation] LabelSetImage nodes unnecessarily have a color property, the color of a labelsetimage node is defined, but typically not used / cannot be easily changed by the user / has nothing to do with the label colors. It is set to red as default, that's why the feedback contour color of the to-be-painted area is red, regardless of the current brush mode (paint or wipe).

I verified this by changing the node color using the Properties View, which leads to a different feedback contour color.

I added a fix, which still shows a red / green circle as a brush, but uses the active label color for the outline of the "area-to-be-masked" /"area-to-be-removed".

kalali added a revision: Restricted Differential Revision.Mar 3 2022, 3:34 PM

I added a fix, which still shows a red / green circle as a brush, but uses the active label color for the outline of the "area-to-be-masked" /"area-to-be-removed".

But isn't that inconsistent again with the other tools that use green/red in this case?

I added a fix, which still shows a red / green circle as a brush, but uses the active label color for the outline of the "area-to-be-masked" /"area-to-be-removed".

But isn't that inconsistent again with the other tools that use green/red in this case?

Yeah, the more I think about it the more I'm convinced it should be handled the same way it is handled with e.g. the simple add / subtract tool.

I updated the differential. The paint tool behaves differently since it has two contours: The one for showing the "brush", which is green or red. And the one showing the already brushed area. I wanted to show the already brushed area with the corresponding label color.
But you mentioned that this is somehow not in line with the other tools. However, the other tools (e.g. add, region growing, fill) don't have two contours. That's also the reason why the code for the paintbrush tool is different: There are two nodes, one is the typical feedback node that shows the contour of the brush, the other one is a paintbrush-tool-inherent preview-node (binary image), which stores the already drawn but not yet confirmed contour / segmentation mask.

I took a look into the tool and compared it with other interactive drawing tools and I think it's worth refactoring the class, but it also not a quick thing to do.
So I went with a straightforward solution in the updated differential but I think this can be done cleaner if we rafactor the paint brush tool.

This bug is fixed. Refactoring of the Paintbrush tool is done in T29033: [Segmentation] Paint tool needs to be refactored.

kalali claimed this task.