[vtk-developers] Question about writing custom filter

Shawn Waldon swaldon at cs.unc.edu
Thu Jul 4 12:47:28 EDT 2013


The other day I was trying to write a custom filter in VTK, just to see how
to do it, and I had a few questions that the documentation and the examples
just didn't answer.  I'd like to fix the documentation/examples, but I need
to know the answers first.  Here are the questions I had:

vtkPolyDataAlgorithm::RequestData(...)
the documentation is just "This is called by the superclass. This is the
method you should override."
-this returns an int, but all the examples just return 1.  Why?  What does
this return code mean, if anything?
-the online examples show how to use the input and output vectors, but what
is the other parameter for?  In every example I have looked at it is unused.

Then I was looking at the question of what to do if my filter failed
(divide by 0 was a possibility).  I found this example:
http://www.vtk.org/Wiki/VTK/Examples/Developers/FailedFilter
it uses vtkAlgorithm::SetErrorCode(), which according to the documentation:
"The error code contains a possible error that occurred while reading or
writing the file."
my questions:
-Should I be using this since my filter doesn't do file I/O?
-Do different codes mean anything?  Is there a list somewhere or do I just
use the standard posix error codes?
-What do you set as your output if the filter fails?  The example just soft
copies the input, is that the standard/right thing to do?
-The failed filter example uses a vtkDebugMacro() to print error messages,
but I would think that for an error, there would be something a little more
urgent than a debug message.  Why doesn't it use vtkErrorMacro() or
vtkWarningMacro() as shown in the other examples?  How should you decide
which one to use?  None of the examples explain this.

Thank you,

Shawn Waldon
-- 
Shawn Waldon
Graduate Student
Department of Computer Science
University of North Carolina at Chapel Hill
swaldon at cs.unc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20130704/f84f1ec8/attachment.html>


More information about the vtk-developers mailing list