[Insight-users] Using observer on Transform?

motes motes mort.motes at gmail.com
Tue Apr 20 08:43:02 EDT 2010


Typically an observer is connected to an optimizer like:

      optimizer->SetNumberOfIterations(number_of_iterations);
      optimizer->MinimizeOn();
      optimizer->AddObserver(itk::IterationEvent(), observer);


In the observer its then possible to retrieve the optimizer and read
(or even modify) the parameters:

		void Execute( itk::Object * object, const itk::EventObject & event) {
			OptimizerPointer optimizer = dynamic_cast< OptimizerPointer >( object );
			if( ! itk::IterationEvent().CheckEvent( &event ) ) {
				return;
			}
			std::cout << optimizer->GetCurrentIteration() << " = " <<
optimizer->GetValue() << " : " << optimizer->GetCurrentPosition() <<
std::endl;
                         // do modifications...



Now I would like to be able to do the the same thing with a transform
that I have made.

What I need is to modify some parameters in the transform after a
certain number of iterations.  Is it somehow possible to get the
transform connected to the image registration method in the above
Execute method in each iteration?


More information about the Insight-users mailing list