View Issue Details

IDProjectCategoryView StatusLast Update
0004186Slicer4Core: Scripting (Wrapping, Python)public2018-05-30 00:01
ReporterpinterAssigned Tofbudin 
Status resolvedResolutionfixed 
Product VersionSlicer 4.5.0-1 
Target VersionFixed in Version 
Summary0004186: utils.getNode function does not return all nodes in case of duplicate names

If nodes are requested by ID, such as this:
not all the nodes are returned if there are duplicate names in the scene. This makes sense, as nodes are collected by the utility function by name (nodes[node.GetName()] = node), but it doesn't make sense as the request was by ID.

A potential solution could be to assign the map keys to be the IDs if matching happened with the ID, and heys can still be names if the name matched.

TagsNo tags attached.


related to 0004201 closedhastings.greer slicer.util.getNodes: Calling the function with argument return empty dictionnay 




2017-04-27 11:27

developer   ~0014440

Solved in



2017-04-27 13:34

developer   ~0014445

Excellent, thanks! I'll test and close



2017-05-04 12:39

developer   ~0014473

Johan, did you test? Please add a comment before you close! Also, according to the process, only the person who created the issue is supposed to be able to close it. Thanks!



2017-05-09 14:47

developer   ~0014476

I'll un-close it until I can test and close.
As Johan havent' answered, I assume he hasn't tested. According to the official workflow, the reporter needs to close, so after testing, I will.



2017-05-09 14:52

developer   ~0014477

Last edited: 2017-05-09 14:58

View 2 revisions

Unfortunately the issue is still present (in revision r25994). To reproduce:

import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
mrNode = sampleDataLogic.downloadMRHead()
mrNode1 = sampleDataLogic.downloadMRHead()
mrNode1.SetName('MRHead') # Make the two nodes have the same name



2018-05-30 00:01

developer   ~0015794

This has been fixed. getNodes returns a map where each value is a list. This works:

len(getNodes('vtkMRMLScalarVolumeNode*', useLists=True).values()[0])

Related Changesets

Import 2017-06-07 23:51:09: master ea356afb

2016-06-03 01:16:11


Details Diff
BUG: slicer.util.GetNodes: Support multiple node with same name. Fix 0004186

If multiple nodes share the same name, only the last node with that name
will be returned. A new parameter has been added to return a dictionary
containing, for each node name, a list of nodes, to avoid returning only
the last node with a specific name.

From: Francois Budin <>

git-svn-id: 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Base/Python/slicer/tests/ Diff File
mod - Base/Python/slicer/ Diff File

Import 2017-06-07 23:51:09: master fe589e82

2016-06-08 22:53:06


Details Diff
BUG: Fix test_getNodesMultipleNodesSharingName. See 0004186

This commit fixes a regression introduced in r25155 (BUG: slicer.util.GetNodes:
Support multiple node with same name. Fix 0004186) by properly adding the
nodes sharing the same name.

From: Jean-Christophe Fillion-Robin <>

git-svn-id: 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Base/Python/slicer/tests/ Diff File

Issue History

Date Modified Username Field Change
2016-05-06 17:10 pinter New Issue
2016-05-06 17:10 pinter Status new => assigned
2016-05-06 17:10 pinter Assigned To => jcfr
2016-06-01 10:38 fbudin Assigned To jcfr => fbudin
2016-06-01 11:52 jcfr Relationship added related to 0004201
2017-04-27 11:27 fbudin Note Added: 0014440
2017-04-27 11:33 johan.andruejol Status assigned => closed
2017-04-27 11:33 johan.andruejol Resolution open => fixed
2017-04-27 13:34 pinter Note Added: 0014445
2017-05-04 12:39 pinter Note Added: 0014473
2017-05-09 14:47 pinter Note Added: 0014476
2017-05-09 14:47 pinter Status closed => resolved
2017-05-09 14:52 pinter Note Added: 0014477
2017-05-09 14:52 pinter Status resolved => assigned
2017-05-09 14:58 pinter Note Edited: 0014477 View Revisions
2017-06-10 08:51 jcfr Changeset attached => Slicer master fe589e82
2017-06-10 08:51 jcfr Changeset attached => Slicer master ea356afb
2018-05-30 00:01 lassoan Status assigned => resolved
2018-05-30 00:01 lassoan Note Added: 0015794