[vtkusers] Please help me use vtkLinearExtrusionFilter

Obada Mahdi omahdi at gmx.de
Sat Jul 1 22:10:52 EDT 2006

Hi Christopher,

You are welcome!

Christopher Bruns wrote:
> Rebuilding my vtk libraries including your change to vtkRibbonFilter.cxx 
> is probably the approach that I will take.  I tried inserting a 
> vtkCleanPolyData filter to correct the data corruption, but that filter 
> crashed as well.  I wish I could discover a way to work around the 
> problem for existing vtk builds, without writing/reading to/from the 
> file system.

I agree that using an actual filter to "clean" the results of 
vtkRibbonFilter is preferable to using in intermediate file.  I have put 
together a very minimalistic polydata filter as a suggestion how one can 
achieve similar results as the vtkPolyDataWriter/vtkPolyDataReader hack; 
please find the sources attached (vtkRibbonFilterFix.{cc,h}).

It creates as output a shallow copy of its polydata input, but fixes the 
PointData attributes by having only scalars, normals and texture 
coordinates remain in the copy.  I have checkedit only once to make sure 
those corrupt arrays do not pass and the test program runs as expected, 
I am not sure about memory leaks or other side effects.

> My own feeble attempts to diagnose the problem included using 
> vtkPolyDataWriter to view the object contents.  It's ironic that your 
> suggested workaround involved using vtkPolyDataWriter as a filter to 
> clean up the data.
> May I ask what was your technique for tracking down this problem?

Absolutely!  Although it is not one particular technique, I am afraid -- 
I generally try to use about any means available to "home in" on a bug, 
mostly by eliminating possibilities. This involves, e.g., writing 
debugging output to the console, reading source code (to learn about 
side effects and implementation-specific behavior) and using a debugger.

In this case,
- I started just like you did, by writing filter outputs at different 
stages of the pipeline to the disk in order to check for strange data.
- The data files looked OK, so I visualized them in ParaView to make 
sure they contain proper geometry.
- Also within ParaView, I applied the vtkLinearExtrusionFilter to the 
output stored from vtkRibbonFilter; this worked fine, suggesting that 
the extrusion filter may not be the problem after all.
- To ensure that this result was not related to differences between VTK 
from CVS (used in linking the test program) and the VTK that was bundled 
with the ParaView binary distribution I am using, I read that data back 
in with a vtkPolyDataReader in the test program, feeding its output to 
the extrusion filter, which also worked.
- I went back to reading VTK sources, to get an idea how the PointData 
attributes are implemented, and at which stage they are constructed in 
vtkRibbonFilter; your outstanding error report already suggested that 
there is a problem with PointData, which was confirmed by the console 
output via PrintSelf on the filter output
- finally used a debugger to trace through vtkRibbonFilter::RequestData 
and see what causes the corruption.

Please feel free to drop me a note if you have further questions.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtkRibbonFilterFix.cc
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060702/e208e59b/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtkRibbonFilterFix.h
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060702/e208e59b/attachment.asc>

More information about the vtkusers mailing list