Fct_Contour_Draw_Points

 

Draw the contour points associated with a TAG on a specific frame in an OpenGL window.

 

 

Syntax

 

void  Fct_Contour_Draw_Points(

          SliceO_Frame * frame,

          short tag,

          int step,

          int nb_step

) ;

 

 

Parameters

 

frame

Pointer to the frame for which we want the points.

 

tag

TAG value for which we want the points.

 

step

Current redraw step.

 

nb_step

Total number of redraw step.

 

Return value

 

This function return the number of points in the vector.

 

 

Remarks

 

This function is designed to be used inside the "Draw" function of your DLL.

 

 

Requirements

 

Header:

          sliceO_include.hpp

 

 

Library:

          sliceO_Structures.lib

 

 

 

Example

 

Drawing the contour points in the Shell_Draw function of the Shell_TomoVision  module.

 

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

//

//          Function:          Draw

//

//          Parameters:          flag (unsigned int)          flag of this draw (32 bits)

//                    pt_window (VOID *)          Pointer to the current window

//                    pt_target (VOID *)          Pointer to the current structure

//                              (study,series,image or frame)

//

//          Returns:          (int)          0 if error

//

//          This is called after sliceO has redrawn the image, in case you would

//          want to add something to the graphics.

//

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

extern "C" __declspec(dllexport) int          Draw( UInt64 flag, void *pt_window, void *pt_target )

{

static          int Nb_Step ;

 

          // --- in mode pre, grab the total number of steps ---

          if ( flag & REDRAW_3D_PRE ) {

                    Nb_Step = (int) pt_target ;

                    return( 1 ) ;

          }

 

          SliceO_Window *window = (SliceO_Window *) pt_window ;

 

          // --- only draw to windows in correct mode ---

          if ( window->Module_Get() != Ctrl_Query() )

                    return( 1 ) ;

 

          unsigned short TAG_Nb = (unsigned short) Fct_Variable_Value( "$TAG_NB" ) ;

          unsigned char *TAG_Select = (unsigned char *) Fct_Variable_Value( "$TAG_SELECT" ) ;

          if ( ! TAG_Select )

                    return( 0 ) ;

 

          int group_id = 0 ;

 

          // --- First locate the "group" (one level higher than the frames ---

          if ( Iterator_Init( ITERATOR_2, "3D Shell: Draw" ) ) {

                    while( SliceO_Frame *frame = (SliceO_Frame *) Iterator_Class( ITERATOR_2, CLASS_ID_FRAME, window, ITER_FLAG_SELECT ) ) {

                              group_id = frame->Parent_Get_Pt()->Class_Id_Get() ;

                              break ;

                    }

                    Iterator_End( ITERATOR_2 ) ;

          }

 

          // --- Now we loop for all the selected "groups" ---

          if ( Iterator_Init( ITERATOR_2, "3D Shell: Draw" ) ) {

 

                    while( SliceO_Class *group = (SliceO_Frame *) Iterator_Class( ITERATOR_2, group_id, window, ITER_FLAG_SELECT ) ) {

 

                              // --- sub-sampling of the slices ---

                              for ( int i=0; i < group->Child_Get_Nb(); i += Contour_SubSampling[2] + 1 ) {

 

                                        SliceO_Frame *frame = (SliceO_Frame *) group->Child_Get_Pt(i) ;

 

                                        // --- skip disabled slices ---

                                        if ( ! frame->Flag_Get_Bit( CLASS_MODE_THIS, window, CLASS_FLAG_SELECT ) )

                                                  continue ;

 

                                        // --- look for all tags ---

                                        for ( short tag=0; tag < TAG_Nb; tag++ ) {

                                                  // --- only draw pts for selected slices ---

                                                  if ( ! TAG_Select[tag] )

                                                            continue ;

 

                                                  if ( Contour_Mode == CONTOUR_MODE_POINT )

                                                            Fct_Contour_Draw_Points( frame, tag, (int) pt_target, Nb_Step ) ;

                                                  if ( Contour_Mode == CONTOUR_MODE_LINE )

                                                            Fct_Contour_Draw_Loops(  frame, tag, (int) pt_target, Nb_Step ) ;

                                        }

                              }

                    }

                    Iterator_End( ITERATOR_2 ) ;

          }

 

          return( 1 ) ;

}

 

See also

 

Fct_Contour_Create

Fct_Contour_Free