AW: [Insight-users] How to tune parameters
Waltraud Henrich
henrich@ira.uka.de
Thu, 13 Feb 2003 14:08:11 +0100
Hello,
Where can I find the FastMarchingLevelSet demo application? I find at
Examples/Segmentation : FastMarchingImageFilter.cxx,
FastMarchingImageFilter.dsp, FastMarchingImageFilter.dsp.cmake. (With =
FLTK I
don't have yet worked only with QT).=20
Thank of lot.
Waltraut
-----Urspr=FCngliche Nachricht-----
Von: Luis Ibanez [mailto:luis.ibanez@kitware.com]
Gesendet: Mittwoch, 12. Februar 2003 18:00
An: Waltraud Henrich
Cc: 'insight-users@public.kitware.com'
Betreff: Re: [Insight-users] How to tune parameters=20
Hi Waltraud,
The SoftwareGuide.pdf describes the FastMarchingImageFilter
in detail in Section 8.3.1, pdf-pages 262-267.
http://www.itk.org/ItkSoftwareGuide.pdf
Since the parameters should match the caracteristics
of the image, let me describe below the parameters
that work ok for one of the standard BrainWeb images.
By running the example with this image you will be
able to see the characteristics of the intermediate
outputs and then apply this experience to tune the
parameters for your own image data.
The BrainWeb images are available at
ftp://public.kitware.com/pub/itk/Data
-----------------
So, Please do the following:
1) Copy the image: brainweb1e1a10f20.mha
to your disk
2) Run the FastMarchingLevelSet demo application.
3) Click in the "Load" button and select the image.
(the file .mha)
4) Click in "Display" below "Load". A viewer will
appear. You will notice that there is a certain
amount of noise in this image. It was intentionaly
generated with a 3% noise factor. The amount of noise
will be related to the value of Sigma that you will
use in the GradientMagnitude filter. Noiser images
require larger sigmas... but a Sigma too large will
degrade edges, so you don't want to go too far with
sigma. Note tha Sigma is provided in millimeters,
not pixels. So, before you try your image, make sure
that the spacing values of your image are consistent.
5) The default Sigma value of 1.2 is ok for this image.
This filter will compute the magnitude of the image
gradient by a procedure that is equivalent to convolving
with a Gaussian kernel, and then take derivatives.
The Sigma that you are defining will determine the
amount of smoothing applied to the image before the
derivation takes place.
6) Click on the "Display" button following the
"GradientMagnitude" button. In 10 to 20 seconds a
viewer will appear.
7) BTW, we will try to segment the ventricles in this
exercise...
8) The FastMarchingImageFilter needs a speed image as
input. We want to construct this image in such a way
the the level set front has almost zero speed close
to the edges of the anatomical structure that we want
to segment, and has speed close to 1.0 in the inside
of this structure. In order to build this speed image
we take the GradientMagnitude image and map its intensity
values through a sigmoid. There are four parameters in
the Sigmode. Two of them are fixed in this example. They
are the min and max of the output, which are set to 0.0
and 1.0. Since those are the extreme values we want for
the speed.
9) The two other parameters of the sigmoid are "alpha"
and "beta". They are explained in the SoftwareGuide.
let just say here that they apply a linear transform
to the intensities before they are passed through the
sigmoid. Something like ( I - Beta ) / Alpha.
Here is how you want to tune this values. Go to the
Gradient magnitude image, select slice # 96. click
on the faintest sector of the contour around the
ventricles and note this value. It should be something
around 10.0. Now, go to the inside of the ventricles
and click on several points to get an idea of the internal
values. They will be around 0.0~2.0.
So, what you want is a mapping that will convert 2.0 into 1.0
and 10.0 into 0.0. This will make that speed is 0.0 even
in the faintest sector of the edge, while speed is 1.0 in
the middle of the structure.
Beta should then be in the middle of your range 2.0 to 10.0
That is, Beta should be about 6.0. Alpha should always be
negative since we want to map high values into low values.
Alpha should be about 1/3 of the width of the interval you
want to accept. (this comes from the natural waist of the
Gaussian like function which is the derivative of the
Sigmoid. So, an alpha of -1 is ok for segmenting the
ventricles in this image.
10) Click on the "Display" button after the "Linear+Sigmoid"
button. In 3 ~ 5 second a viewer will apppear. Go to
slice 97 and verify that pixel values in the black areas
around the ventricles are about 0.0 and the internal zones
are close to 1.0.
This is crucial for the LevelSet methods to succed.
The speed image is the only anatomical information that the
level set method will get. Segmentation will be as good as
this image is...
11) The FastMarching filter computes a Time crossing map. This is
it computes how long it will take for the front to get to
each pixel. The front propagates from seed points that you
will provide (in one of the following steps). We will place
those seeds in the middle of the ventricles and will hope
that the front propagation will slow down considerable when
it gets to the edges.
Since we don't care about computing the time map for all
the rest of the image (just close to the ventricles), we may
tell the FastMarching method to stop propagating the front
when it comes to a certain "time" in the time crossing map.
By default this time is selected as 50. This is good enough
for our current case. The front propagates about a speed 1.0,
(pixels per iteration), so allowing 50 (in time) we could
expect that the front could have time to reach any edge that
is at less than 50 pixels from the seeds.
This is ok for the ventricles, but larger structures may
require higher stopping times. If the time happens to be
too low for your structure, this will be quite ovious when
you see the time crossing map, since you will see a spherical
front inside your anatomical structure, indicating that the
front is still running toward the edges.
12) Before runnint the FastMarchin, Select the SEEDS !
This is done in the viewer of the input image. So, click
on the Display button below the Load button. Go to slice 97
And click once inside each ventricle. (if you make wrong
clicks you can use the "Clear Seeds" buttons below the
FastMarching button and restart from scratch).
The seed will be highlighted as red pixels in the input image.
13) Once the seeds are selected you can run the filter.
Click on the "TimeCrossingMap" button. In about 4 second
another viewer will appear with an almost binary image.
Clicking on its pixels will reveal that the black areas have
low values (lower that 50) and the white areas have almost
infinity values. The infinity (in time) indicates that the
front never got there. Which is normal since we asked the
filter to stop at time 50.
We are almost done here.... :-)
14) Now we just need to threshold this time crossing map and
we will get the ventricles.
So, what threshold to chose ?
The minimum of course is 0.0, so just use 0.0 for the lower
threhsold value in the threshold filter.
In order to select the Upper threshold do the following:
Go to the Time Crossing map and explore (clicking) the pixels
close to the border of the structure. You will notice how
fast the values change on the border. We want to take an
intensity value very close to the border. For example 20.
(note that it has to be lower than 50, since we stop the
front at that time).
So, put 50 in the Upper threshold and click on the
"Overlay" button on the upper right.
This will threshold the time crossing map and display it
in red over the input image. Go to slice 97 and see the
segmentation.
15) You will note that the red zones are not exactly on the
edges. This is natural since by setting speeds to 0.0 we
prevent the front from getting to the edge. It will need
an infinity time to get there.
You may play with the Upper threshold (increasing it) in
order to get closer to the edges, but don't expect to get
the front exactly on the edge since this is certainly
imposible.
Note that the higher the Sigma used in the GradientMagnitude,
the farther away your front will be from the edges. If you
reduce sigma there are better chances of getting closer to
the edges. But... smaller sigmas may not get rid of the
noise in your image and produce a speed map plenty of bumps
where not event a level set will like to drive :-)
You could justify to apply a post-processing step to this
segmentation, by using a Mathematical Morphology Dilation
using an structuring element whose radius is proportional
to the sigma value used in the Gradient Magnitude. It will
be a sort of "compensation" for stopping earlier the front.
Are you still reading ?
If so,
You may be now in a better position for feeding your data
into this application and figure out the parameter values
to use.
Please let us know if you have further questions.
Thanks
Luis
------
Waltraud Henrich wrote:
> Hello,
>=20
>=20
> I work with itkFastMarchingImageFilter and I don't know what kind of=20
> value I get to my parameters ( alpha, beta, sigma,threshold,stoping =
time).
> (I have a image in 3D and the greyscale are from 0 to 256.)
>=20
> I want to thanks for your help in advance.
>=20
>=20
> Waltraut
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>=20
>=20