[Insight-users] [ITK Community] How to Stop iteration at each step of a iterative filter

Luis Ibanez luis.ibanez at kitware.com
Sat Jan 11 12:22:30 EST 2014


Cyril,

It may help to look at the class:


 itkDeconvolutionIterationCommand.h

https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/Deconvolution/test/itkDeconvolutionIterationCommand.h

In the Directory:


 ITK/Modules/Filtering/Deconvolution/test


and how it is used in the tests (in the same directory):

itkDeconvolutionIterationCommand.h:19:#ifndef
__itkDeconvolutionIterationCommand_h
itkDeconvolutionIterationCommand.h:20:#define
__itkDeconvolutionIterationCommand_h
itkDeconvolutionIterationCommand.h:28:class DeconvolutionIterationCommand :
public itk::Command
itkDeconvolutionIterationCommand.h:31:  typedef
DeconvolutionIterationCommand  Self;
itkDeconvolutionIterationCommand.h:68:  DeconvolutionIterationCommand()
itkLandweberDeconvolutionImageFilterTest.cxx:23:#include
"itkDeconvolutionIterationCommand.h"
itkLandweberDeconvolutionImageFilterTest.cxx:74:  typedef
itk::DeconvolutionIterationCommand< DeconvolutionFilterType >
IterationCommandType;
itkProjectedLandweberDeconvolutionImageFilterTest.cxx:22:#include
"itkDeconvolutionIterationCommand.h"
itkProjectedLandweberDeconvolutionImageFilterTest.cxx:66:  typedef
itk::DeconvolutionIterationCommand< DeconvolutionFilterType >
IterationComman
itkRichardsonLucyDeconvolutionImageFilterTest.cxx:23:#include
"itkDeconvolutionIterationCommand.h"
itkRichardsonLucyDeconvolutionImageFilterTest.cxx:67:  typedef
itk::DeconvolutionIterationCommand< DeconvolutionFilterType >
IterationCommandTyp



    Regards,


          Luis




On Fri, Jan 10, 2014 at 3:03 AM, Cyril Jaudet <drcjaudet at gmail.com> wrote:

> 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
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140111/7476d4e1/attachment.html>


More information about the Insight-users mailing list