# Implementing Widgets for Selecting Nodes of Type Segment and Beam

**URL:** <https://discourse.slicer.org/t/implementing-widgets-for-selecting-nodes-of-type-segment-and-beam/40359>\
**Category:** Development\
**Created:** [November 24, 2024, 5:02pm UTC](https://discourse.slicer.org/t/implementing-widgets-for-selecting-nodes-of-type-segment-and-beam/40359 "2024-11-24T17:02:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahrokh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahrokh/32/1499_2.png) [@shahrokh](https://discourse.slicer.org/u/shahrokh)\
**Post date:** [November 24, 2024, 5:02pm UTC](https://discourse.slicer.org/t/implementing-widgets-for-selecting-nodes-of-type-segment-and-beam/40359/1 "2024-11-24T17:02:09Z")

</div>

Hello Dear Developers and Users,

My question is probably very basic, so I would appreciate your guidance Or guide me on which tutorial I should refer to in order to implement functions for widgets that select nodes of different types, such as Beam, Segment, Volume, or Model.

I want to develop a module containing a widget for selecting one of the Beam nodes under the **RTPlan** node and a widget for selecting one of the Segment nodes under the **Segmentation** node. To do this, I created an Extension called **moduleRTPlan** in the _Extension Wizard_. Then, I added a module named **BeamTry01** to **moduleRTPlan**. Next, I switched to the _BeamTry01_ module in the _Example_ Category. At this stage, I clicked on **Edit UI** to enter the **Qt Designer** environment and removed all the default widgets that were created. Now, I have two questions:

1. From the **Slicer [MRML Widget]** list, which widget is appropriate for a **Beam** node?

2. I understand that to create a widget for selecting one of the **Segments** under the **Segmentation** node, I should use a widget named **qMRMLSegmentSelectorWidget**.

In the following figure, you can see that I used **qMRMLSegmentSelectorWidget** to select a Segment from the Segmentation node. To select a Beam from the available list for the RTPlan node, I used the **ctkCollapsibleButton** widget. However, unfortunately, the Segment selection widget is completely inactive, and the Beam selection widget does not show any Beams.

 ![Picture](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/f/7fa520c8c27cc3febeeaf78e89d3e1e6cb49e271.png)

Please guide me.

Best regards.  
Shahrokh

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)\
**Post date:** [November 30, 2024, 12:16pm UTC](https://discourse.slicer.org/t/implementing-widgets-for-selecting-nodes-of-type-segment-and-beam/40359/2 "2024-11-30T12:16:47Z")

</div>

If you are creating a new module, your main module widget should be derived from `qSlicerModule`.

Then you must connect signal `mrmlSceneChanged(vtkMRMLScene*)` from your module widget to the slot `setMRMLScene(vtkMRMLScene*)` of widgets where you want to choose a node or a segment of ROI (see `Signal/Slot editor` in Qt Designer).

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/c/ac903ef143794c13be3ce5a370ab6aae25e9f7dd.png)

You can check ui files using Qt designer for example in the `ExternalBeamPlanning` module ([/Resourses/UI/qSlicerExternalBeamPlanning.ui](https://github.com/SlicerRt/SlicerRT/blob/master/ExternalBeamPlanning/Resources/UI/qSlicerExternalBeamPlanningModule.ui)).

For qMRMLNodeComboBox widgets you should set a required types of nodes (vtkMRMLRTPlanNode or vtkMRMLRTBeamNode) you want to choose from.

---

<div class="post-metadata">

**Author:** ![shahrokh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahrokh/32/1499_2.png) [@shahrokh](https://discourse.slicer.org/u/shahrokh)\
**Post date:** [December 1, 2024, 6:51am UTC](https://discourse.slicer.org/t/implementing-widgets-for-selecting-nodes-of-type-segment-and-beam/40359/3 "2024-12-01T06:51:49Z")

</div>

Dear Mikhail Polkovnikov,

Thank you very much for your guidance. As mentioned in my issue titled [Understanding UI Editing and Python File Generation in 3DSlicer with Qt Designer - Development - 3D Slicer Community](https://discourse.slicer.org/t/understanding-ui-editing-and-python-file-generation-in-3dslicer-with-qt-designer/40369/5), the roadmap I have set for myself is to familiarize with the implementation of the components of the widgets that I need to use in my module. Then, I should connect these components together in the way you suggested. Completing these steps is time-consuming for me, but I will do my best to complete them.  
Best regards.  
Shahrokh
