[Insight-users] How to Stop iteration at each step of a iterative filter
Cyril Jaudet
drcjaudet at gmail.com
Fri Jan 10 03:03:41 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,
Jaudet Cyril, PSRPM, PhD
Département d'Ingénierie et de Physique Médicale
Institut Claudius Regaud
20-24, rue du Pont Saint-Pierre - 31052 Toulouse Cedex
Tél. interne:4801 /Tél. externe : 05 67 69 63 46
E-mail : jaudet.cyril at claudiusregaud.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140110/3e2af1a6/attachment.htm>
More information about the Insight-users
mailing list