Fct_Update

 

Send an update command for the specified windows, classes and region.

 

 

Syntax

 

void  Fct_Update(

          UInt64 flag,

          void *window_mode=NULL,

          void *class_mode=NULL,

          Region_2D *region=NULL

) ;

 

 

Parameters

 

flag

You can limit the redraw to the specified conditions. For a list of accepted values please refer to the update.hpp file

 

window_mode

You can limit the redraw to the specified windows.  The argument can contain either a pointer to a specific winodw, or one of the define macros:

 

CLASS_MODE_ALL

// All the windows of the database are updated if needed

 

CLASS_MODE_SELECT

// Only the currently selected windows are updated

 

CLASS_MODE_VISISBLE

// Only the visible windows are updated

 

CLASS_MODE_CURRENT

// Only the current window is updated

 

CLASS_MODE_NONE

// None of the windows are updated

 

The default value if no argument is specified is CLASS_MODE_ALL

 

class_mode

You can limit the redraw to the specified classes.  The argument can contain either a pointer to a specific class, or one of the define macros:

 

CLASS_MODE_ALL

// All the classes of the database are updated if needed

 

CLASS_MODE_SELECT

// Only the currently selected classes are updated

 

CLASS_MODE_VISISBLE

// Only the visible classes are updated

 

CLASS_MODE_CURRENT

// Only the current classes are updated

 

CLASS_MODE_NONE

// None of the classes are updated

 

The default value if no argument is specified is CLASS_MODE_ALL

 

region

You can limit the update to a specific region (in frame space).  If the region is omitted, the complete frame is updated.

 

 

Return value

 

This function does not return a value.

 

 

Remarks

 

Some updates (for example UPDATE_CUR_TAG) do not need a window, class and region.  in these cases you can call simply: Fct_Update( UPDATE_CUR_TAG ).

 

Some update will affect the windows, they are:

UPDATE_WINDOW

          UPDATE_WINDOW_2D

          UPDATE_SLIDERS

          UPDATE_3D_MATRIX

          UPDATE_CUR_FRAME

          UPDATE_SELECTIO

 

Some update will affect the classes, they are:

UPDATE_DB

          UPDATE_DATA_GLI

          UPDATE_DATA_TAG

          UPDATE_DISPLAY_GLI

          UPDATE_DISPLAY_TAG

          UPDATE_HIGHLIGHT

 

The flags UPDATE_DELAY_ON and UPDATE_DELAY_OFF are used to interrupt the update process.  For example if you are segmenting a frame in a separate thread, you may not want the update function to access the TAG information until you have finished modifying it.  You can suspend updates and redraw while you are working.

 

 

Requirements

 

Header:

          sliceO_include.hpp

 

 

Library:

          sliceO_Structures.lib

 

 

 

Example

 

From the edit_image_fct.cpp file

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

//

//          Edit_Paint_Pix_Add()

//

//          change the tag value under the brush

//

//          Param:          frame (SliceO_Frame *)          ptr to the frame under the cursor

//                    pos_frm (Point_2D)          cursor position in FRM space

//

//          return: (void)

//

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

void          Edit_Paint_Pix_Add( SliceO_Frame *frame, Point_2D *pos_frm )

{

short          k, l ;

 

          assert( frame ) ;

          assert( frame->Fct_Pixel_Set_TAG ) ;

 

          unsigned short          TAG_Cur =      (unsigned short)    Fct_Variable_Value( "$TAG_CUR" ) ;

          unsigned short  *          Brush_Size =   (unsigned short *)  Fct_Variable_Value( "$BRUSH_SIZE" ) ;

          unsigned short          Brush_Radius = (unsigned short)    Fct_Variable_Value( "$BRUSH_RADIUS" ) ;

          unsigned short          Brush_Cur =    (unsigned short)    Fct_Variable_Value( "$BRUSH_CUR" ) ;

          unsigned char ***          Brush_Pt =     (unsigned char ***) Fct_Variable_Value( "$BRUSH_PT" ) ;

 

          // --- Get the brush's parameters ---

          short b_size = Brush_Size[Brush_Cur] - 1 ;

          short b_start = Brush_Radius - b_size ;

 

          // --- compute brush position ---

          Region_2D   region( COORD_FRM,

                               (*pos_frm)[0] - b_size,

                               (*pos_frm)[1] - b_size,

                               (*pos_frm)[0] + b_size,

                               (*pos_frm)[1] + b_size ) ;

 

          // --- stay inside the image ---

          Region_2D   cull( COORD_FRM, 0, 0, frame->m_x-1, frame->m_y-1 ) ;

 

          short o_x=0 ;

          if ( region[0] < 0.0f )

           o_x = - (int) region[0] ;

 

          short o_y=0 ;

          if ( region[1] < 0.0f )

           o_y = - (int) region[1] ;

 

          if ( ! region.Cull( cull ) )

           return ;

 

          int modif = 0 ;

 

          // --- change the actual tag values ---

          Vect pos ;

          pos.z = frame->m_z ;

          pos.t = frame->m_t ;

          for ( pos[1] = region[1], l = b_start+o_y; pos[1] <= region[3]; pos[1]++, l++ )

           for ( pos[0] = region[0], k = b_start+o_x; pos[0] <= region[2]; pos[0]++, k++ )

                    if ( Brush_Pt[Brush_Cur][l][k] )

                     modif |= frame->Fct_Pixel_Set_TAG( frame, frame->m_ima, pos, (unsigned char) TAG_Cur ) ;

 

          // --- if nothing changed, get out ---

          if ( ! modif )

           return ;

 

          // --- we updated the image, the erase buffer is now different from the image. ---

          frame->Flag_Set_On( CLASS_MODE_THIS, CLASS_MODE_NONE, CLASS_FLAG_TAG_ERASE ) ;

          Fct_Update( UPDATE_ERASE ) ;

 

          // --- Update the displayed tag image ---

          Fct_Update( UPDATE_DISPLAY_TAG, CLASS_MODE_ALL, frame, &region ) ;

          // --- we will need a redraw of this portion of the screen ---

          Fct_Redraw( REDRAW_DB_OPENGL, CLASS_MODE_ALL, frame, &region ) ;

}

 

See also