[Insight-users] how to halt iteration

Luis Ibanez luis.ibanez at kitware.com
Sun Aug 20 17:33:45 EDT 2006



Hi Yixun,


What does the Exception message says ?

Did you put a try/catch block around the
code that is throwing the exception ?


It will be very nice of you to share
the error messages with the list.


  Thanks


     Luis



-----------------
Yixun Liu wrote:
> Hi,
>  
> My pipeline is as below,
>  
> reader--->ShapeDetectoionLevelSet---->BinaryThresholdImageFilter
>  
> I call BinaryThresholdImageFilter->Update() to trigger the pipeline. I 
> use Observer CommandIterationUpdate_ShapeDetection to observe the result 
> of each iteration of LevelSet. I want to halt the iteration when I 
> observe the result has reach my requirement and set the flag enableHalt 
> to true. I do as below 
>  
> class CommandIterationUpdate_ShapeDetection : public itk::Command
> {
> .............
>   void Execute(itk::Object *caller, const itk::EventObject & event)
>  {
>       levelSetPointer levelSet =
>         dynamic_cast< levelSetPointer >( caller );
>       if( typeid( event ) != typeid( itk::IterationEvent ) )
>         {
>         return;
>         }
> 
>           if(this->enableHalt)
>           {
>                levelSet->AbortGenerateDataOn();
>                 return;
>           }
>  }
> 
> ............ 
> }
>  
> However, exception is thrown. The reason maybe that levelset 
> abort generating the data instead of passing the data to next 
> filter. Which method should I use to halt the iteration?
>  
> Regards,
>  
> Yixun Liu
>  
>    
>    
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users




More information about the Insight-users mailing list