[vtkusers] VTKPolyData to 3D image

Lars Friedrich Lars lars-friedrich at gmx.net
Tue Apr 20 03:34:47 EDT 2010


Hello David Welch,

referring to your original question "how to voxelize a simple surface" I added a VTK wiki example:

http://www.cmake.org/Wiki/VTK/Examples/PolyDataToImageData

It shows how we could incorporate vtkPolyDataToImageStencil into voxelizing a *closed* surface.

Please NOTE: as I wrote on the example page I'm not sure about the image origin. The visual agreement in the sphere-image-overlay (paraview) is not perfect and I'm not sure whether or not we had to introduce some spacing-dependent image origin offset to compensate that. If you use that code and find out something in this direction it would be great if you contributed it to that example!

HTH,

lars

-------- Original-Nachricht --------
> Datum: Mon, 19 Apr 2010 22:08:43 -0500
> Von: David Welch <dmwelch at engineering.uiowa.edu>
> An: David Doria <daviddoria+vtk at gmail.com>
> CC: vtkusers at vtk.org
> Betreff: Re: [vtkusers] VTKPolyData to 3D image

> Hi David,
> 
> So I don't use Paraview that often, usually to quick prototype something
> like this project.  I've created a sphere, and run that glyph through
> PolyDataNormals so that I get point normals.  I must be doing something
> incorrect, because when I try to run PointSetSurfaceReconstructionExample
> on
> my file, I get:
> 
> vtkPointSetSurfaceReconstruction (0x8a5f268): The input to
> vtkPointSetSurfaceReconstruction must have point normals.
> 
> I've also run the Input.vtp file from the source folder as input, which
> does
> run successfully, but the output file (attached) is unreadable by VMTK's
> vmtkimagereader script, which outputs the following error:
> 
> Reading VTK XML image file.
> ERROR: In /usr/lib/vtk/VTK/IO/vtkXMLReader.cxx, line 601
> vtkXMLImageDataReader (0x9d733e0): Cannot find ImageData element in file.
> 
> Since VMTK is my destination, this amounts to 'game over' for me unless I
> can determine which ImageData element isn't in the Input.vti image.  Any
> suggestions would be appreciated!
> 
> On Mon, Apr 19, 2010 at 12:17 PM, David Welch
> <dmwelch at engineering.uiowa.edu
> > wrote:
> 
> > I've tried to compile the code, and it seems that one needs to have a
> > version of VTK greater than the latest release to run this without
> > compilation errors.  Specifically, you use vtkMath::Subtract, which is
> not
> > included in 5.4.2.  I'll upgrade to the nightly build and post the
> results
> > on the midas journal page.
> >
> > Thanks!
> >
> >
> > On Mon, Apr 19, 2010 at 11:54 AM, David Doria
> <daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> > > wrote:
> >
> >> On Mon, Apr 19, 2010 at 12:39 PM, David Welch <
> >> dmwelch at engineering.uiowa.edu> wrote:
> >>
> >>> Thank you!   I'll let you know how it works out.  How can I add this
> to
> >>> my Paraview setup?
> >>>
> >>
> >> Let's keep the discussion on the mailing list so everyone can input and
> >> benefit.
> >>
> >> As it was part of a bigger submission (surface reconstruction), I
> didn't
> >> wrap vtkVoxelizePolyData directly. I just tried to quickly make it into
> a
> >> Paraview plugin, but it seems I have separated the code a bit
> differently
> >> than I remember.
> >>
> >> vtkVoxelizePolyData simply creates the vtkImageData with reasonable
> bounds
> >> over the polydata. Computing the distance to the surface was actually
> done
> >> in vtkPointSetSurfaceReconstrion, and then I used a vtkContourFilter to
> >> extract the 0 level set (the surface). You can definitely reuse most of
> this
> >> code - you just have to check the sign on the SignedDistanceToPlane
> function
> >> and mark the point as inside or outside.
> >>
> >> You could also ust vtkVoxelizePolyData to make the grid, then use
> >> something like this:
> >> http://www.vtk.org/Wiki/VTK/Examples/PointInsideObject
> >>
> >> on every point to do the inside/outside marking.
> >>
> >> Good luck,
> >>
> >> David
> >>
> >
> >
> >
> > --
> > David Welch
> > Graduate Student
> > Dept. of Biomedical Engineering
> > University of Iowa
> > Lab: (319) 335-5279
> >
> 
> 
> 
> -- 
> David Welch
> Graduate Student
> Dept. of Biomedical Engineering
> University of Iowa
> Lab: (319) 335-5279

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01



More information about the vtkusers mailing list