[Insight-users] LBFGSBoptimizer and MI value

Serena Fabbri fabbri at u.washington.edu
Tue Jun 30 17:38:30 EDT 2009


Hi Luis and All,

ok, i have replaced optimizer->GetValue() and it gives me numbers different from 0.
I have read in itk::SingleValuedNonLinearVnlOptimizer Class Reference, that it is not up-to-date value 
of MI...isn't it?
If you look the output, the iterations are 69, but it is repeated several times....so I don't understand 
very well how many iterations the code does.
Besides......could you suggest me a way to know the parameters values at each iteration?

Thank you very much.
Serena.


-------output-------------------

gridSizeOnImage [3, 3, 3] gridBorderSize [3, 3, 3] totalGridSIze [6, 6, 6]
gridOriginOffset [87.5, 127.5, 79.5]
gridOrigin [-87.5, -127.5, -79.5]
spacing [87.5, 127.5, 79.5]
numberOfParameters 648

Starting Registration
Iter 0    CachedValue -0.135285    InfinityNormOfProjectedGradient 0
Iter 0    CachedValue -0.136816    InfinityNormOfProjectedGradient 0
Iter 0    CachedValue -0.136816    InfinityNormOfProjectedGradient 0.000262062
Iter 1    CachedValue -0.138381    InfinityNormOfProjectedGradient 0.000262062
Iter 1    CachedValue -0.138381    InfinityNormOfProjectedGradient 0.000178985
Iter 2    CachedValue -0.139721    InfinityNormOfProjectedGradient 0.000178985
Iter 2    CachedValue -0.139721    InfinityNormOfProjectedGradient 0.000182089
Iter 3    CachedValue -0.141799    InfinityNormOfProjectedGradient 0.000182089
Iter 3    CachedValue -0.141799    InfinityNormOfProjectedGradient 0.000295439
Iter 4    CachedValue -0.140242    InfinityNormOfProjectedGradient 0.000295439
Iter 4    CachedValue -0.142305    InfinityNormOfProjectedGradient 0.000295439
Iter 4    CachedValue -0.142305    InfinityNormOfProjectedGradient 0.000332698
Iter 5    CachedValue -0.144904    InfinityNormOfProjectedGradient 0.000332698
Iter 5    CachedValue -0.144904    InfinityNormOfProjectedGradient 0.000227115
Iter 6    CachedValue -0.143351    InfinityNormOfProjectedGradient 0.000227115
Iter 6    CachedValue -0.145245    InfinityNormOfProjectedGradient 0.000227115
Iter 6    CachedValue -0.145245    InfinityNormOfProjectedGradient 0.000180015
Iter 7    CachedValue -0.145855    InfinityNormOfProjectedGradient 0.000180015
Iter 7    CachedValue -0.145855    InfinityNormOfProjectedGradient 0.000224301
Iter 8    CachedValue -0.146379    InfinityNormOfProjectedGradient 0.000224301
Iter 8    CachedValue -0.146379    InfinityNormOfProjectedGradient 0.000281225
Iter 9    CachedValue -0.146987    InfinityNormOfProjectedGradient 0.000281225
Iter 9    CachedValue -0.146987    InfinityNormOfProjectedGradient 0.000347015
Iter 10    CachedValue -0.148133    InfinityNormOfProjectedGradient 0.000347015
Iter 10    CachedValue -0.148133    InfinityNormOfProjectedGradient 0.000342164
Iter 11    CachedValue -0.149066    InfinityNormOfProjectedGradient 0.000342164
Iter 11    CachedValue -0.149066    InfinityNormOfProjectedGradient 0.000157566
Iter 12    CachedValue -0.149587    InfinityNormOfProjectedGradient 0.000157566
Iter 12    CachedValue -0.149587    InfinityNormOfProjectedGradient 0.000149334
Iter 13    CachedValue -0.149866    InfinityNormOfProjectedGradient 0.000149334
Iter 13    CachedValue -0.15019    InfinityNormOfProjectedGradient 0.000149334
Iter 13    CachedValue -0.15019    InfinityNormOfProjectedGradient 0.000297405
Iter 14    CachedValue -0.149107    InfinityNormOfProjectedGradient 0.000297405
Iter 14    CachedValue -0.150474    InfinityNormOfProjectedGradient 0.000297405
Iter 14    CachedValue -0.150474    InfinityNormOfProjectedGradient 0.000233087
Iter 15    CachedValue -0.150849    InfinityNormOfProjectedGradient 0.000233087
Iter 15    CachedValue -0.150849    InfinityNormOfProjectedGradient 0.000270985
Iter 16    CachedValue -0.151276    InfinityNormOfProjectedGradient 0.000270985
Iter 16    CachedValue -0.151276    InfinityNormOfProjectedGradient 0.000175098
Iter 17    CachedValue -0.151627    InfinityNormOfProjectedGradient 0.000175098
Iter 17    CachedValue -0.151627    InfinityNormOfProjectedGradient 0.000153631
Iter 18    CachedValue -0.151913    InfinityNormOfProjectedGradient 0.000153631
Iter 18    CachedValue -0.151913    InfinityNormOfProjectedGradient 0.000198165
Iter 19    CachedValue -0.153279    InfinityNormOfProjectedGradient 0.000198165
Iter 19    CachedValue -0.153279    InfinityNormOfProjectedGradient 0.000334519
Iter 20    CachedValue -0.154186    InfinityNormOfProjectedGradient 0.000334519
Iter 20    CachedValue -0.154186    InfinityNormOfProjectedGradient 0.000334793
Iter 21    CachedValue -0.154433    InfinityNormOfProjectedGradient 0.000334793
Iter 21    CachedValue -0.154433    InfinityNormOfProjectedGradient 0.000261072
Iter 22    CachedValue -0.154656    InfinityNormOfProjectedGradient 0.000261072
Iter 22    CachedValue -0.154656    InfinityNormOfProjectedGradient 0.000120058
Iter 23    CachedValue -0.154394    InfinityNormOfProjectedGradient 0.000120058
Iter 23    CachedValue -0.154765    InfinityNormOfProjectedGradient 0.000120058
Iter 23    CachedValue -0.154765    InfinityNormOfProjectedGradient 0.000193124
Iter 24    CachedValue -0.15479    InfinityNormOfProjectedGradient 0.000193124
Iter 24    CachedValue -0.15479    InfinityNormOfProjectedGradient 0.000111046
Iter 25    CachedValue -0.155059    InfinityNormOfProjectedGradient 0.000111046
Iter 25    CachedValue -0.155059    InfinityNormOfProjectedGradient 0.000165312
Iter 26    CachedValue -0.155408    InfinityNormOfProjectedGradient 0.000165312
Iter 26    CachedValue -0.155408    InfinityNormOfProjectedGradient 0.000158262
Iter 27    CachedValue -0.155538    InfinityNormOfProjectedGradient 0.000158262
Iter 27    CachedValue -0.155538    InfinityNormOfProjectedGradient 9.14039e-05
Iter 28    CachedValue -0.155862    InfinityNormOfProjectedGradient 9.14039e-05
Iter 28    CachedValue -0.155862    InfinityNormOfProjectedGradient 0.000108369
Iter 29    CachedValue -0.156014    InfinityNormOfProjectedGradient 0.000108369
Iter 29    CachedValue -0.156014    InfinityNormOfProjectedGradient 6.96136e-05
Iter 30    CachedValue -0.15638    InfinityNormOfProjectedGradient 6.96136e-05
Iter 30    CachedValue -0.15638    InfinityNormOfProjectedGradient 0.000175598
Iter 31    CachedValue -0.15675    InfinityNormOfProjectedGradient 0.000175598
Iter 31    CachedValue -0.15675    InfinityNormOfProjectedGradient 0.000178462
Iter 32    CachedValue -0.15615    InfinityNormOfProjectedGradient 0.000178462
Iter 32    CachedValue -0.156785    InfinityNormOfProjectedGradient 0.000178462
Iter 32    CachedValue -0.156785    InfinityNormOfProjectedGradient 0.000165292
Iter 33    CachedValue -0.156698    InfinityNormOfProjectedGradient 0.000165292
Iter 33    CachedValue -0.156865    InfinityNormOfProjectedGradient 0.000165292
Iter 33    CachedValue -0.156865    InfinityNormOfProjectedGradient 0.000192639
Iter 34    CachedValue -0.157443    InfinityNormOfProjectedGradient 0.000192639
Iter 34    CachedValue -0.157443    InfinityNormOfProjectedGradient 0.000130335
Iter 35    CachedValue -0.157959    InfinityNormOfProjectedGradient 0.000130335
Iter 35    CachedValue -0.157959    InfinityNormOfProjectedGradient 0.000112771
Iter 36    CachedValue -0.158003    InfinityNormOfProjectedGradient 0.000112771
Iter 36    CachedValue -0.158003    InfinityNormOfProjectedGradient 0.000134055
Iter 37    CachedValue -0.158288    InfinityNormOfProjectedGradient 0.000134055
Iter 37    CachedValue -0.158288    InfinityNormOfProjectedGradient 6.71128e-05
Iter 38    CachedValue -0.158161    InfinityNormOfProjectedGradient 6.71128e-05
Iter 38    CachedValue -0.158312    InfinityNormOfProjectedGradient 6.71128e-05
Iter 38    CachedValue -0.158312    InfinityNormOfProjectedGradient 7.5438e-05
Iter 39    CachedValue -0.158083    InfinityNormOfProjectedGradient 7.5438e-05
Iter 39    CachedValue -0.158331    InfinityNormOfProjectedGradient 7.5438e-05
Iter 39    CachedValue -0.158331    InfinityNormOfProjectedGradient 5.54456e-05
Iter 40    CachedValue -0.158158    InfinityNormOfProjectedGradient 5.54456e-05
Iter 40    CachedValue -0.158358    InfinityNormOfProjectedGradient 5.54456e-05
Iter 40    CachedValue -0.158358    InfinityNormOfProjectedGradient 7.92771e-05
Iter 41    CachedValue -0.158315    InfinityNormOfProjectedGradient 7.92771e-05
Iter 41    CachedValue -0.158367    InfinityNormOfProjectedGradient 7.92771e-05
Iter 41    CachedValue -0.158367    InfinityNormOfProjectedGradient 7.79648e-05
Iter 42    CachedValue -0.158329    InfinityNormOfProjectedGradient 7.79648e-05
Iter 42    CachedValue -0.158379    InfinityNormOfProjectedGradient 7.79648e-05
Iter 42    CachedValue -0.158379    InfinityNormOfProjectedGradient 8.3058e-05
Iter 43    CachedValue -0.158235    InfinityNormOfProjectedGradient 8.3058e-05
Iter 43    CachedValue -0.158406    InfinityNormOfProjectedGradient 8.3058e-05
Iter 43    CachedValue -0.158406    InfinityNormOfProjectedGradient 6.6516e-05
Iter 44    CachedValue -0.158411    InfinityNormOfProjectedGradient 6.6516e-05
Iter 44    CachedValue -0.158411    InfinityNormOfProjectedGradient 0.000101636
Iter 45    CachedValue -0.158517    InfinityNormOfProjectedGradient 0.000101636
Iter 45    CachedValue -0.158517    InfinityNormOfProjectedGradient 0.000107886
Iter 46    CachedValue -0.158754    InfinityNormOfProjectedGradient 0.000107886
Iter 46    CachedValue -0.158754    InfinityNormOfProjectedGradient 0.000152569
Iter 47    CachedValue -0.158857    InfinityNormOfProjectedGradient 0.000152569
Iter 47    CachedValue -0.158857    InfinityNormOfProjectedGradient 9.54528e-05
Iter 48    CachedValue -0.158938    InfinityNormOfProjectedGradient 9.54528e-05
Iter 48    CachedValue -0.158938    InfinityNormOfProjectedGradient 0.000131167
Iter 49    CachedValue -0.159018    InfinityNormOfProjectedGradient 0.000131167
Iter 49    CachedValue -0.159018    InfinityNormOfProjectedGradient 0.00011672
Iter 50    CachedValue -0.159042    InfinityNormOfProjectedGradient 0.00011672
Iter 50    CachedValue -0.159042    InfinityNormOfProjectedGradient 8.40269e-05
Iter 51    CachedValue -0.159081    InfinityNormOfProjectedGradient 8.40269e-05
Iter 51    CachedValue -0.159081    InfinityNormOfProjectedGradient 0.000105198
Iter 52    CachedValue -0.159252    InfinityNormOfProjectedGradient 0.000105198
Iter 52    CachedValue -0.159252    InfinityNormOfProjectedGradient 9.19912e-05
Iter 53    CachedValue -0.159222    InfinityNormOfProjectedGradient 9.19912e-05
Iter 53    CachedValue -0.159337    InfinityNormOfProjectedGradient 9.19912e-05
Iter 53    CachedValue -0.159337    InfinityNormOfProjectedGradient 0.000107755
Iter 54    CachedValue -0.159442    InfinityNormOfProjectedGradient 0.000107755
Iter 54    CachedValue -0.159442    InfinityNormOfProjectedGradient 0.000197689
Iter 55    CachedValue -0.159526    InfinityNormOfProjectedGradient 0.000197689
Iter 55    CachedValue -0.159526    InfinityNormOfProjectedGradient 0.000102651
Iter 56    CachedValue -0.159619    InfinityNormOfProjectedGradient 0.000102651
Iter 56    CachedValue -0.159619    InfinityNormOfProjectedGradient 4.66383e-05
Iter 57    CachedValue -0.1597    InfinityNormOfProjectedGradient 4.66383e-05
Iter 57    CachedValue -0.1597    InfinityNormOfProjectedGradient 6.57382e-05
Iter 58    CachedValue -0.159817    InfinityNormOfProjectedGradient 6.57382e-05
Iter 58    CachedValue -0.159817    InfinityNormOfProjectedGradient 8.31402e-05
Iter 59    CachedValue -0.1599    InfinityNormOfProjectedGradient 8.31402e-05
Iter 59    CachedValue -0.1599    InfinityNormOfProjectedGradient 7.35979e-05
Iter 60    CachedValue -0.159991    InfinityNormOfProjectedGradient 7.35979e-05
Iter 60    CachedValue -0.159991    InfinityNormOfProjectedGradient 7.34808e-05
Iter 61    CachedValue -0.159807    InfinityNormOfProjectedGradient 7.34808e-05
Iter 61    CachedValue -0.160097    InfinityNormOfProjectedGradient 7.34808e-05
Iter 61    CachedValue -0.160097    InfinityNormOfProjectedGradient 0.000107219
Iter 62    CachedValue -0.160211    InfinityNormOfProjectedGradient 0.000107219
Iter 62    CachedValue -0.160211    InfinityNormOfProjectedGradient 0.000189714
Iter 63    CachedValue -0.160198    InfinityNormOfProjectedGradient 0.000189714
Iter 63    CachedValue -0.160193    InfinityNormOfProjectedGradient 0.000189714
Iter 63    CachedValue -0.160221    InfinityNormOfProjectedGradient 0.000189714
Iter 63    CachedValue -0.160221    InfinityNormOfProjectedGradient 0.000187129
Iter 64    CachedValue -0.160294    InfinityNormOfProjectedGradient 0.000187129
Iter 64    CachedValue -0.160294    InfinityNormOfProjectedGradient 9.65022e-05
Iter 65    CachedValue -0.160348    InfinityNormOfProjectedGradient 9.65022e-05
Iter 65    CachedValue -0.160348    InfinityNormOfProjectedGradient 6.75378e-05
Iter 66    CachedValue -0.160151    InfinityNormOfProjectedGradient 6.75378e-05
Iter 66    CachedValue -0.160291    InfinityNormOfProjectedGradient 6.75378e-05
Iter 66    CachedValue -0.160349    InfinityNormOfProjectedGradient 6.75378e-05
Iter 66    CachedValue -0.160289    InfinityNormOfProjectedGradient 6.75378e-05
Iter 66    CachedValue -0.160349    InfinityNormOfProjectedGradient 6.75378e-05
Iter 66    CachedValue -0.160287    InfinityNormOfProjectedGradient 6.75378e-05
Iter 66    CachedValue -0.160349    InfinityNormOfProjectedGradient 6.75378e-05
Iter 66    CachedValue -0.160352    InfinityNormOfProjectedGradient 6.75378e-05
Iter 66    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.75378e-05
Iter 66    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.75378e-05
Iter 66    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54521e-05
Iter 67    CachedValue -0.159162    InfinityNormOfProjectedGradient 6.54521e-05
Iter 67    CachedValue -0.160283    InfinityNormOfProjectedGradient 6.54521e-05
Iter 67    CachedValue -0.160287    InfinityNormOfProjectedGradient 6.54521e-05
Iter 67    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54521e-05
Iter 67    CachedValue -0.160288    InfinityNormOfProjectedGradient 6.54521e-05
Iter 67    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54521e-05
Iter 67    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54521e-05
Iter 67    CachedValue -0.160288    InfinityNormOfProjectedGradient 6.54521e-05
Iter 67    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54521e-05
Iter 67    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54521e-05
Iter 67    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54521e-05
Iter 67    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54736e-05
Iter 68    CachedValue -0.158687    InfinityNormOfProjectedGradient 6.54736e-05
Iter 68    CachedValue -0.160273    InfinityNormOfProjectedGradient 6.54736e-05
Iter 68    CachedValue -0.160287    InfinityNormOfProjectedGradient 6.54736e-05
Iter 68    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54736e-05
Iter 68    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54736e-05
Iter 68    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54736e-05
Iter 68    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54736e-05
Iter 68    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54736e-05
Iter 68    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54736e-05
Iter 68    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160267    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160303    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160289    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
Iter 69    CachedValue -0.160354    InfinityNormOfProjectedGradient 6.54687e-05
           Probe Tag    Starts    Stops             Time (s)
         Registration           1            1           38.5086



On Tue, 30 Jun 2009, Luis Ibanez wrote:

> Hi Serena,
>
> Why did you replace the
>
>    optimizer->GetCachedValue()
>
> with
>
>     optimizer->GetValue()
>
> ??
>
> With the original code
>
>    std::cout << optimizer->GetCurrentIteration() << "   ";
>    std::cout << optimizer->GetCachedValue() << "   ";
>    std::cout << optimizer->GetInfinityNormOfProjectedGradient() <<
> std::endl;
>
>
> I get output similar to
>
>
> Starting Registration
> 0   -0.126569   0
> 0   -0.128309   0
> 0   -0.132048   0
> 0   -0.145772   0
> 0   -0.206432   0
> 0   -0.304187   0
> 0   -0.304187   0.000164939
> 1   -0.359927   0.000164939
> 1   -0.359927   0.00022934
> 2   -0.289385   0.00022934
>
> when registering the images:
>
>   brainweb165a10f17.mha
>   brainweb165a10f17Rot20Tx20.mha
>
>
> Could you please restore the original code
> and let us know if this time you get non-zero
> outputs ?
>
>
>       Thanks
>
>
>             Luis
>
>
> --------------------------------------------------------------
> On Tue, Jun 30, 2009 at 4:00 PM, Serena Fabbri <fabbri at u.washington.edu>wrote:
>
>> Hi All,
>>
>> I am using DeformableRegistration8 with Mattes Mutual Information and
>> LBFGSBoptimizer.
>> I'd like to know how the MI and the parameters change in each iteration. In
>> the example, class CommandIterationUpdate is implemented  and I only add :
>>
>> std::cout <<"Iter "<<optimizer->GetCurrentIteration() << "   ";
>> std::cout <<" Metric "<<optimizer->GetValue() << ":";
>> std::cout <<" Parameters "<<optimizer->GetCurrentPosition() << std::endl;
>>
>> I use a Bspline-grid with 3 bound nodes and 3 node in the image and  I run
>> fixed=MRI (176, 256, 160) (1,1,1)mm   moving=CT (176, 256, 160) (1,1,1)mm
>>
>> The code runs, I get a pretty good registered image but Metric value and
>> parameters values are  always 0.
>> could anybody point out me where the error is?
>> are the above instructions wrong?
>>
>>
>> Thanks.
>>
>> Serena.
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> 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
>>
>





More information about the Insight-users mailing list