1 Matlab Graphical User Interface (GUI)

Abstract
Usage
Design
Results
Extended Features
Future Direction
Appendix
Acknowledgements
References

Table of Contents:


1.1 Menu options

The menu options primarily focus on data input/output, changing between views of different species, color manipulation of general structures, and playing the animation of the spider. These menu options were created to allow for a broader view of the spider. Here is a list of all the menu items that are available, with a short description of each item:

1.1.1 File

File->Load Data specifying the spider's morphological traits is stored in ascii text files. Therefore, any spider with set parameters can be loaded by simply selecting a previously stored file from this menu item. (For formatting of such files, see Appendix 1) However, the best method to modify specific parameter settings is through the Graphical user interface. (i.e., see description of gui components in the east panel and the 'Edit->Advanced' menu option below).
File->Save save file as ascii text. This will save all the parameter settings that have been changed in the current session to a text file that's specified by the user.
File->Exit same as the 'Quit' button on the GUI window. This closes the GUI window altogether.

1.1.2 View

The following menu options provide a friendlier interface for biologists to display by species rather than having to load from data files. Currently, the parameters for the Schizocosa Uetzi species was based on a video sequence generated by Eileen Hebets. The data for the other three species are merely placeholders for future development. For now, they contain synthesized parameters to ensure the program works properly and to display a range of morphological traits.

View->S. Duplex Loads the data from a file called: 'duplex.txt'.
View->S. Uetzi Loads the data from a file called: 'uetzi.txt'
View->S. Stridulans Loads the data from a file called: 'stridulans.txt'
View->S. Crassipes Loads the data from a file called: 'crassipes.txt'

1.1.3 Edit

Edit->Color This is a submenu which enables the user to modify either the Body color or the Legs color. (For alternative methods of modifying individual legs or leg segment colors, see East panel section below)
Edit->Background Modifies background color.
Edit->Lighting This is a submenu which enables the user to modify one of three lighting options: Ambient, Diffuse or Specular Lighting.
By selecting one of the above Edit menu items, a separate popup box containg 3 or 4 RGB sliders will appear. The modifications are not made until the 'Apply' button is clicked:

Edit->Advanced This mode is only advised for the advanced user who wishes to modify individual parameters that can be found in the ascii text files. A simple user listbox is provided to allow the user to select specific parameters to modify. Once the selection has been made, the value of the text box is dynamically adjusted to the current parameter setting. Modifications can be made to the parameter by entering the desired value in the text box and subsequently clicking on the 'Apply' button.

1.1.4 Play

Play->Play The spider animation can be started by selecting this option. Note: the spider will make the motion as specified in the plots (See South Panel for details).
Play->Stop Stops spider animation. When the spider is restarted, the motion will be restarted as well. (See GLUT Callbacks Section for alternative methods to pause movement of the spider. If this menu option is used in conjunction with the GLUT callback methods, user needs to beware of mouse clicks in the 'Spider' window).


1.2 GUI Layout

The GUI window is divided into 3 panels. The upper half of the screen contains two panels that have been labelled as 'West' and 'East', while the last panel covers the lower half of the window and is labelled as 'South' . Below is a diagram of the layout:

1.2.1 West Panel

The west panel consists of a static textbox which is simply the title of the panel, a listbox with 7 options, and a push button labelled as 'Select'. See diagram below for details:

The listbox provides 7 morphological traits for the user to manipulate. However, a callback is not triggered until the user clicks on the 'Select' button. A description of each of the 7 options is provided below:

'Leg Pair I' Refers to the leg pairs towards the front end of the spider.
'Leg Pair II' Refers to the leg pairs directly behind leg pair I.
'Leg Pair III' Refers to the leg pairs directly behind leg pair II.
'Leg Pair IV' Refers to the leg pairs towards the back end of the spider.
'Head' The front end of the first body segment.
'Thorax' The back end of the first body segment.
'Abdomen' The back body segment.
There is a tight coupling between the west panel and east panel. That is, when a user triggers a callback, the GUI components in the east panel will be changed. (See 'east panel' below for details)

1.2.2 East Panel

The east panel can be formatted in two different ways, depending on the listbox option that is chosen in from the west panel. It initially contains the following GUI components:

When selecting one of the leg pairs from the west panel (i.e., leg pairs I, II, III, or IV), 8 text boxes and 12 sliders appear in the east panel of the GUI window as shown in the diagram above. The leg segments are ordered as follows: Leg segment 1 is the segment closest to the body. Leg segment 2 is the segment next closest to the body. Leg segment 4 is the furthest away from the body. See diagram below for details.

The rgb sliders allow individual leg segment colors to be changed. This option allows the scientist to add color to segment 1 of the foreleg, for example. A more general approach to modifying leg colors as a whole is to use the 'Edit->Color->Legs' menu option.

The text boxes allow changing of the each leg segment in length and radius. These units are represented in pixels. There is an important distinction to make between the leg pairs and the rest of the body segments. Selecting one of the other body segments (i.e., head, thorax, or abdomen) will pop up 3 text boxes. See diagram below:

The units represented in one of these boxes relate to scale. That is, a text box will appear for height, width and length. However, in order to change the size of these body structures, a value that is proportional to the default size will need to be entered. The units were done in this way since the head, thorax and abdomen were made up of many different shapes (See Creating the Geometry section for details). Because of this, the units for each body segment was not easily changeable for the user through the GUI. However, the parameters are available in ascii text format so that the user can change the parameter settings for specific body segments easily. This requires some knowledge of the format of the files. See Appendix 1 for formatting details. Individual parameter settings may also be changed by the 'Edit->Advanced' menu option mentioned above in the 'menu options' section.

1.2.3 South Panel

The last panel on the GUI window helps the user manipulate motion/animation of the spider. It consists of a plot, 4 push buttons, 4 radio buttons, and a text box for file input/output. See diagram below for example:

Currently, movement of the spider is limited to its right foreleg. This correlates with the need for 4 moveable joints. Therefore, the 4 radio buttons were created to allow for the user to control movement of each joint by adjusting the angles between leg segments. Angle '1' is the joint between segment 1 and the body. Angle '2' is the joint between leg segments 1 and 2. Angle '3' is the joint between leg segments 2 and 3. Lastly, angle '4' is the joint between leg segments 3 and 4. (For details on leg segment numbering, see diagram of leg segments above in the East panel section).

Consequently, each radio button correlates with a plot. These plots are spline interpolations which allow the user to manipulate the angle of movement corresponding to time intervals. That is, the y-axis corresponds to the angle of rotation (relative to its resting position), while the x-axis corresponds to time intervals. Note that the joints move in only one direction. This is to prevent the user from creating unrealistic simulation of the spider. Therefore, it is important to note that the y-axis is the absolute value of an angle of rotation. This means that the movement of one joint may be in a different direction than the movement of another joint, even though all correspond to positive angle values on the plot.

Since the plot is a spline interpolation, 25 data points (shown as red circles) in the graph above can be positioned through mouse clicks on the plot. Once the angles are positions correctly, click on the 'Apply' button to see the simulation in affect. In the backend (i.e., the implementation), the 25 data points actually correspond to 120 time steps. This essentially makes the animation appear smoother since finer differences in angles are being interpolated and passed into the OpenGL program for spider rendering.

A description of each push button is provided below:

'Load' Loads the data found in the motionfile. The motionfile is specified in the Text box on the lower right hand corner of the south panel. All motionfiles will be in .mat file format. Therefore, the '.mat' file extension does not need to be specified in the textbox.
'Save' Saves the spline interpolation data points to the filename specified in the text box on the lower right of the GUI window. These data points will be saved into a .mat file format.
'Apply' Apply the motion that was specified in the spline interpolation plots to the spider. 'Apply' will create a spider if one was not present before.
'Quit' Same functionality as the 'File->Exit' menu option. This quits the entire spider_gui application.


1.3 Data Input/Output:

1.3.1 Data specifying Morphological Traits

The data needed for establishing the morphological traits (e.g., length, color and diameter) are specified in ascii text files. Therefore, users may manipulate the ascii text files directly. (See Appendix 1 for details on formatting of these files) However, the user interface is provided to allow manipulation of the data in a more coherent and intuitive fashion.
As a default setting, a generic spider is loaded from a file called 'spider.txt'. Therefore, this file needs to be present in the current working directory or the spider_gui executable will generate an error when trying to load the data from this file. Other default settings that require file loading include the 'View' menu options for each of the species. In addition, to these files, other files may be loaded and saved by the 'File' menu in the GUI window.

1.3.2 Data specifying Animation

All motionfiles are in a '.mat' file format. Therefore, these files are not changeable through manual human intervention. However, another Matlab program can be written to automatically generate such data files. For the spider animation, if a predetermined motion is desired, a text box is supplied at the lower right corner of the south panel, rather than as an option in one of the menus. This is to avoid confusion with loading of morphological traits. Once the file is entered, clicking on the 'load' button to its left will load the data into the GUI application.