Applet vs. Standalone Application
When run as an applet, jMovie takes its file location parameter from the PARAM field of the APPLET tag of its HTML file.
<APPLET CODE = "TheGUI.class" WIDTH = 700 HEIGHT = 700>
<PARAM NAME=file VALUE="http://sepwww/pub/sep/esen/display/smaller.H">
When run as a standalone application, jMovie requires the user to input the parameter in the command line. For example:
java TheGUI file:/homes/them/esen/movie/display/smaller.H
Reading the Data
The program calls the byte converter, which in turn calls the SEP reader class. This class creates an object of type SepCubeHandler. The SepCubeHandler is responsible for reading and parsing the header file, as well as storing the float data into a float array. The SepCubeHandler returns a Java hashtable with the SEP header information and a Java float array with the SEP data. TheGUI hands the header information to the AxisMaker and the data float array to the byte converter. We define valid data files to be SEPLib Header files with the suffix ".h" or ".H," since SEP data is not yet defined as a MIME type. The passing of the header information enables the creation of axes. .
Creating the Images
Once the integer array of data is passed to the main program after being read from the file, it is given to the program's Imager object for processing. The Imager object manipulates the three main image variables of jMovie - CurrentImg, CurrentImg2, and CurrentImg3 - representing the image being displayed for each dimension at a particular time.
The images for each dimension are created by methods createSliceData and createPixelData in Imager. The three dimensional integer array is used to create a two dimensional float array depending on which dimension is being sliced. This two dimensional array is then passed to createPixelData, where it is made into a one dimensional array of grayscale values. The resulting array is then used to create the current image variable for the selected dimension.
Graphical User Interface
The graphical user interface (GUI) was created using the Java 1.1 AWT Flanagan (1997). The user can choose from the following options:
In addition to the visible choice menus and buttons, the user can click within the axes to jump to a specific slice.
I implemented the event handling for the buttons and choice menus using the Java 1.1 Event Model Laura Lemay (1997). Action listener and item listener classes are added to the buttons and choice menus respectively. The buttons and choice menus call their respective action or item listeners when activated. The mouseDown method of the main class was then overridden to enable the user to click within the axes.
All images in jMovie are double buffered. The images are first written to offscreen buffers, and then dumped on to the screen from the buffers. Double buffering eliminates flickering and the partial drawing of images during animation.