View Issue Details

IDProjectCategoryView StatusLast Update
0004385Slicer4Core: Scripting (Wrapping, Python)public2018-03-02 11:00
Reporterlassoan Assigned Tojcfr  
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionSlicer 4.7.0 
Target VersionSlicer 4.7.0Fixed in VersionSlicer 4.7.0 
Summary0004385: Import vtkSegmentationCorePython and vtkAddonPython by default
Description

Developers often run into the issue that instead of getting a vtkSegmentation object, they get a plain vtkObject instead:

>>> sn=slicer.vtkMRMLSegmentationNode()
>>> sn.GetSegmentation()
(vtkCommonCorePython.vtkObject)000001D142514B88

The issue is that by default vtkSegmentationCorePython is not imported. After import, the object type is correct:

>>> import vtkSegmentationCorePython as vtkSegmentationCore
>>> sn=slicer.vtkMRMLSegmentationNode()
>>> sn.GetSegmentation()
(vtkCommonCorePython.vtkSegmentation)00000227C55DDB88

Similarly, VTK objects defined in vtkAddon are not found either:

Incorrect node type returned:

>>> tn=slicer.vtkMRMLBSplineTransformNode()
>>> tn.GetTransformToParent()
(vtkFiltersHybridPython.vtkBSplineTransform)000002AD93698B88

Correct node type returned after importing vtkAddon:

>>> import vtkAddonPython as vtkAddon
>>> tn=slicer.vtkMRMLBSplineTransformNode()
>>> tn.GetTransformToParent()
(vtkCommonCorePython.vtkOrientedBSplineTransform)00000268A1BD6B28
TagsNo tags attached.

Activities

lassoan

lassoan

2017-09-29 18:18

developer   ~0015220

This issue may cause hard-to-detect errors, too - see https://discourse.slicer.org/t/segment-statistics-does-nothing/1143/3

lassoan

lassoan

2017-09-29 18:19

developer   ~0015221

See Csaba's pull request - https://github.com/Slicer/Slicer/pull/792 - we would need some help.

lassoan

lassoan

2017-10-03 22:22

developer   ~0015248

Fixed in r26418

Issue History

Date Modified Username Field Change
2017-06-19 11:49 lassoan New Issue
2017-06-19 11:49 lassoan Status new => assigned
2017-06-19 11:49 lassoan Assigned To => pinter
2017-06-19 11:49 lassoan Assigned To pinter => jcfr
2017-06-19 11:59 lassoan Category Core: Segmentation => Core: Scripting (Wrapping, Python)
2017-09-29 18:18 lassoan Note Added: 0015220
2017-09-29 18:19 lassoan Note Added: 0015221
2017-10-03 10:36 jcfr Priority normal => high
2017-10-03 22:22 lassoan Status assigned => resolved
2017-10-03 22:22 lassoan Resolution open => fixed
2017-10-03 22:22 lassoan Fixed in Version => Slicer 4.7.0
2017-10-03 22:22 lassoan Note Added: 0015248
2018-03-02 11:00 jcfr Status resolved => closed