[Insight-developers] New class: ProgressReporter
Will Schroeder
will . schroeder at kitware . com
Fri, 30 Aug 2002 15:04:56 -0400
Hi Brad-
I haven't looked at this too carefully but you might want to update as a
percentage of completion rather than the number of updates. That way you'll
get 20 updates every execution (using a 5% completion increment) no matter
the size of the data. Using the number versus a percentage means that on
small data sets you'll get no updates, and on large datasets 100's or even
thousands of updates. Probably the best way is to use timer events, but
this is asking for trouble. What do you think?
Will
At 02:51 PM 8/30/2002 -0400, Brad King wrote:
>Hello, all:
>
>I recently noticed that many of ITK's image filters have duplicate code
>for calculating the current progress based on the fraction of output
>pixels that have been completed. Many filters seem to have slightly
>differing versions of this code because of fixes that were only applied to
>one filter.
>
>The reporter's constructor automatically sets progress to 0, and the
>destructor sets it to 1. The CompletedPixel() method is an inline method
>that efficiently updates the progress at an interval determined by the
>number of updates. The default number of updates is 100, but a fourth
>argument can be given to the constructor to alter this setting.
>
>When there are multiple threads, only thread 0 will report progress.
>This assumes that all threads have approximately the same amount of work
>to do, or at least that thread 0 has the most work. When there are no
>threads, the thread id argument should be 0. I considered having the
>thread id be optional, but realized that this could result in having every
>thread report progress if the argument is accidentally left off.
>
>-Brad
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers@public.kitware.com
>http://public.kitware.com/mailman/listinfo/insight-developers