# GetNodeByClass(vtkMRMLScalarVolumeNode) returns vtkMRMLMultiVolumeNode

**URL:** https://discourse.slicer.org/t/getnodebyclass-vtkmrmlscalarvolumenode-returns-vtkmrmlmultivolumenode/27960
**Category:** Development
**Created:** [February 22, 2023, 12:23am UTC](https://discourse.slicer.org/t/getnodebyclass-vtkmrmlscalarvolumenode-returns-vtkmrmlmultivolumenode/27960 "2023-02-22T00:23:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pearsonm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pearsonm/32/18514_2.png) [@pearsonm](https://discourse.slicer.org/u/pearsonm)
#### Post date: [February 22, 2023, 12:23am UTC](https://discourse.slicer.org/t/getnodebyclass-vtkmrmlscalarvolumenode-returns-vtkmrmlmultivolumenode/27960/1 "2023-02-22T00:23:49Z")

</div>

Hi,

I am writing a module to process dynamic nuclear medicine images and I have an issue that might be a bug.

I load 2 DICOM datasets as vtkMRMLScalarVolumeNode but another module also creates a vtkMRMLMultiVolumeNode.

If I try to filter by GetNodesByClass all 3 nodes are returned. Is this the expected behavior?

```auto
>>> slicer.mrmlScene.GetNodesByClass('vtkMRMLMultiVolumeNode').GetNumberOfItems()
1
>>> slicer.mrmlScene.GetNodesByClass('vtkMRMLScalarVolumeNode').GetNumberOfItems()
3

```

Tested on Slicer stable and 5.3.0-2023-02-21

Mark

---

<div class="post-metadata">

### Author: ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)
#### Post date: [February 22, 2023, 1:44am UTC](https://discourse.slicer.org/t/getnodebyclass-vtkmrmlscalarvolumenode-returns-vtkmrmlmultivolumenode/27960/2 "2023-02-22T01:44:19Z")

</div>

What you’ve discovered is that vtkMRMLMultiVolumeNode is derived from vtkMRMLScalarVolumeNode. It is a type of vtkMRMLScalarVolumeNode.

If in your module you utilize a qMRMLNodeComboBox for selecting certain nodes in the mrml scene, you can specify to have show child nodes set to off which would exclude vtkMRMLMultiVolumeNodes from populating in this widget.

> <https://github.com/Slicer/Slicer/blob/a5f75351073ef62fd6198d9480d86c0009d70f9b/Libs/MRML/Widgets/qMRMLNodeComboBox.h#L125>

I don’t believe the GetNodesByClass method has an option to exclude child nodes from being found. Therefore you might have to do this exclusion on your own afterwards.

---

<div class="post-metadata">

### Author: ![pearsonm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pearsonm/32/18514_2.png) [@pearsonm](https://discourse.slicer.org/u/pearsonm)
#### Post date: [February 22, 2023, 3:32am UTC](https://discourse.slicer.org/t/getnodebyclass-vtkmrmlscalarvolumenode-returns-vtkmrmlmultivolumenode/27960/3 "2023-02-22T03:32:51Z")

</div>

Thanks,

In that case I will add a filter for ‘MultiVolume’ in GetClassName on my list of nodes.
