[vtkusers] How to implement algorithm that store intermediate results and have internal variables dependent on the input

Jana Sefcikova neollie at gmail.com
Fri Jul 20 09:42:30 EDT 2012


Hi, I made the segmetation algorithm, that i implemented outside vtk and I
would like make vtkPolyDataAlgorithm from it.
My class uses class variables to store intermediate results, such as labels
for points , also relative depth that depends on input and others.

I want store intermediate results, because I want structure code (as I have
outside vtk) and I would like give user the possibility continue in
segmentation.
But I do not know how to use those variables in vtk way and restore state
of those variables to constructor state if the input change.

Lot of vtk algorithms that I saw, have all logic inside RequestData and
they do not store nor pointer to input, nor intermediate results (except
for example vtkOBBDicer that uses KdTree that is deleted at the end of
RequestData immediately). Class variables are mostly use as 'algorithm
characteristic' and they are independent from input.

What is correct implementation of vtk algorithm with internal state
dependent to input ?
When I should clear data ? How I can detect that input changed (I store
pointer to input and compared it, but it is vtk way ?).
What could be correct way to update input dependent variables when input
change ?

Is there any class that could serve as inspiration ?
Thanks in advance.
Jana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120720/f3741fad/attachment.htm>


More information about the vtkusers mailing list