View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000674VTK(No Category)public2004-03-11 14:132004-04-02 17:24
ReporterAndreas Kuhn 
Assigned ToMathieu Malaterre 
PriorityurgentSeveritymajorReproducibilityalways
StatusclosedResolutionwon't fix 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000674: Wrong conversion from vtkPolyData to vtkImageData (vtkPolyDataToImageStencil and vtkImageStencil)
DescriptionI'm trying to use vtkPolyDataToImageStencil and vtkImageStencil to extract vtkImageData out of vtkPolyData. But even when I try to convert a simple sphere into image data, the result gets wrong.
I posted a picture to http://people.ee.ethz.ch/~kuhnan/public/imageData.jpg. [^] It contains the slices of the resulting vtkImageData and you can see that on the first and the last slice, there is a white line instead of a point.

The code of an example program is available on http://people.ee.ethz.ch/~kuhnan/public/ImageStencilProblem.cxx. [^]
TagsNo tags attached.
Project
Type
Attached Files? file icon stencil.py [^] (596 bytes) 1969-12-31 19:00
? file icon polydata.vtk [^] (687,420 bytes) 1969-12-31 19:00

 Relationships

  Notes
(0000763)
Mathieu Malaterre (developer)
2004-03-11 14:31

There are some limit to the use of vtkPolyDataToImageStencil, see for example:

http://vtk.org/pipermail/vtkusers/2003-September/019976.html [^]

I am attaching dataset and python script to reproduce the bug. You should consider another approach, for example vtkImplicitPolyData (not part of VTK).
(0000846)
Mathieu Malaterre (developer)
2004-04-02 17:24

Adding some more comments for future user:

(from HIRAKI Hideaki)

Q: My polydata is closed (I use vtkFeatureEdge to check that). But I don't see what other properties could let vtkImageStencil and/or vtkPolyDataToImageStencil to fail.

A: Generally speaking, judging in/out of polydata is a hard problem under the limited precision of floating point calculations. I think some points, edges or grid lines of the image are too close to break consistency.
 - A possible workaround is to transform the data and do computation in another coordinate space where the problem isn't revealed.
 - vtkImplicitPolyData by David Pont may circumvent the problem as it uses the normal directions of polygons.
 - I have once tried to apply GTS library (http://gts.sourceforge.net [^]) to a similar task. This library uses robust arithmetic and worked for me, though it's not perfect.
I haven't seen your data, but I hope any of them may help you.

(from David Gobbi)

Finding out whether a point is inside/outside is both very time consuming (the vtkPolyDataToImageStencil uses a vtkOBBTree to accelerate this), plus floating-point precision makes it very difficult to write a robust algorithm.

The two options are:
1) use fixed-point math to do the check, e.g. this is what Mesa and other OpenGL implementations often do in order to exactly match neighboring polygon boundaries to each other for depth checks
2) turn the whole problem upside-down by rasterizing the polydata, e.g. fill the 3D polydata similar to the way way that OpenGL fills 2D polygons when it draws them on the screen (except more complicated because you have to fill in 3D instead of just in 2D).

Both (1) and (2) are very difficult to implement!

 Issue History
Date Modified Username Field Change
2011-06-16 13:11 Zack Galbreath Category => (No Category)


Copyright © 2000 - 2018 MantisBT Team