Hi Luis and ITK Staff,<br><br>It is a good think to start the working week with a good new !!! ;)<br>Of course, I've tried successfully your attached code and I'll profit from your suggestions to get good segmentations.<br>
<br>Thank u very much<br><br>Silvano<br><br><br><div class="gmail_quote">On Sun, Oct 17, 2010 at 4:22 PM, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Hi Silvano,<br><br>Thanks a lot for the clear description of the problem<br>that you are observing, <br>
<br>and for providing self-contained code that makes <br>very easy to reproduce your observation.<br><br><br>The good news: <br>
<br> You code works fine <br><br>(with some small modifications)<br><div class="gmail_quote"><br><br>Essentially, the problem is that you are letting the<br>level set run for too many iterations, and that the<br>
value of RMS tolerance for convergence is too <br>high, so the shape detection level set filter doesn't<br>stop by itself.<br><br>This also implies that the edge image have values<br>that are not close enough to zero at the boundary<br>
of the circle.<br><br>-----<br><br>The proper time to stop (for this image) is around<br>iteration 65 instead of the current 1000.<br><br>and<br><br>a better RMS tolerance, for this image, is 0.2<br>instead of the current 0.02.<br>
<br><br>How do we get to these magic numbers ?<br><br>You may wonder... :-)<br><br><br>Here it is:<br><br>(The modified source code is attached)<br><br><br>1) We added a command observer and print the<br> values of RMS change for every iteration<br>
of the filter.<br><br>2) We plotted this values with gnuplot, or you favorite<br> Open Source plotting program. <br> (plots also attached)<br><br>3) To make the experimentation easier we added the<br> number of iterations and the RMS tolerance values<br>
to the list of command line parameters.<br> <br>4) We ran<br><br> ./segment 101 10 1 1 1 10 1000 0.2 > data1000.txt<br><br> and got the plot on the attached file data1000.png<br><br> In this plot, you can see that there is an obvious dip<br>
in the RMS change values, somewhere before iteration<br> 100, which happens to be when the level set slowed <br> down at the edge of the circle. <br><br> Then, once the level set crosses that boundary, it <br> goes on propagating outside the circle from iterations<br>
~100 to ~200. Then, just after 200, it peaks and <br> then drops to a noise level oscillating between 0.0 <br> and 0.15 RMS change.<br><br> The behavior around 200 correspond to the period<br> of time when the circular level set touches the <br>
boundary of the image, and then starts getting out<br> of the image, until when the circle is fully outside <br> of the image.<br><br> All that, tell us that we have to go back and focus<br> on the iterations just before 100.<br>
<br><br>5) So, we ran<br><br> ./segment 101 10 1 1 1 10 100 0.2 > data100.txt<br>
<br> and again, used gnuplot to generate <br> the attached plot data100.png<br><br> This plot showed us that the really interesting <br> stuff happened around iteration 65, when the <br> RMS change dropped to about 0.2.<br>
<br><br><br>So, that gave us the hint that the proper value to use<br>for RMS tolerance is 0.2 (or something close to it).<br><br><br>So, finally we ran<br><br><br>6) ./segment 101 10 1 1 1 10 100 0.2 > data100b.txt <br>
<br> ( Note the replacement of 0.02 with 0.2)<br><br> and this time the level set stops at iteration 65<br> producing the attached plot data100b.png<br><br><br>----<br><br><br>In retrospective, we could also blame the edge.nii<br>
image for not being close enough to zero at the<br>edge of the circle.<br><br>Should the edge image had real zero values,<br>the level set would not have been able to cross<br>it (regardless of whether we let it run to many<br>
iterations).<br><br>When you look closer at the edge.nii image,<br>you will notice that the minimum pixel value<br>is 0.336. Which means that the level set <br>will slow down to "speed" 0.33 at those locations<br>
but will not stop at the edge. In order to stop the<br>level set (irrespectively of the RMS tolerance <br>and the maximum number of iterations) you need<br>to have zero values in the edge image.<br><br>------------------------------------------------------------<br>
<br>In summary:<br><br>A) The Edge image could have been better<br>B) The RMS tolerance was to stringent<br>C) The level set ran for way too many iterations<br>D) Plotting and visualization always help<br><br><br> Regards,<br>
<br><br> Luis<br> <br><br>--------------------------------------------------------------<div class="im"><br>On Wed, Sep 29, 2010 at 1:03 PM, silvano <span dir="ltr"><<a href="mailto:silagliozzo@gmail.com" target="_blank">silagliozzo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi all,<br><br>I would like to use the very usefull ITK classes to segment mammographic images with level set methods.<br>
In order to learn these classes, I run properly the examples provided with the library and explained in the software guide.<br>
Therefore, I've tried to apply the filter ShapeDetectionLevelSetImageFilter to a very simple circular model,<br>but I cannot obtain any reasonable segmentation. <br><br>Hereafter, I report the code used (sorry for the long list of code lines!! :) ).<br>
The application accepts a list of arguments, precisely :<br>1_size_model 2_amplitude_model 3_sigma_smoothing 4_propagationscale 5 curvaturescale 6_levelset_initialvalue<br>I tried a lot of different argument lists, among them you can try the following one<br>
101 10 1 1 1 10<br><br>I would very appreciate to receive any comment, suggestion to solve the problem.<br><br>Thank u in advance,<br><br>Silvano<br><br><br></blockquote></div></div>
</blockquote></div><br>