[Insight-users] Hint: Tapping into ITK pipelines to visualize intermediate result s with VTK

Christian Uehara cuehara@uh.edu
Wed, 13 Nov 2002 12:26:45 -0600


Regarding this post originally to the developers list, was this example
ever added to the Applications directory? It would be useful to be able
to visualize intermediate pipeline results.

Christian
_____________________________________________
christian uehara, research associate
visual computing lab, dept of computer science
univ of houston
em: cuehara@uh.edu
ph: (713)743-1268 (ofc) / (713)302-5546 (cell)
fx: (713)743-1250


-----Original Message-----

From: insight-users-admin@public.kitware.com
[mailto:insight-users-admin@public.kitware.com] On Behalf Of Miller,
James V (Research)
Sent: Thursday, October 17, 2002 11:50 AM
To: Insight-developers (E-mail); Insight-users (E-mail)
Subject: [Insight-users] Hint: Tapping into ITK pipelines to visualize
intermediate result s with VTK


Several of ITK's filters are designed so at the end of each iteration in
the algorithm, the output of the filter contains the "results so far".
For example, the finite difference filters (level sets, etc.) trigger an
IterationEvent as well as a ProgressEvent() so that you can tap into the
output of the current iteration as the filter is executing.

I put together a little application that shows a levelset expanded over
an image.  To do this, I originally tied the output of the levelset
filter to a VTK pipeline to run MarchingSquares to extract the zero
level set and display the original image. This used the standard
Exporter/Importer facilities of VTK and ITK and wired the pipeline
methods together so Update() would propagate between VTK and ITK
filters.

I tied a callback to the IterationEvent that told my VTK viewer to
render.  

Unfortunately, telling a VTK viewer to render causes an Update() to
propagate up the pipeline.  But since the pipeline is already updating
(since the level set code was running), the update mechanism aborted and
not data was drawn.

To address this, I separated the two pipelines.  The ITK pipeline read
the data, preprocessed the data, and ran the level set algorithm.  A
separate pipeline was used to export data from ITK to VTK and to
visualize the data.  To separate the pipelines, I created an itk::Image
and essentially "grafted" the output of the levelset filter into this
image.  (This copied the regions, spacing, origin, and passed a
reference to the pixel container from the output of the level to this
separate image).  I then passed this extra image through the standard
ITK exporters and VTK importers. This extra image did not have to copy
the bulk pixel data (since I just passed a reference to the pixel
container) but it also did not have a "source" so the VTK pipeline could
run asynchronously with the ITK pipeline.

Now in my iteration callback, I reconfigured this extra image (copying
regions, spacing, origin, and reference to the pixel container), and
told VTK to render.
When the examples/applications reconfiguration is complete, I'll put
this application in as an example.    

Jim Miller