[Insight-users] Get the time spent from the image registration process?

C.Cagatay Bilgin bilgic at cs.rpi.edu
Tue Dec 8 14:06:50 EST 2009


Hi motes,
I think what you want is

itk::TimeProbe timer1;
timer1.Start();
....
timer1.Stop();
double time_elapsed = (double) timer1.GetMeanTime();

I did not use the collector base but there is probably a
way to access the timeProbe map in it.

Regards,
Cagatay Bilgin


On Dec 8, 2009, at 11:08 AM, motes motes wrote:

> How do I get the time used  from the image registration process?
> Currently I do this:
>
>
>    itk::TimeProbesCollectorBase collector;	
>    try {
>      collector.Start( "Registration" );
>      registration->Update();
>      collector.Stop( "Registration" );
>    }
>    catch( itk::ExceptionObject & err ) {
>      std::cerr << "ExceptionObject caught !" << std::endl;
>      std::cerr << err << std::endl;
>      return;
>    }
>
>    // Report the time taken by the registration
>   collector.Report();
>
>
> But then the time consumption just gets written to the terminal. I
> would like to store the time consumption in variable that I use later
> in my application:
>
> double time =    collector.Report();
>
> but that is a no-go since the Report() function is void. I have tried
> passing a std::ostringstream to the Report function:
>
>    std::string t_str = "";
>    std::ostringstream ostr(t_str);
>    collector.Report(ostr);
>    std::cout << "ostr = " << ostr <<  std::endl;
>
> But that just prints something that looks like an address in memory.  
> Any ideas?
> _____________________________________
> Powered by 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.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