<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hello,<br>
</p>
<p><br>
</p>
<p>I am using ITK 4.7.2. I added a ProgressReporter to the <span style="font-size: 12pt;">
ThreadedGenerateData() method of a filter I am writing, with the following definition:</span></p>
<p><span style="font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"><br style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);">
</span></p>
<pre style="margin-top: 0px; margin-bottom: 0px;"><!--StartFragment--><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">ProgressReporter</span></span></span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"> </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">progress(</span></span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">this</span></span></span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">,</span></span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"> </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">threadId,</span></span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"> </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">region.GetNumberOfPixels(),</span></span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"> </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">10</span></span></span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">);</span></span><!--EndFragment--><br style="font-family: Calibri, Arial, Helvetica, sans-serif;"></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br style="font-family: Calibri, Arial, Helvetica, sans-serif;"></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif;">as per the documentation here: </span></span><span style="font-family: Calibri, Arial, Helvetica, sans-serif;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif;"><a href="http://www.itk.org/Doxygen/html/classitk_1_1ProgressReporter.html" id="LPlnk152212">http://www.itk.org/Doxygen/html/classitk_1_1ProgressReporter.html</a>. I then added a simple itk::Command subclass to print progress in percent.</span></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><font face="Calibri, Arial, Helvetica, sans-serif"><br></font></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span></span><font face="Calibri, Arial, Helvetica, sans-serif">However, when I run the program, the progress quite quickly reaches 100%, then no further ProgressEvents are raised. The program continues to execute and does finish eventually. </font><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">After looking at the code for ProgressReporter, I assume this is because thread 0 somehow out-competes the other threads and finishes its processing quite fast. The other threads then continue to run peacefully, but they don't touch the Progress counter.</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><font face="Calibri, Arial, Helvetica, sans-serif"><br></font></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><font face="Calibri, Arial, Helvetica, sans-serif">Is there a way to get a more accurate Progress report with multi-threading? Am I missing something?</font></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><font face="Calibri, Arial, Helvetica, sans-serif"><br></font></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><font face="Calibri, Arial, Helvetica, sans-serif">Thanks in advance,</font></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><font face="Calibri, Arial, Helvetica, sans-serif">Toby<br></font><br></pre>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><br>
</p>
</div>
</body>
</html>