[Insight-users] Segmentation simple circular model with level sets

Luis Ibanez luis.ibanez at kitware.com
Sun Oct 17 10:22:39 EDT 2010


Hi Silvano,

Thanks a lot for the clear description of the problem
that you are observing,

and for providing self-contained code that makes
very easy to reproduce your observation.


The good news:

                You code works fine

(with some small modifications)


Essentially, the problem is that you are letting the
level set run for too many iterations, and that the
value of RMS tolerance for convergence is too
high, so the shape detection level set filter doesn't
stop by itself.

This also implies that the edge image have values
that are not close enough to zero at the boundary
of the circle.

-----

The proper time to stop (for this image) is around
iteration 65 instead of the current 1000.

and

a better RMS tolerance, for this image, is 0.2
instead of the current 0.02.


How do we get to these magic numbers ?

You may wonder...    :-)


Here it is:

(The modified source code is attached)


1) We added a command observer and print the
    values of RMS change for every iteration
    of the filter.

2) We plotted this values with gnuplot, or you favorite
    Open Source plotting program.
    (plots also attached)

3) To make the experimentation easier we added the
     number of iterations and the RMS tolerance values
     to the list of command line parameters.

4) We ran

 ./segment 101 10 1 1 1 10 1000 0.2 > data1000.txt

    and got the plot on the attached file data1000.png

  In this plot, you can see that there is an obvious dip
  in the RMS change values, somewhere before iteration
  100, which happens to be when the level set slowed
  down at the edge of the circle.

  Then, once the level set crosses that boundary, it
   goes on propagating outside the circle from iterations
   ~100 to ~200.   Then, just after 200, it peaks and
   then drops to a noise level oscillating between 0.0
   and 0.15 RMS change.

   The behavior around 200 correspond to the period
   of time when the circular level set touches the
   boundary of the image, and then starts getting out
   of the image, until when the circle is fully outside
   of the image.

   All that, tell us that we have to go back and focus
   on the iterations just before 100.


5) So, we ran

 ./segment 101 10 1 1 1 10 100 0.2 > data100.txt

   and again, used gnuplot to generate
   the attached plot data100.png

    This plot showed us that the really interesting
    stuff happened around iteration 65, when the
    RMS change dropped to about 0.2.



So, that gave us the hint that the proper value to use
for RMS tolerance is 0.2 (or something close to it).


So, finally we ran


6) ./segment 101 10 1 1 1 10 100 0.2 > data100b.txt

    ( Note the replacement of 0.02 with 0.2)

    and this time the level set stops at iteration 65
    producing the attached plot data100b.png


----


In retrospective, we could also blame the edge.nii
image for not being close enough to zero at the
edge of the circle.

Should the edge image had real zero values,
the level set would not have been able to cross
it (regardless of whether we let it run to many
iterations).

When  you look closer at the edge.nii image,
you will notice that the minimum pixel value
is  0.336.    Which means that the level set
will slow down to "speed" 0.33 at those locations
but will not stop at the edge.  In order to stop the
level set (irrespectively of the RMS tolerance
and the maximum number of iterations) you need
to have zero values in the edge image.

------------------------------------------------------------

In summary:

A)  The Edge image could have been better
B)  The RMS tolerance was to stringent
C)  The level set ran for way too many iterations
D)  Plotting and visualization always help


   Regards,


       Luis


--------------------------------------------------------------
On Wed, Sep 29, 2010 at 1:03 PM, silvano <silagliozzo at gmail.com> wrote:

> Hi all,
>
> I would like to use the very usefull ITK classes to segment mammographic
> images with level set methods.
> In order to learn these classes, I run properly the examples provided with
> the library and explained in the software guide.
> Therefore, I've tried to apply the filter ShapeDetectionLevelSetImageFilter
> to a very simple circular model,
> but I cannot obtain any reasonable segmentation.
>
> Hereafter, I report the code used (sorry for the long list of code lines!!
> :) ).
> The application accepts a list of arguments, precisely :
> 1_size_model 2_amplitude_model 3_sigma_smoothing 4_propagationscale 5
> curvaturescale 6_levelset_initialvalue
> I tried a lot of different argument lists, among them you can try the
> following one
> 101 10 1 1 1 10
>
> I would very appreciate to receive any comment, suggestion to solve the
> problem.
>
> Thank u in advance,
>
> Silvano
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101017/2345d01a/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: data1000.png
Type: image/png
Size: 4566 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101017/2345d01a/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: data100.png
Type: image/png
Size: 5664 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101017/2345d01a/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: data100b.png
Type: image/png
Size: 5149 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101017/2345d01a/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cxx.gz
Type: application/x-gzip
Size: 1779 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101017/2345d01a/attachment.bin>


More information about the Insight-users mailing list