<div dir="ltr">Hi,<div> I am trying to monitor the progress of a levelset filter using a Progressevent callback.</div><div>I am thresholding the level set output with a thresholding filter and this works as expected in terms of the end results.</div><div>However, <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> I am trying to monitor the progress of a levelset filter using a Progressevent callback and</span> it is not working inside the progressevent callback.</div><div><br></div><div>Here's the code:</div><div>....</div><div>Set up level and threshold filter</div><div>...</div><div>#define call back function</div><div>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap">def myCommand():</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> global k</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> if k % 10==0:</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> thresholder.Update()</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> print(levelsetfilter.GetMTime()) #print mtime for levelset filter and then thresholdfilter</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> print(thresholder.GetMTime())</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> print("----")</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> save_rgb(levelsetfilter.GetOutput(),'mont' + str(k)+ '.png')</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> </p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"> k=k+1</p><br></div><div>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><br></p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap">k=0</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap">levelsetfilter.AddObserver(itk.ProgressEvent(), myCommand )</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap">levelsetfilter.Update()</p>
<p style="margin:0px;text-indent:0px;white-space:pre-wrap"><br></p><p style="margin:0px;text-indent:0px;white-space:pre-wrap"><br></p><p style="margin:0px;text-indent:0px;white-space:pre-wrap">The output from the print statements are:</p><p style="margin:0px;text-indent:0px"><span style="white-space:pre-wrap">18702
<b>18145</b>
----
18738
<b>18145</b>
----
18765
<b>18145</b>
----
18792
<b>18145</b>
----
18819
<b>18145</b>
</span>...</p><p style="margin:0px;text-indent:0px">...</p><p style="margin:0px;text-indent:0px">...</p><p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">So the mtime for the threshold filter never gets modified when inside the call back.</p><p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">What is the reason for this? Is there something particular about the execution pipeline when inside a callback like this?</p><p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">Thanks!</p><p style="margin:0px;text-indent:0px">Soren</p><br></div><div><br></div><div><br></div></div>