[ITK-users] Getting computation time per iteration of registration process

Abu-Sammour, Denis Denis.Abu-Sammour at medma.uni-heidelberg.de
Fri May 8 09:41:57 EDT 2015


Hi Matt,

So the problem was resolved by declaring the “ itk::TimeProbe Clock” as a global variable , then I put the “Clock.Start()” method just before “ Registration->Update()“ and then the Stopping point “Clock.Stop()” was put just before the “cout” statements in the “itk::Command” class as below:

class CommandIterationUpdate : public itk::Command
{…
Clock.Stop();
std::cout << Clock.GetMean() << "    ";
std::cout << optimizer->GetCurrentIteration() << "   ";
std::cout << optimizer->GetValue() << "   ";
std::cout << optimizer->GetCurrentPosition() << std::endl << std::endl;
Clock.Start();
…}

Thanks

Denis

Von: Matt McCormick [mailto:matt.mccormick at kitware.com]
Gesendet: Donnerstag, 7. Mai 2015 17:22
An: Abu-Sammour, Denis
Cc: Guillaume Lemaître; insight-users at itk.org
Betreff: Re: [ITK-users] Help

Hi Denis,

An itk::Command class can be created to observe the IterationEvent [1].  Many of the registration examples have code that uses a Command to print out status at each iteration.

Hope this helps,
Matt

[1] http://itk.org/ITKExamples/src/Core/Common/ObserveAnEvent/Documentation.html

On Thu, May 7, 2015 at 10:59 AM, Abu-Sammour, Denis <Denis.Abu-Sammour at medma.uni-heidelberg.de<mailto:Denis.Abu-Sammour at medma.uni-heidelberg.de>> wrote:
Thanks for the reply.

My exact problem is where to put the TimeProbe functions. So I tried to place the “clock.Start()” and “clock.Stop()” methods around “registration->Update()” as follows

itk::TimeProbe clock;
  try
    {
                  clock.Start();
    registration->Update();
                clock.Stop();
…

And in this case I got a total computation time for the registration process of about 6.8 seconds. Now given that there are 22 iterations until convergence for that particular case the average time per iteration would be 6.8/22= 0.31 seconds per iteration. Now I tried placing the “clock.Start()” and “clock.Stop()” inside the body of the “Execute()” function as suggested by  Guillaume and got numbers ranging between 0.004 to 0.007 per iteration so its much lower than the anticipated 0.31 sec per iteration. Please advise.

Thanks.

Denis


Von: Matt McCormick [mailto:matt.mccormick at kitware.com<mailto:matt.mccormick at kitware.com>]
Gesendet: Donnerstag, 7. Mai 2015 16:14
An: Guillaume Lemaître
Cc: Abu-Sammour, Denis; insight-users at itk.org<mailto:insight-users at itk.org>
Betreff: Re: [ITK-users] Help

Hi,

The TimeProbe [1] and RealTimeClock [2] classes could be useful here.

Matt

[1] http://itk.org/ITKExamples/src/Core/Common/ComputeTimeBetweenPoints/Documentation.html

[2] http://www.itk.org/Doxygen/html/classitk_1_1RealTimeClock.html

On Thu, May 7, 2015 at 8:36 AM, Guillaume Lemaître <g.lemaitre58 at gmail.com<mailto:g.lemaitre58 at gmail.com>> wrote:
Hi,
I am not 100% sure since that I didn't put the hand in the code but the function Execute() seems to be call at each iteration since that they show the parameter values. Maybe put a timer there.
Cheers,

On 7 May 2015 at 13:38, Abu-Sammour, Denis <Denis.Abu-Sammour at medma.uni-heidelberg.de<mailto:Denis.Abu-Sammour at medma.uni-heidelberg.de>> wrote:
Hello,

Based on Example: ImageRegistration6.cxx (or any other registration example) how can I get the elapsed time for the evaluation of each iteration step of the registration process?

Thanks

Denis


_____________________________________
Powered by www.kitware.com<http://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://public.kitware.com/mailman/listinfo/insight-users



--
LEMAÎTRE Guillaume
PhD Candiate
MSc Erasmus Mundus ViBOT (Vision-roBOTic)
MSc Business Innovation and Technology Management

g.lemaitre58 at gmail.com<mailto:g.lemaitre58 at gmail.com>

ViCOROB - Computer Vision and Robotic Team
Universitat de Girona, Campus Montilivi, Edifici P-IV 17071 Girona
Tel. +34 972 41 98 12<tel:%2B34%20972%2041%2098%2012> - Fax. +34 972 41 82 59<tel:%2B34%20972%2041%2082%2059>
http://vicorob.udg.es/
LE2I - Le Creusot
IUT Le Creusot, Laboratoire LE2I, 12 rue de la Fonderie, 71200 Le Creusot
Tel. +33 3 85 73 10 90<tel:%2B33%203%2085%2073%2010%2090> - Fax. +33 3 85 73 10 97<tel:%2B33%203%2085%2073%2010%2097>
http://le2i.cnrs.fr

[https://sites.google.com/site/glemaitre58/_/rsrc/1340103962984/config/le2i.png]  [https://sites.google.com/site/glemaitre58/_/rsrc/1340103388011/config/vico.png]   [https://sites.google.com/site/glemaitre58/_/rsrc/1340103887254/config/ub.png]   [https://sites.google.com/site/glemaitre58/_/rsrc/1340103809482/config/udg.png]   [https://sites.google.com/site/glemaitre58/_/rsrc/1340104225210/config/vibot.png]
https://sites.google.com/site/glemaitre58/
Vice - Chairman of A.S.C. Fours UFOLEP
Chairman of A.S.C. Fours FFC
Webmaster of http://ascfours.free.fr

_____________________________________
Powered by www.kitware.com<http://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://public.kitware.com/mailman/listinfo/insight-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150508/c21c1a06/attachment-0001.html>


More information about the Insight-users mailing list