View Issue Details

IDProjectCategoryView StatusLast Update
0004186Slicer4Core: Scripting (Wrapping, Python)public2018-05-30 00:01
Reporterpinter Assigned Tofbudin  
PrioritynormalSeverityminorReproducibilityalways
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
Description

If nodes are requested by ID, such as this:
slicer.util.getNodes('vtkMRMLModelNode*')
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.

Relationships

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

Activities

fbudin

fbudin

2017-04-27 11:27

developer   ~0014440

Solved in https://github.com/Slicer/Slicer/commit/ea356afb352766c74c7fe23720c6130669758841

pinter

pinter

2017-04-27 13:34

developer   ~0014445

Excellent, thanks! I'll test and close

pinter

pinter

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!

pinter

pinter

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.

pinter

pinter

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()
len(getNodes('vtkMRMLScalarVolumeNode').values())
2
mrNode1.SetName('MRHead') # Make the two nodes have the same name
len(getNodes('vtkMRMLScalarVolumeNode
').values())
1

lassoan

lassoan

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

jcfr

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 <francois.budin@gmail.com>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@25155 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Base/Python/slicer/tests/test_slicer_util_getNodes.py Diff File
mod - Base/Python/slicer/util.py Diff File

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

2016-06-08 22:53:06

jcfr

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 <jchris.fillionr@kitware.com>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@25174 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Base/Python/slicer/tests/test_slicer_util_getNodes.py 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