[vtkusers] Faster way to create a vtkImageData with a single value

hchen hjchen.work at gmail.com
Mon Jan 30 16:40:59 EST 2017

it may be faster if you fill the image matrix in Python and then use
vtkImageImportFromArray to get it into vtk. it would something like:

from vtk.util import vtkImageImportFromArray as viifa
a = np.ones( (3, 4, 5), dtype=np.uint8 ) * BackgroundValue
f = viifa.vtkImageImportFromArray()
f.SetArray( a )
f.SetDataOrigin( ... )
f.SetDataSpacing( ... )
f.SetDataExtent( ... )
vimg = f.GetOutput()

--good luck.


View this message in context: http://vtk.1045678.n5.nabble.com/Faster-way-to-create-a-vtkImageData-with-a-single-value-tp5741978p5741988.html
Sent from the VTK - Users mailing list archive at Nabble.com.

More information about the vtkusers mailing list