marching cubes / isosurface in scipy?

Hi! Is there a algorithm like machine cubes or isosurface in scipy? If not, is anyone working on this type of algorithms? Since my levelset algorithms depends on that, I might need to DIY if no one is working on that. Gen-Nan Chen, PhD Chief Scientist Research and Development Group CorTechs Labs Inc (www.cortechs.net) 1020 Prospect St., #304, La Jolla, CA, 92037 Tel: 1-858-459-9700 ext 16 Fax: 1-858-459-9705 Email: gnchen@cortechs.net

Dear Gen-Nan, I know FiPy has some levelset support. I haven't used it, but perhaps it could be of good use to you. -jelle -----Original Message----- From: scipy-user-bounces@scipy.net [mailto:scipy-user-bounces@scipy.net] On Behalf Of Gennan Chen Sent: Friday, April 28, 2006 4:53 PM To: SciPy Users List Subject: [SciPy-user] marching cubes / isosurface in scipy? Hi! Is there a algorithm like machine cubes or isosurface in scipy? If not, is anyone working on this type of algorithms? Since my levelset algorithms depends on that, I might need to DIY if no one is working on that. Gen-Nan Chen, PhD Chief Scientist Research and Development Group CorTechs Labs Inc (www.cortechs.net) 1020 Prospect St., #304, La Jolla, CA, 92037 Tel: 1-858-459-9700 ext 16 Fax: 1-858-459-9705 Email: gnchen@cortechs.net _______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user

"Gennan" == Gennan Chen <gnchen@cortechs.net> writes:
Gennan> Hi! Is there a algorithm like machine cubes or isosurface Gennan> in scipy? If not, is anyone working on this type of Gennan> algorithms? Since my levelset algorithms depends on that, Gennan> I might need to DIY if no one is working on that. VTK has a marching cubes algorithm, and a python interface #!/usr/local/bin/python import os from vtk import * from colors import * ren = vtkRenderer() renWin = vtkRenderWindow() renWin.AddRenderer(ren) iren = vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) # create pipeline # v16 = vtkVolume16Reader() v16.SetDataDimensions(256,256) v16.GetOutput().SetOrigin(0.0,0.0,0.0) v16.SetFilePrefix( os.environ['HOME'] + "/python/examples/vtk/images/r") v16.SetFilePattern( '%s%d.ima') v16.SetDataByteOrderToBigEndian() v16.SetImageRange(1001,1060) v16.SetDataSpacing(1.0,1.0,3.5) v16.Update() #vtkImageMarchingCubes iso iso = vtkMarchingCubes() iso.SetInput(v16.GetOutput()) iso.SetValue(0,30) #120 vessles near cerebellum #100 cortex #20 face #iso SetStartMethod {puts "Start Marching"} isoMapper = vtkPolyDataMapper() isoMapper.SetInput(iso.GetOutput()) isoMapper.ScalarVisibilityOff() isoActor = vtkActor() isoActor.SetMapper(isoMapper) isoActor.GetProperty().SetColor(antique_white) outline = vtkOutlineFilter() outline.SetInput(v16.GetOutput()) outlineMapper = vtkPolyDataMapper() outlineMapper.SetInput(outline.GetOutput()) outlineActor = vtkActor() outlineActor.SetMapper(outlineMapper) outlineActor.VisibilityOff() # Add the actors to the renderer, set the background and size # ren.AddActor(outlineActor) ren.AddActor(isoActor) ren.SetBackground(0.2,0.3,0.4) renWin.SetSize(450,450) ## ren.GetActiveCamera().Elevation(235) ## ren.GetActiveCamera().SetViewUp(0,.5,-1) ## ren.GetActiveCamera().Azimuth(90) iren.Initialize() iren.Start()

Thanks! I probably need to dig into VTK more Gen On Apr 28, 2006, at 8:39 AM, John Hunter wrote:
"Gennan" == Gennan Chen <gnchen@cortechs.net> writes:
Gennan> Hi! Is there a algorithm like machine cubes or isosurface Gennan> in scipy? If not, is anyone working on this type of Gennan> algorithms? Since my levelset algorithms depends on that, Gennan> I might need to DIY if no one is working on that.
VTK has a marching cubes algorithm, and a python interface
#!/usr/local/bin/python import os
from vtk import * from colors import *
ren = vtkRenderer() renWin = vtkRenderWindow() renWin.AddRenderer(ren) iren = vtkRenderWindowInteractor() iren.SetRenderWindow(renWin)
# create pipeline # v16 = vtkVolume16Reader() v16.SetDataDimensions(256,256) v16.GetOutput().SetOrigin(0.0,0.0,0.0) v16.SetFilePrefix( os.environ['HOME'] + "/python/examples/vtk/images/r") v16.SetFilePattern( '%s%d.ima') v16.SetDataByteOrderToBigEndian() v16.SetImageRange(1001,1060) v16.SetDataSpacing(1.0,1.0,3.5) v16.Update()
#vtkImageMarchingCubes iso iso = vtkMarchingCubes() iso.SetInput(v16.GetOutput()) iso.SetValue(0,30) #120 vessles near cerebellum #100 cortex #20 face #iso SetStartMethod {puts "Start Marching"}
isoMapper = vtkPolyDataMapper() isoMapper.SetInput(iso.GetOutput()) isoMapper.ScalarVisibilityOff()
isoActor = vtkActor() isoActor.SetMapper(isoMapper) isoActor.GetProperty().SetColor(antique_white)
outline = vtkOutlineFilter() outline.SetInput(v16.GetOutput()) outlineMapper = vtkPolyDataMapper() outlineMapper.SetInput(outline.GetOutput()) outlineActor = vtkActor() outlineActor.SetMapper(outlineMapper) outlineActor.VisibilityOff()
# Add the actors to the renderer, set the background and size # ren.AddActor(outlineActor) ren.AddActor(isoActor) ren.SetBackground(0.2,0.3,0.4) renWin.SetSize(450,450) ## ren.GetActiveCamera().Elevation(235) ## ren.GetActiveCamera().SetViewUp(0,.5,-1) ## ren.GetActiveCamera().Azimuth(90)
iren.Initialize()
iren.Start()
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user

Gen-nan> Is there a algorithm like machine cubes or isosurface in scipy? Gen-nan> If not, is anyone working on this type of algorithms? Since my Gen-nan> levelset algorithms depends on that, I might need to DIY if no Gen-nan> one is working on that. You might ask around the VTK community. There's probably an implementation there. Skip
participants (4)
-
Gennan Chen
-
Jelle Feringa / EZCT Architecture & Design Research
-
John Hunter
-
skip@pobox.com