In this exercise
you will implement the Marching Cubes algorithm by Lorensen and
Cline.
We supply you with an image class CtImage1 which is found here. Your program will input three
parameters: an input file name with a serialized java Vector
describing the CtImages, an output file name, and an iso value. The
output will be a VRML model.
Example:
java MarchingCubes 150 case1ImageData.obj case1.wrl
150 - The iso-surface value.
case1ImageData.obj
- A file containing a serialized Vector containing CtImages (in this case
two images).
case1.wrl
- The output file describing the triangles the marching cubes algorithm
created.
We now take a look
at the content of the VRML file. Marked in red are the interesting parts:
#VRML V2.0 utf8
Shape{
|
To test your program start by running it on the above data set and see that you get a similar result. The file we provide here is similar to the above example but contains more data at the location of each pixel which is below the iso-value (150) we placed a gray sphere and at the locations of pixels above the iso-value red spheres. This approach can help you test your programs on the 15 basic cases.
Two important issues
are: (a) do not create multiple appearances of the same vertex, originating
from neighboring cubes, and (b) your implementation should be as time-efficient,
as possible.