<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hello,<div><br></div><div>There are lots of reasons this could occur.</div><div><br></div><div>1) You are correct that it could be because you algorithms is horribly unbalanced and not making even use of the threads. I don't know your filter.</div><div>2) Your filter could be completed, then your program is doing something else. Observe other events such EndEvent to know when all threads in the filter have completed.</div><div>3) This ITK approach is generally reasonably accurate, and more complicated thread locking methods are generally not worth the trouble or performance penalty.</div><div><br></div><div>I suspect there is a problem with your algorithm or how you are using the progress reporter.</div><div><br></div><div>HTH,</div><div>Brad</div><div><br><div><div>On Jun 15, 2015, at 5:15 AM, Wood, Tobias <<a href="mailto:tobias.wood@kcl.ac.uk">tobias.wood@kcl.ac.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div id="divtagdefaultwrapper" style="font-size: 12pt; background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif;"><div style="margin-top: 0px; margin-bottom: 0px;">Hello,<br></div><div style="margin-top: 0px; margin-bottom: 0px;"><br></div><div style="margin-top: 0px; margin-bottom: 0px;">I am using ITK 4.7.2. I added a ProgressReporter to the<span class="Apple-converted-space"> </span><span style="font-size: 12pt;">ThreadedGenerateData() method of a filter I am writing, with the following definition:</span></div><div style="margin-top: 0px; margin-bottom: 0px;"><span style="font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif;"><br style="font-family: Calibri, Arial, Helvetica, sans-serif;"></span></div><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="font-family: Calibri, Arial, Helvetica, sans-serif;">ProgressReporter</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif;"> </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif;">progress(</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif;">this</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif;">,</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif;"> </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif;">threadId,</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif;"> </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif;">region.GetNumberOfPixels(),</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif;"> </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif;">10</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif;">);</span><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;">as per the documentation here: </span><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></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><div style="margin-top: 0px; margin-bottom: 0px;"><span style="font-size: 12pt;"><br></span></div><div style="margin-top: 0px; margin-bottom: 0px;"><br></div></div>_______________________________________________<br>Community mailing list<br><a href="mailto:Community@itk.org">Community@itk.org</a><br><a href="http://public.kitware.com/mailman/listinfo/community">http://public.kitware.com/mailman/listinfo/community</a></div></blockquote></div><br></div></body></html>