# How to control iteration step by step in levelset-based filter?

**URL:** https://discourse.itk.org/t/how-to-control-iteration-step-by-step-in-levelset-based-filter/1761
**Category:** Beginner Questions
**Created:** [April 9, 2019, 6:17am UTC](https://discourse.itk.org/t/how-to-control-iteration-step-by-step-in-levelset-based-filter/1761 "2019-04-09T06:17:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![wenyalin](https://discourse.itk.org/user_avatar/discourse.itk.org/wenyalin/32/683_2.png) [@wenyalin](https://discourse.itk.org/u/wenyalin)
#### Post date: [April 9, 2019, 6:17am UTC](https://discourse.itk.org/t/how-to-control-iteration-step-by-step-in-levelset-based-filter/1761/1 "2019-04-09T06:17:08Z")

</div>

Hey guys, I’m a newbie in ITK.  
I’m wondering how could the GAC Level Set example achieve animated display? (link below, “Results” section)  
[https://itk.org/ITKExamples/src/Segmentation/LevelSets/SegmentWithGeodesicActiveContourLevelSet/Documentation.html](https://itk.org/ITKExamples/src/Segmentation/LevelSets/SegmentWithGeodesicActiveContourLevelSet/Documentation.html)  
As I known so far, I could only set the number of iterations by “SetNumberOfIterations”, and and than get the output corresponding to it by “GetOutput”.  
Instead of setting different iterations every time and rerun it, how could I get output from every iteration to achieve animated display?

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [April 9, 2019, 1:15pm UTC](https://discourse.itk.org/t/how-to-control-iteration-step-by-step-in-levelset-based-filter/1761/2 "2019-04-09T13:15:47Z")

</div>

Welcome to the community @wenyalin!

I think that there are some examples of that in [LevelSetsv4Visualization](https://github.com/InsightSoftwareConsortium/ITK/tree/master/Modules/Segmentation/LevelSetsv4Visualization) module. That module is OFF by default, so you will have to turn `Module_ITKLevelSetsv4Visualization` ON in CMake configuration of ITK.
