<div dir="auto"><div>Hi Dzenan,</div><div dir="auto"> Thanks!</div><div dir="auto">It does seem that the level sets filter mtime is changing though (top number)?</div><div dir="auto">I managed to get it working by initializing the threshold filter inside the progress callback. The output now changes with each callback.</div><div dir="auto"><br><br>Thanks!</div><div dir="auto">Soren<br><br><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Sun, May 6, 2018, 08:52 Dženan Zukić <<a href="mailto:dzenanz@gmail.com" target="_blank" rel="noreferrer">dzenanz@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Soren,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">progress events do no modify the filter, hence the MTime does not change. MTime changes when filter's parameters are changed - and only the ones which require re-computation of the output.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Regards,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Dženan</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, May 5, 2018 at 6:08 PM Soren Christensen <<a href="mailto:sorench@gmail.com" rel="noreferrer noreferrer" target="_blank">sorench@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>
The ITK community is transitioning from this mailing list to <a href="http://discourse.itk.org" rel="noreferrer noreferrer noreferrer" target="_blank">discourse.itk.org</a>. Please join us there!<br>
________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer noreferrer noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer noreferrer noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer noreferrer noreferrer" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer noreferrer noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://itk.org/mailman/listinfo/insight-users" rel="noreferrer noreferrer noreferrer" target="_blank">https://itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div>
</blockquote></div></div></div>