这是我的代码:
values = []
for line in lines:
data = line.split()
for value in data:
values.append(value)
point_value = vtk.vtkIntArray()
point_value.SetNumberOfComponents(1)
for element in values:
e = int(element)
point_value.InsertNextValue(e)
x = float(0)
y = float(0)
z = float(0)
cellsize = float(0.00900900922715664)
layerSpacing = float(0.05)
image = vtk.vtkImageData()
image.SetDimensions(459, 459, 39)
image.SetOrigin(x, y, z)
image.SetSpacing(cellsize, -cellsize, layerSpacing)
image.GetPointData().SetScalars(point_value)
color = GetColorTable()
mapper = vtk.vtkDataSetMapper()
if vtk.VTK_MAJOR_VERSION <= 5:
mapper.SetInput(image)
else:
mapper.SetInputData(image)
mapper.SetScalarRange(-5, 75)
mapper.SetLookupTable(color)
actor = vtk.vtkActor()
actor.SetMapper(mapper)
大神帮忙看看要怎么弄
values = []
for line in lines:
data = line.split()
for value in data:
values.append(value)
point_value = vtk.vtkIntArray()
point_value.SetNumberOfComponents(1)
for element in values:
e = int(element)
point_value.InsertNextValue(e)
x = float(0)
y = float(0)
z = float(0)
cellsize = float(0.00900900922715664)
layerSpacing = float(0.05)
image = vtk.vtkImageData()
image.SetDimensions(459, 459, 39)
image.SetOrigin(x, y, z)
image.SetSpacing(cellsize, -cellsize, layerSpacing)
image.GetPointData().SetScalars(point_value)
color = GetColorTable()
mapper = vtk.vtkDataSetMapper()
if vtk.VTK_MAJOR_VERSION <= 5:
mapper.SetInput(image)
else:
mapper.SetInputData(image)
mapper.SetScalarRange(-5, 75)
mapper.SetLookupTable(color)
actor = vtk.vtkActor()
actor.SetMapper(mapper)
大神帮忙看看要怎么弄