#!/bin/sh # \ exec vtk $0 $@ # get the interactor ui source vtkInt.tcl # Simple volume rendering example. vtkStructuredPointsReader reader reader SetFileName "pressshort" reader SetScalarsName "pressure" #Erzeugen einer Oberfläche bei einem Wert von 1.0 vtkMarchingCubes iso iso SetInput [reader GetOutput] iso SetValue 0 500 #Bildet das Model auf graphische Primitive ab vtkPolyDataMapper isoMapper isoMapper SetInput [iso GetOutput] isoMapper ScalarVisibilityOff # Der Aktor vtkActor isoActor isoActor SetMapper isoMapper #Färbt die Oberfläche seegrün set isoProp [isoActor GetProperty] $isoProp SetColor 1 1 1 $isoProp SetAmbient 0.4 $isoProp SetOpacity 1 $isoProp SetRepresentationToWireframe # Create transfer functions for opacity and color vtkPiecewiseFunction opacityTransferFunction opacityTransferFunction AddPoint 0 0.0 opacityTransferFunction AddPoint 1050 0.3 vtkColorTransferFunction colorTransferFunction colorTransferFunction AddRGBPoint 0.0 0.2 0.2 0.0 # colorTransferFunction AddRGBPoint 250 1.0 0.0 0.0 colorTransferFunction AddRGBPoint 500 0.0 0.5 0 # colorTransferFunction AddRGBPoint 750 0.0 1.0 0.0 colorTransferFunction AddRGBPoint 1050 0.0 0.2 0.2 # Create properties, mappers, volume actors, and ray cast function vtkVolumeProperty volumeProperty volumeProperty SetColor colorTransferFunction volumeProperty SetScalarOpacity opacityTransferFunction vtkVolumeRayCastCompositeFunction compositeFunction vtkVolumeRayCastMapper volumeMapper volumeMapper SetInput [reader GetOutput] volumeMapper SetVolumeRayCastFunction compositeFunction vtkVolume volume volume SetMapper volumeMapper volume SetProperty volumeProperty # Create outline vtkOutlineFilter outline outline SetInput [reader GetOutput] vtkPolyDataMapper outlineMapper outlineMapper SetInput [outline GetOutput] vtkActor outlineActor outlineActor SetMapper outlineMapper eval [outlineActor GetProperty] SetColor 0.5 0.5 0.2 # Okay now the graphics stuff vtkRenderer ren1 vtkRenderWindow renWin renWin AddRenderer ren1 renWin SetSize 500 500 vtkRenderWindowInteractor iren iren SetRenderWindow renWin ren1 AddActor outlineActor #ren1 AddActor isoActor ren1 AddVolume volume ren1 SetBackground 1 1 1 renWin Render proc TkCheckAbort {} { set foo [renWin GetEventPending] if {$foo != 0} {renWin SetAbortRender 1} } renWin SetAbortCheckMethod {TkCheckAbort} iren SetUserMethod {wm deiconify .vtkInteract} iren Initialize #renWin SetFileName "valid/volSimple.ppm" #renWin SaveImageAsPPM wm withdraw .