Open jbrezmorf opened 2 years ago
def get_array_names(self, data): return [data.GetArrayName(i) for i in range(data.GetNumberOfArrays())]
modification of UnstructeredGridActor:
class UnstructuredGridActor(vtk.vtkActor): def __init__(self, model): super(UnstructuredGridActor, self).__init__() self.model = model #self.model.Update() array_idx = 3 self.scalar_range = self.model.GetOutput().GetPointData().GetArray(array_idx).GetRange() print("range:", self.scalar_range) self.scalar_range = (max(self.scalar_range[0], 0.01), self.scalar_range[1]) self.mapper = vtk.vtkDataSetMapper() self.mapper.SetInputConnection(self.model.GetOutputPort()) self.mapper.SetScalarMode(vtk.VTK_SCALAR_MODE_USE_POINT_FIELD_DATA) self.mapper.SetColorMode(vtk.VTK_COLOR_MODE_MAP_SCALARS) self.mapper.SelectColorArray(array_idx) self.mapper.ScalarVisibilityOn() self.mapper.SetScalarRange(self.scalar_range) lut = vtk.vtkLookupTable() lut.SetNumberOfColors(2000) lut.SetHueRange(0.667, 0.0) lut.Build() self.lut = lut #lut.SetRampToLinear() #lut.SetRange(self.scalar_range) self.mapper.SetLookupTable(lut) self.SetMapper(self.mapper)
modification of UnstructeredGridActor: