[Insight-users] Re: SetMaxIterations(0) still computes

Emma Ryan eryanvtk at yahoo.com
Fri Aug 10 10:32:08 EDT 2007


Hi Luis,

  Yes, I see the value of m_StopCondition in the debugger and it does not get initialized to 0, if the MaxNumberofIterations is 0.
I haven't checked whether this occurs for 0 value alone.

Emma



----- Original Message ----
From: Luis Ibanez <luis.ibanez at kitware.com>
To: Emma Ryan <eryanvtk at yahoo.com>
Cc: insight-users at itk.org
Sent: Friday, August 10, 2007 9:18:58 AM
Subject: Re: [Insight-users] Re: SetMaxIterations(0) still computes


Hi Emma,

         You are right, this is a bug.


      If Number of Iterations is set to zero,
      then the optimizer will runs forever.


We have logged this and Bug #5476
http://public.kitware.com/Bug/view.php?id=5476


The changes should be easy to put in place.



A couple of questions first:

    How are you looking at the value of m_StopCondition ?
    by using a debugger ?
    by using print outs ?

StopCondition is *initialized* with "MaximumNumberOfIterations",
that's probably the reason why you see that value when you
(I assume "manually") stop the optimizer.

We probably should add a "Unknown" to the enum, and initialize
the StopCondition to that value.



   Please let us konw,


       Thanks


          Luis



------------------
Emma Ryan wrote:
> Hi,
> 
>    With reference to my earlier email ( below), I think ITK does not 
> allow the MaxNumberOfIterations to be zero.  It needs to be a minimum of 
> one because the check
> if (m_currentIteration = = m_NumberOfIterations) then quit; is done in a 
> sort-of 'do-while' loop rather than 'while'. So this condition is never 
> true for m_NumberofIterations=0.
> 
> I am still confused about Stop_Condition getting a value of 5.
> 
> Also, if Stop_Condition is defined by NumberofIterations, then why 
> doesn't the optimizer continue iterating till it reaches the number, 
> rather than terminating at a 'decent' metric value ?
> 
> Obviously there is another hidden condition for termination which I dont 
> see.  Could anyone point to me the location ?
> 
> Thank you,
> Emma
> 
> ----- Original Message ----
> From: Emma Ryan <eryanvtk at yahoo.com>
> To: insight-users at itk.org
> Sent: Thursday, August 9, 2007 1:35:23 AM
> Subject: SetMaxIterations(0) still computes
> 
> Hi,
> 
>   I'm trying to debug my rigid registration program and the first step 
> is to reduce the number of iterations.
> So I set it to 0, but when I execute my program it still shows me 
> several iterations.  Any clue as to why this might be happening ?
> 
> Here is the output of the optimizer (segment 1).  As you can see, 
> NumberOfIterations = 0 . The StopCondition which I thought would be 0 is 
> 5. So based on this and other experiments, I have a few questions.
> 
> 1. Shouldn't the StopCondition be 0 ?
> 2. If optimizer->SetNumberOfIterations(0), then what do the following 
> iterations represent  and where do they come from ?
> 3. Also, it I set the NumberOfIterations to some otehr number such as 
> 100000, it still performs 500 iterations (the default value from the 
> example programs)
> 4. The Mean Square error metric that I compute on Binarized input images 
> is the same as that computed on grayscale images. So what I am doing 
> here is that I convert the grayscale images to binary. ie. Every tissue, 
> except bone is black. Then I use these binary images for registration. 
> The metric value returned by the registration process is compared 
> against the metric value obtained by applying the same transform on 
> original grayscale images and checking the mean squared error. 
> Surprisingly these two values are EXACTLY the same. I expect them to be 
> different for obvious reasons.
> The way I compute the metric on the original grayscale images is shown 
> below under segment 2
> 
> 
> What is going on ?
> 
> Any clue ?
> 
> Thanks in advance
> Emma
> 
> 
> SEGMENT 1
> ---------------
> VersorRigid3DTransformOptimizer (019220B8)
>   RTTI typeinfo:   class itk::VersorRigid3DTransformOptimizer
>   Reference Count: 2
>   Modified Time: 874
>   Debug: Off
>   Observers:
>     none
>   InitialPosition: []
>   CurrentPosition: []
>   Scales: [1, 1, 1, 0.001, 0.001, 0.001]
>   MaximumStepLength: 0.2
>   MinimumStepLength: 0.001
>   RelaxationFactor: 0.5
>   GradientMagnitudeTolerance: 0.1
>   NumberOfIterations: 0
>   CurrentIteration: 0
>   Value: 0
>   Maximize: 0
>   CostFunction: (None)
>   CurrentStepLength: 0
>   StopCondition: 5
>   Gradient: []
> 0   1976.47   [0.000460224, -0.0157202, -0.041473, -6.58714, -9.17326, 
> 0.231981]
> 
> 1   669.48   [0.00152886, 0.00402301, -0.0345613, -6.60421, -9.36806, 
> 0.229234]
> 2   576.079   [-0.000710302, -0.0100887, -0.0583703, -6.5576, -9.55443, 
> 0.227974
> ]
> 3   895.329   [0.0024751, 0.017149, -0.0188799, -6.6526, -9.70157, 0.236332]
> 4   1454.49   [0.000779181, 0.00262768, -0.0415692, -6.57818, -9.73974, 
> 0.226865
> ]
> 5   208.619   [-0.000462126, -0.00352645, -0.0488536, -6.56913, 
> -9.83714, 0.2190
> 21]
> 6   320.494   [0.00156166, 0.00864248, -0.0314357, -6.61138, -9.91627, 
> 0.207684]
> 
> 7   724.278   [0.000322199, -0.00121238, -0.0455856, -6.58293, -9.93788, 
> 0.20247
> 4]
> 8   143.422   [0.000259716, 0.00266556, -0.0399937, -6.59857, -9.98223, 
> 0.192322
> ]
> 9   223.3   [-0.000310048, -0.004876, -0.0507685, -6.57875, -10.018, 
> 0.180773]
> 10   419.74   [0.00029441, 5.14277e-005, -0.0436893, -6.59453, -10.026, 
> 0.177275
> ]
> 1
> .......
> 
> 
> 
> 
> SEGMENT 2
> 
> MetricType::Pointer         metricOrig           = MetricType::New();   
> 
>         metricOrig->SetInterpolator(interpolator);
>         metricOrig->SetTransform(transform);
>         metricOrig->SetFixedImage(fixedImageReaderOrig->GetOutput());
>         metricOrig->SetMovingImage(movingImageReaderOrig->GetOutput());
>         metricOrig->SetTransformParameters(finalParameters);   
>         MetricType::TransformParametersType finalParam = 
> registration->GetLastTransformParameters();
>        
>         std::cout<<" MetricOnOriginalImage = 
> "<<metric->GetValue(finalParam)<<std::endl;
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user 
> panel 
> <http://us.rd.yahoo.com/evt=48516/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7%20> 
> and lay it on us.
> 
> 
> ------------------------------------------------------------------------
> Be a better Heartthrob. Get better relationship answers 
> <http://us.rd.yahoo.com/evt=48255/*http://answers.yahoo.com/dir/_ylc=X3oDMTI5MGx2aThyBF9TAzIxMTU1MDAzNTIEX3MDMzk2NTQ1MTAzBHNlYwNCQUJwaWxsYXJfTklfMzYwBHNsawNQcm9kdWN0X3F1ZXN0aW9uX3BhZ2U-?link=list&sid=396545433>from 
> someone who knows.
> Yahoo! Answers - Check it out.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users







       
____________________________________________________________________________________
Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070810/9bbafee5/attachment-0001.html


More information about the Insight-users mailing list