Source Code

 

 

 

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

//

//          SliceO_Frame

//

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

class          SLICEO_DB SliceO_Frame:public SliceO_Class  {

 

private:

//          short          flag ;

 

public:

 

          // ---- Constructors ---

          SliceO_Frame( SliceO_Class *parent, SliceO_File *file, int bunch, int slice ) ;

          ~SliceO_Frame() ;

 

          // --- parameters of the slice ---

          void                              *m_ima ;

          int                               m_bunch ;

          int                               m_slice ;

          SliceO_File                    *m_file ;

          unsigned int           m_flag ;          // extracted from the Tomo_Image "Trust orientation" flag

          unsigned short           m_x, m_y, m_z, m_t ;

          unsigned char           m_pix_type ;

          char                              *m_pix_units ;

          int                               m_pix_fill ;

 

          float                    **m_scale ;          // display scale factor (per window, per window mode)

          float                    m_ratio ;          // pixel aspect ratio (y/x)

 

          Vect                    m_org ;                    // pos of left corner of image in 3D space

 

          Vect                    m_dir_h ;          // direction vector horiz. (left to right)

          Vect                    m_dir_v ;          // direction vector vert. (top to bottom)

          Vect                    m_dir_d ;          // direction vector depth

 

          Vect                    m_inc ;                    // slice increments

          Vect                    m_dim ;                    // slice dimentions & thickness

          float                    m_pos_d ;          // (0018,2005) pos of slice in scanning dir (value

                                                  // along the parametric line to dir_d)

          float                    m_time ;          // (0018,1063) = frame time

 

          Matrix                    m_mat_2D_3D ;

          Matrix                    m_mat_3D_2D ;

 

          float          gli_offset ;                    // real value = m_gli * scale + offset

          float          gli_scale ;

 

          float          gli_min ;                    // min and max values in the GLI frame

          float          gli_max ;

 

          float          val_min ;                    // min and max values from the colorscheme

          float          val_max ;

 

 

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

          // ===              We have access to 3 "work" buffers:                                  ===

          // ===              - The Erase buffer

          // ===              - The Work_GLI buffer

          // ===              - The Work_TAG buffer

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

          unsigned char **Erase_Get( void ) ;

          unsigned char **Erase_Load( void ) ;          // from Work_TAG to Erase

          void                    Erase_Restore( void ) ;          // from Erase to Work_TAG

          void                    Erase_Lock( void ) ;

          void                    Erase_Unlock( void ) ;

 

          unsigned short **Work_TAG_Get( void ) ;

          unsigned short **Work_TAG_Load( void ) ;          // from original TAG to Work_TAG

          void                    Work_TAG_Lock( void ) ;

          void                    Work_TAG_Unlock( void ) ;

 

          int                **Work_GLI_Get( void ) ;

          int                **Work_GLI_Load( void ) ;          // from original GLI to Work_GLI

          void                    Work_GLI_Lock( void ) ;

          void                    Work_GLI_Unlock( void ) ;

 

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

          // ===              Redraw a part of the frame on next refresh                        ===

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

private:

          Region_2D   m_redraw ;          // portion to redraw (in "Frm" space)

 

public:

          // --- querry the redraw region values ---

          Region_2D  *Region_Redraw_Get( void ) ;

          // --- Set, reset or add to the the redraw region ---

          void              Region_Redraw_Set( Region_2D *region_frm=NULL ) ;

          // --- clear the redraw region ---

          void              Region_Redraw_Clear( void ) ;

 

 

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

          // ===              Update a part of the frame on next refresh                        ===

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

private:

          Region_2D   m_update ;          // portion to update (in "Frm" space)

 

public:

 

          // --- querry the update region values ---

          Region_2D   *Region_Update_Get( void ) ;

          // --- Set, reset or add to the the update region ---

          void              Region_Update_Set( Region_2D *region_frm=NULL ) ;

          // --- clear the update region ---

          void              Region_Update_Clear( void ) ;

 

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

          // ===              Definition of virtual functions                                  ===

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

          int          Update_A( UInt64 flag ) ;

 

          // --- we also have functions to propagate the updates to the childs ---

          void          Update_Child_A( UInt64 flag, void *window, void *ima, Region_4D *region ) ;

 

          // --- compare return an integer evaluating 2 elements of the same class ---

          int          Compare( SliceO_Class *pt_b )  ;

          void          Stool( int trace=ERROR_CODE_TRACE, int level=0, unsigned char recurs=1 ) ;

          int          Resize( SliceO_Window *window, Region_2D *region=NULL ) ;

 

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

 

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

          // ===              Interface events                                                      ===

          //  Some class may have gadgets that can interact with the mouse   

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

public:

          int          Interface_Click(  SliceO_Window *window, int up_down, Point_2D *mouse_inf ) ;

          int          Interface_Motion( SliceO_Window *window, int up_down, Point_2D *mouse_inf ) ;

          int          Interface_Scroll( SliceO_Window *window, int count,   Point_2D *mouse_inf ) ;

          int          Interface_Key(    SliceO_Window *window, int key,     Point_2D *mouse_inf ) ;

          int          Interface_Select( SliceO_Window *window, Region_2D *region_inf ) ;

 

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

          // ===              System transformations (Frm to Inf)                                  ===

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

          Point_2D          Frm_2_Inf( SliceO_Window *window, Point_2D ) ;

          Point_2D          Inf_2_Frm( SliceO_Window *window, Point_2D ) ;

          Region_2D          Frm_2_Inf( SliceO_Window *window, Region_2D ) ;

          Region_2D          Inf_2_Frm( SliceO_Window *window, Region_2D ) ;

 

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

          // ===              System transformations (Frm to Org)                                  ===

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

          Point_3D          Frm_2_Org( Point_2D ) ;

          Region_3D          Frm_2_Org( Region_2D ) ;

 

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

          // ===              System transformations (2D to 3D)                                  ===

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

          Point_3D          Get_3D_Coord( Point_2D pt ) ;

          Point_3D          Get_3D_Coord( float x, float y, float z=0.0f ) ;

          Point_3D          Get_3D_Coord_Center( Point_2D pt ) ;

          Point_3D          Get_3D_Coord_Center( float x, float y, float z=0.0f ) ;

 

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

          // ===              I keep a flag for contour re-compute                        ===

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

          unsigned char          Contour_Invalid[256] ;

 

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

          // ===              Keep the values distribution (histogram)                        ===

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

          Histograms          *Histogram_Compute( void ) ;

          void                    Histogram_Delete( void ) ;

          Histograms          *Histogram_Get( void ) ;

 

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

          // --- we also have callbacks for updating the display buffers ---

          // --- 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_Update_GLI_Disp[CALLBACK_NB_DISPLAY])( SliceO_Class *pt ) ;

          int          (*Fct_Update_TAG_Disp[CALLBACK_NB_DISPLAY])( SliceO_Class *pt ) ;

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

 

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

          // --- Callback for mean and gradient values ---

          int          (*Fct_Pixel_Get_Filter)(       SliceO_Frame *pt, void *ima, Vect pos ) ;

          int          (*Fct_Pixel_Get_Gradient_Amp)( SliceO_Frame *pt, void *ima, Vect pos ) ;

          Vect          (*Fct_Pixel_Get_Gradient_Dir)( SliceO_Frame *pt, void *ima, Vect pos ) ;

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

 

} ;