VTK tcl / tk如何在不同颜色的平面上代表几个标量?

时间:2013-10-20 13:58:24

标签: tcl vtk

这看起来很简单,但我很难在不同颜色的平面上表示不同的标量值。 我有一个包含季节数据的文件" dados_solo.vtk"并且标量值对应于土壤温度" soilTemp",我必须代表不同颜色平面中每个季节的土壤温度数据。我用vtkStructuredGridGeometryFilter表示它们没有问题,但是现在我必须在飞机中代表点而不是点。

img

这是我到目前为止的代码:

    package require vtk
    package require vtkinteraction

vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

# Definir o estilo de interacção 
vtkInteractorStyleTrackballCamera style
    iren SetInteractorStyle style

    iren AddObserver UserEvent {wm deiconify .vtkInteract}

vtkDataSetReader reader
    reader SetFileName "dados_solo.vtk"
    reader SetScalarsName soilTemp
    reader Update

vtkDataSetReader readertemp
    readertemp SetFileName "dados_solo.vtk"
    readertemp SetScalarsName soilTemp
    readertemp Update

# Contours of the grid-----------------------------------------------------
vtkStructuredGridOutlineFilter outline
    outline SetInput [reader GetStructuredGridOutput]
vtkPolyDataMapper mapOutline
    mapOutline SetInput [outline GetOutput]
vtkActor outlineActor
    outlineActor SetMapper mapOutline
    [outlineActor GetProperty] SetColor 1 0 0


# Points of Grid-----------------------------------------------------
vtkStructuredGridGeometryFilter compPlane
    compPlane SetInput [reader GetStructuredGridOutput]

vtkPolyDataMapper planeMapper
    planeMapper SetInput [compPlane GetOutput]
    eval planeMapper SetScalarRange \
      [[[[reader GetOutput] GetPointData] GetScalars] GetRange]
    planeMapper ScalarVisibilityOn

vtkActor planeActor
    planeActor SetMapper planeMapper
    [planeActor GetProperty] SetColor 0 1 0

# -------------------------------------------------------------------
vtkPlane plane
    eval plane SetOrigin [[reader GetOutput] GetCenter]

vtkCutter planeCut
    planeCut SetInput [reader GetOutput]
    planeCut SetCutFunction plane

vtkPolyDataMapper cutMapper
    cutMapper SetInput [planeCut GetOutput]
    eval cutMapper SetScalarRange \
      [[[[reader GetOutput] GetPointData] GetScalars] GetRange]

vtkActor cutActor
    cutActor SetMapper cutMapper
# -------------------------------------------------------------------

ren1 AddActor cutActor 
ren1 AddActor outlineActor
ren1 AddActor planeActor
renWin SetSize 500 500
ren1 SetBackground 0.1 0.1 0.1
renWin Render

0 个答案:

没有答案