[vtkusers] how to write several scalars or vectors in ImageData

Zhang Wei waynezw0618 at gmail.com
Wed Jul 2 00:08:27 EDT 2014


Hi all
I noticed that  in vtk one need to active a scalar/vector for the following filers. but I don’t know it works for output. I am using python for output my fields with several scalars as following:
image=vtkImageData()
image.SetDimensions(N1,N2,N3)
image.SetNumberOfScalarComponets(3)

image.GetPointData().AddArray(scalar1)
image.GetPointData().AddArray(scalar2)
image.GetPointData().AddArray(scalar3)

write=vtk.vtkXMLImageDataWriter()
writer.SetFileName(“test”)
writer.SetInput(image)
writer.Update()

but when I check the file with paraview, there are three scalars but the last two are over wrote by the first one. can any one tell me how to write several datas?




cheers
----------------------------------------------
Zhang Wei
waynezw0618 at gmail.com





More information about the vtkusers mailing list