Class Callback

 

SliceOmatic provide you with a number of callback hooks in the class "SliceO_Class". If you want, you can use these to have your own function called instead of the default callback functions.

 

Most of these callbacks hooks are pointers to a function.  You just replace the pointer by a pointer to your own function.  Some of the hooks are arrays of pointers.  For these, you need to ask sliceOmatic to provide you with an index number to use in the array.  This is done with the "Get_Callback_ID()" function.

 

Callbacks to get or change a pixel value:

 

Fct_Pixel_Get_GLI

 

These function return the pixel values of a pixel identified by its 3D position.

 

 

Fct_Pixel_Get_TAG

 

 

Fct_Pixel_Set_TAG

 

This function change the TAG value of a pixel identified by its 3D position.

 

Callbacks to get pixel metrics:

 

Fct_Metrics_Get_Res

 

This function returns the resolution of an image.

 

Fct_Metrics_Get_Pos

 

This function returns the 3D position of a point on a 2D image.

 

 

Callbacks to draw to a window:

 

Fct_Draw_Highlight

 

This function is used to draw a border around portion of the class representation in 2D windows in MODE_ALL.

 

Fct_Draw_Base[ ]

 

These functions are used to draw the default information of the class.  For frames, it draw the pixels of the frame, for classes higher in the tree it draw icons and connecting lines in 2D windows in MODE_ALL.

 

Fct_Draw_OpenGL[ ]

 

These functions are used to draw in the OpenGL step of the drawing process.

 

Fct_Draw_Stencil[ ]

 

These functions are used to draw in the Stencil step of the drawing process.

 

Fct_Draw_3D[ ]

 

These functions are used to draw elements of the 2D database in a 3D window

 

 

 

From: sliceO_class_2D.hpp

 

// ----------------------------------------------------------------------------

//

//                    Definition of the Class SliceO_Class

//

// ----------------------------------------------------------------------------

class          SLICEO_DB SliceO_Class {

 

          ...

 

          // ====================================================================

          // --- we also have callbacks for the pixel values ---

          int          (*Fct_Pixel_Get_GLI)( SliceO_Class *pt, void *ima, Vect pos ) ;

          unsigned char          (*Fct_Pixel_Get_TAG)( SliceO_Class *pt, void *ima, Vect pos ) ;

          int          (*Fct_Pixel_Set_TAG)( SliceO_Class *pt, void *ima, Vect pos, unsigned char tag ) ;

 

          // ====================================================================

          // Return the x & y image resolution

          int          (*Fct_Metrics_Get_Res)( SliceO_Class *pt, void *ima, int *x, int *y ) ;

          // return the 3D coord of a point in the image plane

          Vect          (*Fct_Metrics_Get_Pos)( SliceO_Class *pt, void *ima, Vect pos_2D ) ;

 

          // ====================================================================

          // --- we also have callbacks for drawing the structure ---

          int          (*Fct_Draw_Highlight)( SliceO_Class *pt, UInt64 flag, SliceO_Window *window ) ;

          // --- default value is at "0", but first we try all the other ones. if

          // --- a callback is present and it return=2, we do not call default.

          int          (*Fct_Draw_Base[CALLBACK_NB_BASE])( SliceO_Class *pt, UInt64 flag, SliceO_Window *window ) ;

          // --- these callback are to add drawings on top of the base.  The are called

          // in increasing value starting at 0.  So the latest will be on top ---

          int          (*Fct_Draw_OpenGL[CALLBACK_NB_OPENGL])( SliceO_Class *pt, UInt64 flag, SliceO_Window *window ) ;

          int          (*Fct_Draw_Stencil[CALLBACK_NB_STENCIL])( SliceO_Class *pt, UInt64 flag, SliceO_Window *window ) ;

          // --- this callback is to add 3D elements for each class in the 3D windows. ---

          int          (*Fct_Draw_3D[CALLBACK_NB_3D])( SliceO_Class *pt, UInt64 flag, SliceO_Window *window ) ;

          // ====================================================================

 

} ;