All user modules are in the form of DLLs.
Your DLL can create one of the 3 following entities: a new Tool, a new Mode or a new Class.
The type of entity you create is function of where you place your DLL in the sliceOmatic's directory structure.
At startup, sliceOmatic will load all the DLL it find in a specific set of sub-directories of its installation directory. Your compiled DLL should be placed in one of the following sub-directories:
sliceO_Tool: If your module is a Tool and you want it to appear in the "Tool" menu.
sliceO_Class: If your module describe a new class.
sliceO_User_2D: If your module create a 2D mode. It will appear in the "User 2D" section of the "Mode" menu.
sliceO_User_3D: If your module create a 3D mode. It will appear in the "User 3D" section of the "Mode" menu.
The "sliceO_System", "sliceO_2D", "sliceO_Tag" and "sliceO_3D" directories are reserved for TomoVision's DLL.
To interact with sliceOmatic, your DLL need to contain a number of pre-defined functions. These functions will be called back by sliceOmatic when it need them. For example, at the start of the program, sliceOmatic will load all the DLL it find and call the "Register()" function from each of these to place the DLL in a list of active modules. It will then call the "Draw_Register()" function for all registered DLL to see if the modules want to be implicated in the drawing callbacks. It will then call the "Var_Register()" function of all registered DLL to create a list of available variables...
All of these functions are optional, function are only called is they are present in your DLL. However, some of these function are more important than others. For example, if you do not have a "Register()" function in your DLL, then none of the other functions will ever be called.
Most of the functions are common to the 3 types of entities you create, but a few are specific. For example, only Class entities use the "Class_Register()", "Class_Status()" and "Class_Insert()" functions.
Templates for these function are provided in the "DLL Templates" directory of the developer's kit.
These function are grouped in separate files by functionality.
Main
The "xxx_main.cpp" file contain the general functions:
|
|
Register
|
This function must be present if you want sliceOmatic to use your module. The function must return the name of your module.
|
|
|
Init
|
This optional function is called at the beginning of a sliceOmatic session. It is a good place to initialize the variables of your module.
|
|
|
Exit
|
This optional function is called when the sliceOmatic session is about to end. It is a good place to free any memory allocated by your module.
|
|
|
Version
|
This optional function return a version number. When the user place the program in trace mode, the list of modules and their version is output to the trace file.
|
Variables
The "xxx_var.cpp" file contain the functions that enable you to share your static variables:
|
|
Variable_Register
|
This function is used to register your variables
|
|
|
Variable_Get
|
This function is used to get a pointer to one of the registered variables.
|
Script
The "xxx_script.cpp" file contain the functions that interact with the command line:
|
|
Script_Register
|
This function is used to register your command key word.
|
|
|
Script_Parse
|
This function is used to parse a command that use your keyword. This function is called by sliceO when a script command was entered in the program and that command start with the same key word as the one you registered. The same key word can be registered by multiple modules, so if the arguments of this command are not recognized by your module, you should return "0" so that sliceO will try other modules. If you return "1", it signal that you have recognized this command and acted on it.
|
|
|
Script_Save
|
This function is used to save script commands. This function is called by sliceO when the user select "save as script" in the main menu. The idea here is that you save script commands that your module will be able to read back in order to bring your module back to the same point as when the script where saved.
|
Update
The "xxx_update.cpp" file contain the functions interacting with the "update" mechanism:
|
|
Update_Register
|
This function is used to ask sliceOmatic to let you know of the changes. The program will call your function "Update_A()" and "Update_B()" when one of the update condition you registered for occurs.
|
|
|
Update_A
|
This function is called as soon as the changes are detected (one per loop).
|
|
|
Update_B
|
This function will only be called when more immediate operations have been done (once all current redraw demand have been met). This is used to update non-essential part of the interface. For example, the "Blow-up" tool register the flag "UPDATE_CURSOR" to know when the cursor is moved, but only re-draw the blow-up window in the "Update_B" function.
|
Control Interface
The "xxx_ctrl.cpp" file contain the functions that create and control your module's interface:
|
|
Ctrl_Register
|
This function is needed if you want to have a user interface. the function return the vertical size of your interface (in pixels).
|
|
|
Ctrl_Create
|
This function is called once at startup. If you need to allocate memory for your interface, this would be a good place. also, if you create child windows.
|
|
|
Ctrl_Destroy
|
This function is called once when the program terminate.
|
|
|
Ctrl_Resize
|
This function is called each time the program need to resize the interface region of the program.
|
|
|
Ctrl_Open
|
This function is called each time your mode or tool is opened.
|
|
|
Ctrl_Close
|
This function is called each time your mode or tool is closed.
|
|
|
Ctrl_Query
|
This function returns the current state of the interface (opened or closed).
|
|
|
Ctrl_Show
|
This function is called each time your mode or tool become visible.
|
|
|
Ctrl_Hide
|
This function is called each time your mode or tool is no longer visible.
|
|
|
Ctrl_Draw
|
This function is called each time your mode or tool hs to be drawn.
|
If you want the users to interact with your module, you must provide an interface. These function enable you to create your interface and to control the user's interaction with it.
|
|
Ctrl_Click
|
This function is called when sliceO detect a mouse "click" (either on or off for any of the 3 mouse keys) while the cursor is over your interface.
|
|
|
Ctrl_DblClick
|
This function is called when sliceO detect a mouse "double click" (for any of the 3 mouse keys) while the cursor is over your interface.
|
|
|
Ctrl_Help
|
This function is called when the "Help" key is pressed while the cursor is over your interface.
|
|
|
Ctrl_Key
|
This function is called when a keyboard key is pressed while the cursor is over your interface.
|
|
|
Ctrl_Motion
|
This function is called when the cursor is moved while it is over your interface.
|
|
|
Ctrl_Scroll
|
This function is called when the mouse scroll wheel is activate while the cursor is over your interface.
|
|
|
Ctrl_Leave
|
This function is called each the cursor leave your interface.
|
You may also want to provide a "Ctrl_Update" function. Though this function is not called directly by sliceOmatic, it is called indirectly when sliceO call your "Update_A" or "Update_B" function and you want to update something in the control window. You then call the Ctrl_Update function yourself.
|
|
Ctrl_Update
|
This function is called when sliceO detect a mouse "click" (either on or off for any of the 3 mouse keys) while the cursor is over your interface.
|
Image Interface
The "xxx_image.cpp" file contain the functions control the interface between your module and the image window:
|
|
Ima_Create()
|
This function is called once at startup when the image windows are created.
|
|
|
Ima_Resize()
|
This function is called each time one of the image windows are resized.
|
If you want the users to interact with the image window, these function enable you to control the user's interaction.
|
|
Ima_Click()
|
This function is called when sliceO detect a mouse "click" (either on or off for any of the 3 mouse keys) while the cursor is over an image window.
|
|
|
Ctrl_DblClick()
|
This function is called when sliceO detect a mouse "double click" (for any of the 3 mouse keys) while the cursor is over an image window.
|
|
|
Ima_Help()
|
This function is called when the "Help" key is pressed while the cursor is over an image window.
|
|
|
Ima_Key()
|
This function is called when a keyboard key is pressed while the cursor is over an image window.
|
|
|
Ima_Motion()
|
This function is called when the cursor is moved while it is over an image window.
|
|
|
Ima_Scroll()
|
This function is called when the mouse scroll wheel is activate while the cursor is over an image window.
|
|
|
Ima_Leave()
|
This function is called each the cursor leave an image window.
|
Drawing Functions
The "xxx_draw.cpp" file contain the functions that draw in the image windows:
Class
When you define a new class, you must provide at least constructor for it. You can also provide a number of methods to replace the default virtual ones. The methods you can override are:
|
|
constructor
|
You need to have a constructor for your class
|
|
|
destructor
|
Needed if any allocation done in the constructor.
|
|
|
Compare
|
Used to compare 2 elements of the same class.
|
|
|
Icon_Name
|
Used to draw an icon in the "Mode All" of 2D windows.
|
|
|
Sort
|
Used to sort the elements of a same class.
|
|
|
Stool
|
Used for debugging.
|
|
|
Update_A
|
Update once per loop.
|
|
|
Update_B
|
Update only when we have time.
|
|
|
Update_Child_A
|
Recursive update.
|
The "xxx_class.cpp" file contain the functions needed if you have defined a new class:
|
|
Class_Register
|
This function is needed to register your class with sliceOmatic
|
|
|
Class_Status
|
This function provide some information about your class
|
|
|
Class_Insert
|
This function will be called by sliceOmatic when it construct its database.
|
Callback
The "xxx_callback.cpp" file contain the functions needed to associate callbacks to the different callback pointers provide in sliceOmatic classes:
Some of the structures used in sliceO-5 provide array of "hooks" for your own functions. However, to prevent 2 modules from interfering with one-another, you must ask sliceO-5 for the ID you will use in these arrays.
|
|
Callback_Get_ID
|
This function provide callback IDs for the callback arrays.
|
The file will also typically contain the xxx_Callback_Register and xxx_Callback_Reset functions. These are functions that are called from within your module to associate and remove your callback function to the appropriate hooks in the class structures.
Program flow
A simplified flow chart of sliceOmatic can be found here: