[vtkusers] vtkSurfaceReconstructionFilter
Adam Gibson
agibson at medphys.ucl.ac.uk
Thu Jan 24 11:21:20 EST 2008
Hello
I have used a VTK program for some time which warps a dense cloud of
points taken from a 2D surface to fit a sparse cloud of points scattered
near to the surface, and connects the surface, and saves the 2D surface
mesh as a stl.
This has worked OK for a few years now, but I've recently changed
versions from 4 (compiled locally) to 5 (installed using yum under
Fedora), and it seems to have broken. The size of the warped surface is
much smaller than it should be (it's roughly, but not quite 0 to 10 mm
in x, y and z).
My program's below. The points are read in correctly (according to the
puts $x command) but the saved stl file is wrong. I've trawled the
mailing lists but not found anything relevant. I've even tried rewriting
the program in python, without success.
Can anybody help please?
Thank you in advance
Adam Gibson (Dept Medical Physics, UCL)
package require vtk
vtkProgrammableSource pointSource
pointSource SetExecuteMethod readPoints
proc readPoints {} {
global VTK_DATA
set output [pointSource GetPolyDataOutput]
vtkPoints points
$output SetPoints points
set file [open "stl.txt" r]
while { [gets $file line] != -1 } {
scan $line "%f %f %f" x y z
puts $x
points InsertNextPoint $x $y $z
}
points Delete;
}
vtkSurfaceReconstructionFilter surf
surf SetInput [pointSource GetPolyDataOutput]
vtkMarchingCubes cf
cf SetInput [surf GetOutput]
cf SetValue 0 0.0
vtkPolyDataConnectivityFilter connect
connect SetInput [cf GetOutput]
connect SetExtractionModeToLargestRegion
vtkSTLWriter writerstl
writerstl SetFileName test.stl
writerstl SetInput [connect GetOutput]
writerstl Write
More information about the vtkusers
mailing list