[Insight-users] How to Stop iteration at each step of a iterative filter
Cyril Jaudet
drcjaudet at gmail.com
Thu Jan 9 13:02:19 EST 2014
Hello itk community,
I use deconvolution iterative filter to take account of partial volume
effect in 3d image. This seems to works well but I want to perform an image
evaluation at each step of the treatment.
I use *itkIterativeDeconvolutionImageFilter.h*<http://www.itk.org/Doxygen/html/itkIterativeDeconvolutionImageFilter_8h_source.html>
and
I don’t know how to stop the iteration at each step, perform image analysis
and go one.
This code is inspired from itk software guide but how to modify it for my
purpose because I didn’t use a registration optimizer.
class CommandIterationUpdate : public itk::Command
{
public:
typedef CommandIterationUpdate Self;
typedef itk::Command Superclass;
typedef itk::SmartPointer<Self> Pointer;
itkNewMacro( Self );
protected: CommandIterationUpdate() {};
typedef itk::IterativeDeconvolutionImageFilter
//typedef const ???
//typedef itk::RegularStepGradientDescentOptimizer
//typedef const OptimizerType *OptimizerPointer;
void Execute(itk::Object *caller, const itk::EventObject & event)
{
Execute( (const itk::Object *)caller, event);
}
void Execute(const itk::Object * object, const itk::EventObject & event)
{
//OptimizerPointer optimizer = dynamic_cast< OptimizerPointer >( object );
//???
if( ! itk::IterationEvent().CheckEvent( &event ) )
{
return;
}
//std::cout<<"Iteration en cours:"<<filter->GetIteration()<<std::endl;
SetStopIteration(bool (1)); //for stopping the filter and then analyse ?
}
};
And then in the main function:
CommandIterationUpdate::Pointer observer = CommandIterationUpdate::New();
filter->AddObserver( itk::IterationEvent(), observer );
filter ->Update();
//perform analysis then
SetStopIteration(bool (0));
filter ->Update();
Thanks a lot,
Cyril
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140109/bd9f85ea/attachment.htm>
More information about the Insight-users
mailing list