[Insight-users] Re: Need help with itkPointSetToPointSetRegistration

Eve evelyn_heyes at homeworking.org
Mon Apr 30 03:02:56 EDT 2007


Hi Daniel,

This is how I add the observer...

	  // Optimizer Type
	  typedef itk::LevenbergMarquardtOptimizer OptimizerType;
	  
	  OptimizerType::Pointer      optimizer     = OptimizerType::New();
	  CommandIterationUpdate::Pointer observer = CommandIterationUpdate::New();    
	  optimizer->AddObserver( itk::IterationEvent(), observer );
	  optimizer->SetUseCostFunctionGradient(false);

These are the parameter settings used:

  unsigned long   numberOfIterations =  2000;
  double          gradientTolerance  =  1e-5;   // convergence criterion
  double          valueTolerance     =  1e-5;   // convergence criterion
  double          epsilonFunction    =  1e-5;   // convergence criterion

Thanks in advance for your help,
Eve



Daniel Mace-2 wrote:
> 
> Eve,
> 
> Can you send the part of the code where you add the 
> CommandIterationUpdate as an observer?  Further, what are your optimizer 
> parameters?
> 
> Cheers,
> Dan
> 
> Eve Heyes wrote:
>> Hi Luis,
>>
>> I am trying to observe the evolution of the optimization. I have used an
>> observer to update the position values (see below). However, nothing was
>> observed; as if the optimization ended in the first iteration. I have
>> used very few sets of points; could this be why?
>>
>> Thanks,
>> Eve
>>
>>
>> Set1
>>
>> -0.268955 5.36033 30.5068 
>> -0.268955 5.08468 27.3331 
>> -0.816196 8.54178 24.9906 
>> -10.7404 2.91095 25.7686 
>> 10.8408 2.91095 25.7686 
>> -4.81812 11.6438 25.7686 
>> 4.81812 11.7442 25.7686 
>>
>> Set2
>>
>> -0.0752423 12.2746 -82.7269 
>> 24.9043 11.6886 -85.8659 
>> 0.196281 14.329 -88.1486 
>> -10.8841 9.06179 -87.67 
>> 11.1226 8.97906 -87.67 
>> -4.59649 18.6587 -87.67 
>> 4.58675 18.6587 -87.67 
>>
>>
>> class CommandIterationUpdate : public itk::Command 
>> {
>> public:
>>   typedef  CommandIterationUpdate   Self;
>>   typedef  itk::Command             Superclass;
>>   typedef itk::SmartPointer<Self>  Pointer;
>>   
>>   itkNewMacro( Self );
>> protected:
>>   CommandIterationUpdate() {};
>> public:	
>>
>>   typedef itk::LevenbergMarquardtOptimizer OptimizerType;
>>   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( typeid( event ) != typeid( itk::IterationEvent ) )
>>         {
>> 			return;
>>         }
>> 		
>> 	//	std::cout << optimizer->GetValue();
>> 		std::cout << ") ";
>> 		std::cout << optimizer->GetCurrentPosition ();		
>>   }
>> 		
>> };
>>
>>
>>
>> Could this be due to the simplicity of the problem?
>>
>> --- luis.ibanez at kitware.com wrote:
>>
>> From: Luis Ibanez <luis.ibanez at kitware.com>
>> To:  evelyn_heyes at homeworking.org
>> CC: Insight Users <insight-users at itk.org>
>> Subject: Re: Need help with itkPointSetToPointSetRegistration
>> Date: Wed, 11 Apr 2007 15:18:03 -0400
>>
>>
>> Hi Evelyn,
>>
>> What version of ITK are you using ?
>>
>> What event are you observing ?
>>
>>
>> Please let us know,
>>
>>
>>    Thanks
>>
>>
>>       Luis
>>
>>
>> --------------------------------------
>> evelyn_heyes at homeworking.org wrote:
>>   
>>> Hello Luis,
>>>
>>> Re: IterativeClosestPoint2 Example
>>>
>>> I have added an event observer to the LM optimizer but failed to observe
>>> any events. What is the cause of this? I noted that the same problem was
>>> posted at
>>> http://public.kitware.com/pipermail/insight-users/2006-May/018044.html.
>>> Has a solution been found? 
>>>
>>> Thanks,
>>> Eve
>>>
>>>
>>>
>>>
>>>
>>>
>>>     
>>
>>
>>
>>
>> _____________________________________________________________
>> Visit http://www.homeworking.com ~ To help you work at home
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>   
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 
Quoted from: 
http://www.nabble.com/Re%3A-Need-help-with-itkPointSetToPointSetRegistration-tf3663000.html#a10235936

-- 
View this message in context: http://www.nabble.com/Re%3A-Need-help-with-itkPointSetToPointSetRegistration-tf3663000.html#a10249296
Sent from the ITK - Users mailing list archive at Nabble.com.



More information about the Insight-users mailing list