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

motes motes mort.motes at gmail.com
Tue Dec 8 11:08:51 EST 2009


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?


More information about the Insight-users mailing list