[vtkusers] Get imagedata from vtkcutter

kmd1995 kmd1995 at sjtu.edu.cn
Thu Aug 13 23:38:19 EDT 2015


Hi all,
   I now get a 3D imagedata and I think I can use vtkcutter to cut it at any
orientation and get 2D vtkimagedata to do further prossess .But how can I
get the imagedata?
here is how I do this.

I can show it in a window but i can;t get imagedata.

import vtk
reader = vtk.vtkDICOMImageReader()
reader.SetDirectoryName("F:\SE2")
reader.Update()

plane=vtk.vtkPlane()
plane.SetOrigin(300,300,26)
plane.SetNormal(0,1,0)
 
#create cutter
cutter=vtk.vtkCutter()
cutter.SetCutFunction(plane)
cutter.SetInputConnection(reader.GetOutputPort())
cutter.Update()
cutterMapper=vtk.vtkPolyDataMapper()
cutterMapper.SetInputConnection( cutter.GetOutputPort())

#create plane actor
planeActor=vtk.vtkActor()
planeActor.GetProperty().SetColor(0.0,1,0)
planeActor.GetProperty().SetLineWidth(2)
planeActor.SetMapper(cutterMapper)

#create renderers and add actors of plane and cube
ren = vtk.vtkRenderer()
ren.AddActor(planeActor)

#Add renderer to renderwindow and render
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.SetSize(600, 600)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren.SetBackground(0,0,0)
renWin.Render()
iren.Start()

thanks all.
Stillin




--
View this message in context: http://vtk.1045678.n5.nabble.com/Get-imagedata-from-vtkcutter-tp5733485.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list