Source code:
Sample pictures:
The following are the greylevel, binary and histogram equalized
images of the left ventricle of a dog. They were acquired by
computed tomography and have been sliced along the given axes
for a 2D visualization.



This assigment intoduced me to 3D image representation and how they
can be viewed in 2D using slicing. The program has two set of options.
One specifies along which axis the slice should be made and the other
the depth at which the slice is made. Once an axis and the depth are
specified, the program retrieves a plane formed by the other two
axes. For example, if you choose to slice along the X axis and specify
a depth of 45, a Y-Z plane is retrieved with X=45. Using a 3
dimensional array, this is very easy to implement. Here is the
code that slices along a specific X value.
private int[] sliceX(int x)
{
p = 0;
for (int b=0; b < 64; b++)
for (int c=0; c < 64; c++)
{ section[p] = image[x][b][c]; p++; }
return section;
}
Zoom was implemented using Java's drawImage command. drawImage takes 5 parameters - the image, start x, start y, the width and the height. By specifying width and height as 'zoom x width' and 'zoom x height', the desired zoom effect was achieved as Java stretches the image to fit within the specified coordinates.
public void paint(Graphics g)
{
if (outputImage != null)
g.drawImage(outputImage, 0, 0, zoom*64, zoom*64, this);
else
System.err.println("Attempted to display null image.");
}
In this case, the width and the height of the image were fixed (64 pixels).