[Insight-users] how to halt iteration

Yixun Liu yxliu at fudan.edu.cn
Mon Aug 21 21:57:27 EDT 2006


Hi,
The exception is as
"D:\MyVC\ITK-2.6\Code\Common\itkProcessObject.cxx:999:
Filter execution was aborted by an external request"

Now,I change levelSet->AbortGenerateDataOn(); to levelSet->SetNumberOfIterations(0) and everything is ok.

Regards,

Yixun Liu
    


----- Original Message ----- 
From: "Luis Ibanez" <luis.ibanez at kitware.com>
To: "Yixun Liu" <yxliu at fudan.edu.cn>
Cc: "ITK" <insight-users at itk.org>
Sent: Monday, August 21, 2006 5:33 AM
Subject: Re: [Insight-users] how to halt iteration


> 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