How to add a GUI panel to the Slicer VR scene

Hi there,

I’m a beginner in 3D Slicer and I am learning how to develop modules to implement my own workflow.
Currently, I use the ‘Extension Wizard’ to create a simple module for extracting the surface of image data (Other features are still in development).
What I’d like to do next is to transfer my module from the desktop mode to the VR scene created by Slicer VR.
However, I’m still not sure about the feasibility of adding Qt components/widgets or GUI panels to the VR scene to achieve the same functions as my desktop module.
In other words, the following figure is the module (a python scripted module) I have created so far. How can I transfer it to the VR scene next?


What should I do, do you have any suggestions or useful tutorials about my question?
Thank you very much in advance!!!

Best regards,
Charles

Or Is it possible to add VTKWidgets(like the ‘vtkSliderWidget’ and the ‘vtkSliderRepresentation3D’ for creating a slider) to the VR scenes created by Slicer VR:

VTKwidgets

and the above VTKwidgets need to achieve the same function as the widgets in the UI of desktop mode?

In other words, the following figure is the module (a python scripted module) I have created so far. How can I transfer it to the VR scene next?

Because the module I created will only include the sliders/buttons/combo boxes/checkboxes, so are there any suggestions to achieve/transfer these to the VR scene?

I recall that @cpinter and others were working on this, but I’m not sure of the status.

If you are interested in collaborating on these topics, Project Week is coming up. On Jan 11 there’s going to be a discussion of VR/AR related topics at the prep call (10 am EST).

1 Like

W have made good progress with the widget, you can see it in this branch. Now we’re working on the interactions with this widget using a laser pointer (propagating move events, clicks, etc.). @dgmato is currently working on it, let us know if you’d like to contribute in some way.

1 Like

Hello Piper and Pinter,
Thank you for your quick reply!
That’s good to know that Project week is coming soon! I’d like to join in then.
And I also notice from GitHub that you are making a lot of effort for this.
I learned from the following link:
https://github.com/KitwareMedical/SlicerVirtualReality/issues/43

https://github.com/KitwareMedical/SlicerVirtualReality/blob/master/VirtualReality/Resources/UI/qSlicerVirtualRealityModuleWidget.ui

https://github.com/cpinter/VtkQWidgetTest

And I also notice that there is indeed a folder called ‘Widgets’
Does it mean that there are already available VR menu widgets here?
How can I see these menu widgets (like the widgets you’ve implemented for the segment editor module) in the VR scene?
For example, as shown in the figure below, is this menu can be seen in the VR scene? How can I activate it in VR? Thank you so much!
https://github.com/cpinter/SlicerVirtualReality/pull/5

Not sure if you have seen the branch I linked to above. That is the latest work we have in this topic.

These are prototypes.

This is work in progress. Please hang on or if you’d like to contribute let us know.

Hello Pinter,
Yes, I really want to learn how to add some widgets to the VR scene and achieve the same function as the widgets in desktop mode.
If possible, can I test the latest work you’ve done (The UI widgets available in the VR scene so far)? How to do/run it?
I notice that there’s a building instruction:
https://github.com/cpinter/SlicerVirtualReality/blob/gui-widgets-module/DeveloperGuide.md

Just to make sure: Does it mean that if I follow it to build this VR module locally, then I can see/activate the menu widgets you’ve implemented so far? Or in this way, can I also make some adjustments/modifications to it? Am I correct?
Because when I install the Slicer VR and run it in 3D Slicer, there is no menu widgets in the VR scene.
And could you please describe the feasibility of adding some widgets such as buttons and sliders to the VR scene to realize the function of a custom module?
For example, adding a slider to the VR scene of Slicer VR to adjust the threshold of the volume rendering image? I think this is a good practice for me to learn how to contribute to Slicer VR.
Thank you so much!

Hello @cpinter ,
This discussion is very exciting!
I am new to 3D Slicer, and I also have a similar demand as @CharlesChen.
I’ve learned that Slicer supports VTK, and it seems that we can call any VTK classes and abilities in Slicer. Meanwhile, I also noticed that some useful VTK classes like ‘vtkOpenVRMenuWidget’ and ‘vtkQWidgetRepresentation’ can be used to create 3D widgets to display a menu in VR.
Therefore, I’d like to know is it possible to create and add a widget like a button to the VR scene by running python script in Slicer? How can I learn this and reach this goal? Where should I start?
Thank you!

It is work in progress, please keep an eye on the above issue and branch.