[Insight-users] how to halt iteration
Yixun Liu
yxliu at fudan.edu.cn
Sat Aug 19 22:33:59 EDT 2006
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060820/d5bff4df/attachment.html
More information about the Insight-users
mailing list