[vtkusers] VTK cutting problems in stl. file

leung fung man german_leung at hotmail.com
Wed Dec 6 01:14:36 EST 2000


Dear VTK user:

I am a beginner user in
>>VTK also a student in Hong Kong.  I try to simulate the cutting effect on 
>>the hip surgery. Firstly, I use vtkSTLReader to input the hipjoin image 
>>and the cutter image.  Secondly, I control the cutter movement by the 
>>changing the <cutActor SetPosition> in TCL or in C++.  My program writing 
>>in TCL.  But I want to simulate the cutting effect that means the hipjoin 
>>will be cut by the cutting path(or cutter). Below is a part of my code, or 
>>you can sent me some idea in C++.
>>---------------------------------------------------
>>vtkRenderer ren
>>vtkRenderWindow renWin
>>    renWin AddRenderer ren
>>vtkRenderWindowInteractor iren
>>    iren SetRenderWindow renWin
>>
>>#input the hipjoin image
>>vtkSTLReader hip
>>    hip SetFileName $VTK_DATA/ballJoint60.stl
>>vtkPolyDataNormals normals
>>    normals SetInput [hip GetOutput]
>>vtkPolyDataMapper   hipMapper
>>    hipMapper SetInput [normals GetOutput]
>>vtkLODActor hipActor
>>    hipActor SetMapper hipMapper
>>eval [hipActor GetProperty] SetColor 1 0 0
>>
>>#vtkOutlineFilter outline
>>    #outline SetInput [normals GetOutput]
>>#vtkPolyDataMapper mapOutline
>>    #mapOutline SetInput [outline GetOutput]
>>#vtkActor outlineActor
>>    #outlineActor SetMapper mapOutline
>>    #[outlineActor GetProperty] SetColor 0.9 0 0
>>
>>
>>hipActor SetOrigin 0 0 0
>>hipActor RotateX -90
>>hipActor SetPosition 0 0 2.244
>>
>>#input the cutter1 image
>>vtkSTLReader cut
>>    cut SetFileName $VTK_DATA/cutter1.stl
>>vtkPolyDataNormals normal
>>    normal SetInput [cut GetOutput]
>>vtkPolyDataMapper   cutMapper
>>    cutMapper SetInput [normal GetOutput]
>>vtkLODActor cutActor
>>    cutActor SetMapper cutMapper
>>cutActor SetOrigin 0 50 0
>>cutActor RotateX -90
>>cutActor SetPosition 0 0 -60
>># Add the actors to the renderer, set the background and size
>>#
>>ren AddActor hipActor
>>ren AddActor cutActor
>>#ren AddProp outlineActor
>>ren SetBackground 0.1 0.2 0.4
>>renWin SetSize 600 600
>>
>>vtkCubeAxesActor2D axes
>>    axes SetProp hipActor
>>    axes SetCamera [ren GetActiveCamera]
>>    axes SetLabelFormat "%6.3g"
>>    axes ShadowOff
>>    axes SetFlyModeToOuterEdges
>>   #axes SetFlyModeToClosestTriad
>>    axes SetFontFactor 1.1
>>    [axes GetProperty] SetColor 1 1 1
>>ren AddProp axes
>>vtkCubeAxesActor2D axes1
>>    axes1 SetProp cutActor
>>    axes1 SetCamera [ren GetActiveCamera]
>>    axes1 SetLabelFormat "%6.3g"
>>    axes1 ShadowOff
>>    axes1 SetFlyModeToOuterEdges
>>   #axes1 SetFlyModeToClosestTriad
>>    axes1 SetFontFactor 1.1
>>    [axes1 GetProperty] SetColor 1 1 1
>>ren AddProp axes1
>>-----------------------------------------------------
>>And the coordinate of the cutter is controlled by the encoder signal.  The 
>>encoder will mount on the robot arm which is control by the surgeon to 
>>simulate the hip surgery.
>>
>>Thank you very much.
>>
>>Best Regards,
>>German Leung
>>
>>
>>
>

_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com





More information about the vtkusers mailing list