fedorov / MultiVolumeImporter

A 3D Slicer module to support import of multi-volume data from non-DICOM sources, and provide plugin for importing such data from images saved in DICOM.
http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/MultiVolumeImporter
Other
9 stars 25 forks source link

BUG: fix double array allocation #31

Closed pieper closed 6 years ago

pieper commented 6 years ago

Calling Allocate on a vtkDoubleArray resets the number of tuples, leading to the error message below when trying to insert.

This fix uses SetNumberOfTuples, which also does the allocation to for the correct number of tuples.

Traceback (most recent call last): File "/private/tmp/Slicer.app/Contents/lib/Slicer-4.9/qt-scripted-modules/MultiVolumeImporter.py", line 191, in onImportButtonClicked self.read4DNIfTI(mvNode, niftiFiles[0]) File "/private/tmp/Slicer.app/Contents/lib/Slicer-4.9/qt-scripted-modules/MultiVolumeImporter.py", line 357, in read4DNIfTI volumeLabels.SetComponent(i, 0, frameId) ValueError: expects 0 <= tupleIdx && tupleIdx < GetNumberOfTuples()

See:

https://www.vtk.org/doc/nightly/html/classvtkAbstractArray.html#a4d40ec8fbe0eb6c0752ca7890af1ba33