Closed lchauvin closed 5 months ago
Your on the right track with registering a mouse event handler in a Vue component then setting the currentTool
:
https://github.com/Kitware/VolView/blob/main/src/components/ToolStrip.vue#L5
Don't think you need to do anything with VTK.js manipulators.
I tried to add a left-click handler to enable the crosshair on vtkTwoView, but then it interfere with the window / level tool (that also require the left-click)
Does capturing the event before the TwoView gets it work?
https://vuejs.org/guide/essentials/event-handling.html#event-modifiers
I tried that and it works for the Crosshair, but it doesn't work for the paint tool. When I use setCurrentTool(Tools.Paint), it 'activates' the paint tool (I can see it in the tool strip), but the widget is not activated (I don't see the brush, and it doesn't paint).
Interesting. Getting guess there are details we need to work out. We want to support scripted workflows and shortcuts for switching tools. Would be good to harden/fix our tool switching code. So I'm interested in supporting your work.
Perhaps best way to proceed is for you to make a fork and a branch with your changes. List steps to reproduce the issue. Link to your branch in an issue. Then when we get a sec, we can help debug?
I see. However, I'm trying to make a custom version of Volview (with slightly different behaviors, as I don't use all the tools, etc...) so I don't know if it would be relevant for other users.
Not expected a Pull Request. A good way for solve this is to share the code you tried.
Here is my code:
https://github.com/lchauvin/VolView
The crosshair is working as expected, but not the painting. Another solution would be to set the paint tool as the default one, but I'm not sure how to set it.
I tried to change in src/store/tools:58
by Tools.Paint, and it's activated, but not painting.
Maybe set the the selected tool to Paint when VolView loads and remove the @mousedown.left.stop="paintOn"
and paintOff
calls in VtkTwoView
. Then the crosshairOff
call activates paint or the last selected tool.
I tried to do that, but it didn't work. Maybe I did it wrong, but I modified src/store/tools
state: (): State => ({
currentTool: Tools.WindowLevel,
}),
to put Tools.Paint, but when VolView loads, the paint tool is 'activated' but it's not painting. I have to change tool and comeback to paint.
It seems like using setCurrentTool(Tools.Paint)
is not enough to completely activate the painting tool.
Did you remove the @mousedown.left.stop="paintOn"
?
Yes, I used the current main branch, and just modified the src/store/tools
to modify the state from Tools.WindowLevel
to Tools.Paint
Ah, Paint needs a labelmap createed, but creation of a labelmap silentty fails if there is no currentImageID
. Would be nice to fix that. Or could call useToolStore().setCurrentTool(Tools.Paint);
somewhere else as a workaround.
Would it be worth creating a labelmap automaticallt for each image when importing data ?
That would use extra memory. I'ed guess there is some logic we can fix in the .vue compoent code that creates the label map if Paint is selected upon first image load. A labelmap is created just fine if:
So we are close.
But how can we create a labelmap if the image is not loaded ? Don't we need the size of the image to create the labelmap ?
Yes, we would need to ensure the creation of the labelmap if there is none when painting. There might be an ordering issue there.
I'm currently working on some labelmap improvements, so hopefully things get easier to use. I don't agree with creating a labelmap immediately upon import, since Paul does note that it uses extra memory when you might not want to use it.
@lchauvin This PR may have solved some of our Paint at startup issues: https://github.com/Kitware/VolView/pull/507
continuing disscussion here: https://github.com/Kitware/VolView/discussions/573
Hello,
I would like to modify some interactions (like using the crosshair when right-clicking for example), without interfering with other interactions.
What would be the best way to do this ? I tried to use @click in 2d views vue, but then it creates some issues with the window / level, etc...
Should I create a mouse manipulator ?
Thank you.