Mango Script Tutorial — Class Structure
<< Previous Tutorial — Recording With and Without User Input Next Tutorial — Example Scripts >>
The Mango Script API consists of many classes. Some classes can loosely be associated with the windows you see in the Mango GUI application. For example, m_Mango can loosely be associated with the Toolbox and represents the highest level, most executive class in the application. m_VolMan (which stand for Volume Manager) can loosely be associated with a Viewer. See below for a list of some of the major classes:
- m_Mango — the Mango application
- m_VolMan — a Volume Manager
- m_Vol — a Volume
- m_ROI — ROI data (masks, lines, and points)
- m_SurfMan — a Surface Manager
- m_Stat — a result statistic
- m_Coord — a coordinate
- m_ImageDims — image dimensions
The diagram on the right describes some of the major classes and their relationships. There exists a single instance of the m_Mango class. It can contain multiple instances of the m_VolMan class. Each m_VolMan can contain multiple instances of the m_Vol class, representing the base image volume followed by any loaded overlay image volumes. A m_Vol then contains multiple class objects that contain information such as voxel dimensions (m_VoxelDims), image dimensions (m_ImageDims), etc.
A m_VolMan instance also contains ROI data (m_ROIData), surface data (m_SurfMan), and projection data (m_ProjMan).
When creating a new script, the Script Manager will automatically include something like the following comments in your code:
# This script is written in Python (Jython), version 2.5.3 # See the Help menu for tutorials, example scripts and API # m_Mango_mango (class m_Mango) represents the application # m_VolMan_manager (class m_VolMan) represents this viewer # Select a class in the API guide below to view its properties and methods
Note that it refers to two variables: m_Mango_mango and m_VolMan_manager. These two variables are automatically made available to your scripts. Also note that each variable name is prefixed with its class type. The Python language does not require a variable to declare its type, however it can be useful to add this prefix when working with the Script Manager API Guide. When editing a script in the Script Manager, if you click on a variable name, or property of, that contains a classname, the Script Manager will automatically select that class from the Classes dropdown box.
<< Previous Tutorial — Recording With and Without User Input Next Tutorial — Example Scripts >>