itkwidgets
itkwidgets copied to clipboard
Viewer does not properly initialize point set display
Overview
Trying to display an ITK 2D point set with "view" fails to show data with the "points" representation. The itkwidgets UI overlay can be used to set points to "sphere" representation which allows data to be displayed. An uncaught TypeError is present in the console.
Console Error
Uncaught (in promise) TypeError: Cannot read property 'length' of null at initialize_itkVtkViewer (viewer.js:932) at initialize_viewer (viewer.js:1852) at O (viewer.js:286) at viewer.js:1285
Steps to Reproduce
- Generate an ITK point set of type
itk.PointSet[itk.F,2] - Create a itkwidgets viewer object in Jupyter Notebook with
view(point_sets=[point_set])
Expected Behavior:
The point set "points" representation is visible.
Observed Behavior:
The "points" representation is not visible. The "spheres" representation can be manually selected to make points visible.
Other notes:
Bug not observed in example using numpy arrays instead of ITK point sets: https://github.com/InsightSoftwareConsortium/itkwidgets/blob/master/examples/NumPyArrayPointSet.ipynb
Erroneous behavior can be seen in ITKExamples Draft PR 189
Observed similar behavior in NumPyArrayPointSet example where parameters point_set_representations and point_set_colors are set at initialization but not reflected in the widget in Jupyter Notebook. The viewer can be polled with v.point_set_representations and v.point_set_colors to verify that the values are set correctly in the object. The TypeError included in this issue is also present in the console.