# Set input data types

**URL:** <https://discourse.slicer.org/t/set-input-data-types/819>\
**Category:** Development\
**Created:** [August 3, 2017, 7:38pm UTC](https://discourse.slicer.org/t/set-input-data-types/819 "2017-08-03T19:38:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alba\_Garcia\_de\_la\_Ca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alba_garcia_de_la_ca/32/181_2.png) [@Alba\_Garcia\_de\_la\_Ca](https://discourse.slicer.org/u/Alba_Garcia_de_la_Ca)\
**Post date:** [August 3, 2017, 7:38pm UTC](https://discourse.slicer.org/t/set-input-data-types/819/1 "2017-08-03T19:38:17Z")

</div>

Operating system: ubuntu 16.04 / iOS  
Slicer version: 4.6  
Expected behavior:  
Actual behavior:

Good evening,

I guess my question is an easy or basic issue. I have been working with inputvolumes which are usually .nii extension so far. If I want to create the entry for the layout I am doing it this way:

```
the volume selectors
self.inputFrame1 = qt.QFrame(self.tfgCollapsibleButton)
self.inputFrame1.setLayout(qt.QHBoxLayout())
self.tfgFormLayout.addWidget(self.inputFrame1)
self.inputSelector1 = qt.QLabel("Input Volume: ", self.inputFrame1)
self.inputFrame1.layout().addWidget(self.inputSelector1)
self.inputSelector1 = slicer.qMRMLNodeComboBox(self.inputFrame1)
self.inputSelector1.nodeTypes = ( ("vtkMRMLScalarVolumeNode"), "" )
self.inputSelector1.addEnabled = False
self.inputSelector1.removeEnabled = False
self.inputSelector1.setMRMLScene( slicer.mrmlScene )
self.inputFrame1.layout().addWidget(self.inputSelector1)

```

Now I need to set input values as integer, float…I have seen that fields in several modules and extensions (as in the image) ![different_values](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/d/0d769068cce9ed2aff896961e4535a237748fbb5.png)  
but I have not found the code, neither how to set that fields so after introducing the value I could work with it in my python code. Would you show me where could I find this information or how to set that layout fields?

Thanks in advance!  
Regards,  
Alba

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [August 3, 2017, 8:03pm UTC](https://discourse.slicer.org/t/set-input-data-types/819/2 "2017-08-03T20:03:51Z")

</div>

Hi Alba,

What do you need exactly? Have you taken a look at [`QRadioButton Class`](http://doc.qt.io/qt-4.8/qradiobutton.html)?

---

<div class="post-metadata">

**Author:** ![Alba\_Garcia\_de\_la\_Ca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alba_garcia_de_la_ca/32/181_2.png) [@Alba\_Garcia\_de\_la\_Ca](https://discourse.slicer.org/u/Alba_Garcia_de_la_Ca)\
**Post date:** [August 5, 2017, 3:58pm UTC](https://discourse.slicer.org/t/set-input-data-types/819/3 "2017-08-05T15:58:49Z")

</div>

Hi Fernando,

I need an integer input (it can be a float) as this one:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/8/68aea4a9f0113ded63e721268f6beb93b210eead.png) so I can use this value in my code after user has introduced it. Is there any other Qt class which allow me to do that?  
Sorry I was not clear enough, but I am saving that information too because it can be helpful in the future : )

Thank you!  
Regards,  
Alba

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 5, 2017, 5:40pm UTC](https://discourse.slicer.org/t/set-input-data-types/819/4 "2017-08-05T17:40:55Z")

</div>

There are Qt and CTK widgets for this (spinbox or slider). Check out source existing Python modules in Slicer or read Qt and CTK documentation.

---

<div class="post-metadata">

**Author:** ![Alba\_Garcia\_de\_la\_Ca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alba_garcia_de_la_ca/32/181_2.png) [@Alba\_Garcia\_de\_la\_Ca](https://discourse.slicer.org/u/Alba_Garcia_de_la_Ca)\
**Post date:** [August 8, 2017, 8:17pm UTC](https://discourse.slicer.org/t/set-input-data-types/819/5 "2017-08-08T20:17:50Z")

</div>

Good evening,

Thanks! I am working with them : )

Regards!  
Alba

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [December 1, 2020, 6:55am UTC](https://discourse.slicer.org/t/set-input-data-types/819/6 "2020-12-01T06:55:21Z")

</div>

Hi Andras,  
Just a simple question but I am stuck and I am unable to identify whats wrong.

Why I am unable to load any volume in the input combo box.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/c/ac0de7cbcd296607df04765570dd860f74df327c.png)

I am using designers script for the pyhton module.

I did following in updateGUIFromParameterNode

```python
wasBlocked = self.ui.brainVolume.blockSignals(True)
self.ui.brainVolume.setCurrentNode(self._parameterNode.GetNodeReference("inputbrainVolume"))
self.ui.brainVolume.blockSignals(wasBlocked)

if self._parameterNode.GetNodeReference("inputbrainVolume"):
      self.ui.rasButton.toolTip = "Compute RAS Coordinates from MRI and convert electrode coordinates to RAS coordinates"
      self.ui.rasButton.enabled = True
    else:
      self.ui.rasButton.toolTip = "Select brain volume node"
      self.ui.rasButton.enabled = False

```

In `updateParameterNodeFromGUI(self, caller=None, event=None)` I did:

```python
    self._parameterNode.SetNodeReferenceID("inputbrainVolume", self.ui.brainVolume.currentNodeID)

```

in setup(self):

```python
self.ui.brainVolume.connect("currentNodeChanged(vtkMRMLNode*)", self.updateParameterNodeFromGUI)

```

What am I missing?

I also set the nodetype in QT designer view to vtkMRMLScalarVolumeNode

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 1, 2020, 7:01am UTC](https://discourse.slicer.org/t/set-input-data-types/819/7 "2020-12-01T07:01:20Z")

</div>

You have forgot to set the MRML scene for the node selector widget. To fix this, in Qt designer’s Signal/Slot editor you can add a connection from the top-level qMRMLWidget’s `mrmlSceneChanged(vtkMRMLScene*)` signal to the node selector’s `setMRMLScene(vtkMRMLScene*)` slot.

---

<div class="post-metadata">

**Author:** ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)\
**Post date:** [December 1, 2020, 7:45am UTC](https://discourse.slicer.org/t/set-input-data-types/819/8 "2020-12-01T07:45:52Z")

</div>

Its fixed. Thanks a lot.

How to do in script this thing.

Regards,  
Saima Safdar
