This program implements the fast marching and level set methods for image segmentation. These two methods are developed by Professor Sethian at UC Berkeley. For details of these techniques, see http://math.berkeley.edu/~sethian/ Firstly, the fast marching is used to extract rough boundaries. Secondly, the level set is used to fine tune the rough contour. The latter is optional for some images. This is because though the level set can smoothen the contour, some details can also be lost. Using the level set with no fast marching presumably yields similar results, but takes much longer computation time. Crucial parameters in the program are: 1. FMStep - steps of fast marching iteration, if too few, not all boundaries captured, if too many, contours go beyond the true boundary 2. ALPHA - exponent in the speed term for fast marching, ideally, speed term approaches zero at the boundary 3. iter_inner - steps of iterations for the level set inner loop. Though we have a method "reachBoundary()" to check if the narrow band boundary is reached, we found that the contour often goes too far to ensure that the narrow band boundary is reached. This takes too much time and is unnecessary for fine tuning results. So instead, we simply specify step of iterations, which depends on the image. 4. iter_outer - steps of iterations for the level set outer loop. After each outer iteration, the program reinitializes phi values, narrow band, etc. Usually, only a few steps of outer iteration are needed for fine tuning. For instance, 2 or 3 iterations are sufficient for the "angio" image (see below). 5. DELTA_T - time step, it depends on the desired contour quality and how fast you want to get it. 0.0005 is good for our computation. 6. bandWidth - narrow band width, narrow band is used to reduce the time for phi updating. 3 - 6 works well for our images. 7. FA - advection force term, usually set to 1, as suggested by Sethian et al. 8. EPSILON - curvature force term, depend on how round you want the corner to be 9. BETA - attraction force term, it controls the significance of the attraction term, but we found that varying BETA hardly affects results. Trick for the fast marching: The gradient magnitude in the speed term should be kept small (it is stretched between 0 and 1 in our implementation), large magnitudes could fail the the updating of T values, causing incorrect pixels to be selected. After the fast marching, the gradient magnitude are stretched back to 0 ~ 255 for the level set step. Usage: Two versions of this program are available, a GUI version that include a Swing GUI, and plain version that does the segmenttation. For the GUI version, the following files are needed: LevelSet.java and LevelSetGUI.java 1. type "javac LevelSetGUI.java" to compile, then to launch the program, type "java LevelSetGUI". 2. click File->Open to load a .pgm format image file 3. right mouse click to pick seed point(s) 4. change the control parameters (see above) if needed 4. click "Start" to invoke the segmentation program The Swing GUI is fairly straightforward to use. Upon finishing, the contour will be drawn on the image. For the plain version, only one file is needed: LevelSet.java. This file slightly differs from its GUI counterpart that must be modified for GUI. Besides that, two LevelSet.java files are the same. 1. manually change the parts of code that specify the seed points and add seed points 2. modify the control parameters at the begnning of the program 3. type "javac LevelSet.java" to compile, then to launch the program, type "java LevelSet inputImage outImage". Note: 1. Because the plain version requires user to modify the code for every image, the GUI version is strongly recommended. The GUI version can also save the image with found contour to a "jpg" format file. The plain version is provided mainly for the completeness. 2. Both input and output files for the plain version are in "pgm" format. On the unix platform, "xv" and many other programs can be used to display .pgm images. 3. "angio" and "brain" are two pgm input images for your testing. Thank you. Ding, Fan (fan@cs.wisc.edu)