Technical Manual

Global State GUI Window2D Polygon Drawing Window3D MeshObject (UPDATED FOR 2000) MeshOptions (NEW FOR 2000) VoxData

Module Cohesion and Coupling

Testing and Planning

Design Analysis

 

Window2D Member Functions

(created by Eric)
 
 

void Register(int i, GUI *g)

purpose:
Called after constructor to register the id of the Window2D & the
parent_gui pointer.  Would be in constructor, but we didn't know how
to alter the arguments to the constructor

parameters:
i is the id of the window, corresponding to the axis perpendicular to
the window (X = 0, Y = 1, Z = 2); g is the GUI that contains the window

post:
internal data members x and y are set, that map the x and y directions
of this window (right and up directions respectively) to directions
in the voxel data set;
id and parent_gui are initialized;
registered == 1
 
 

void InitSlice(void)
 

purpose:
called by gui when vox_data loads new data - Window2D must allocate its
slice buffers and slice parameters to match vox_data, & set up a default
view

pre:
Window2D has been registered with gui;
vox_data global has valid voxel data

post:
slice_width & slice height match dimensions of data in vox_data;
a padding of extra rows and columns is computed for textures without
power-of-two dimensions;
the slice buffers used are allocated
slice_num == -1, so that first draw will load vox slices;
init_slice == 1
 

void ResetView(void)

ResetView()

purpose:
slice texture will be fit to viewport on next draw()
 
pre:
Register() and InitSlice() have been called

post:
view_pos is set to the center of the slice textures;
view_zoom is set so texture spans one of the viewport dimensions
 
 

void MakeSegTextureCurrent(void)

purpose:
reloads the segmentation slice at the current slice number; used whenever
the seg slice has possibly become out of date, i.e., when the rgb of
a color index is changed, or a user has painted in one of the windows.

pre:
Register() and InitSlice() have been called
vox data has data with extents matching this window's width and height
 
post:
segmentation slice texture contains the voxel data set cross-section
in direction 'id', and section number 'slice_num'
 
 
 

int  CachedPolygon(void)

purpose:
returns the cached_polygon flag of the polygon_drawing object

post:
return value is 1 if polygon_drawing has a cached polygon, 0 otherwise
 
 
 

void AcceptPolygon(void)

purpose:
the gui calls this when the user presses the accept polygon button; this
means the polygon that was being edited will be rasterized into the voxel
data set according to the current drawing color and painting mode

pre:
Register() and InitSlice() have been called
vox data has data with extents matching this window's width and height

post:
if drawing lock held and polygon_drawing state was EDITING_STATE,
  voxels interior to polygon and "writable" are set with the current drawing
  color obtained from global_state->GetDrawingColor(); the three coverage
  modes determine which voxels inside the polygon are written over:
  PAINT_OVER_ALL:    all voxels
  PAINT_OVER_COLORS: all voxels that aren't labeled clear
  PAINT_OVER_ONE:    all voxels of the color obtained from
                     global_state->GetOverWriteColor()
  drawing lock released and polygon_drawing state is INACTIVE_STATE
else state not changed.
 
 

 
void PastePolygon(void)

purpose:
brings the last drawn polygon back for reuse

pre:
Register() and InitSlice() have been called

post:
if polygon_drawing state previously INACTIVE_STATE, drawing lock
obtainable, & polygon_drawing has a cached polygon,
  cached polygon becomes the edited polygon,
  polygon_drawing state is EDITING_STATE
  drawing lock is held
else state does not change
 
 

void draw(void)

purpose:
draw() overrided the draw() of the Fl_Gl_Window; called when
window issues a redraw(), is shown or uncovered.

post:
if InitSlice() has been called,
  grey and seg slice textures, the crosshairs, & the polygon contour being
  drawn (if one exists) are displayed,
else the screen is cleared
 
 

void handle(int event)

purpose:
this handle() overrides the handle() of Fl_Gl_Window

post:
if InitSlice() has been called,
   results depend on global_state->GetToolbarMode():
   NAVIGATION MODE:
   left drag shifts the textures; right drag up and down scales the textures
   POLYGON DRAWING MODE:
   all events forwarded to polygon_drawing object
   CROSSHAIRS MODE:
   left click or drag places the crosshairs at the mouse cursor position;
   any other mode has no effect
else no change in state
if event is used, 1 is returned, else 0
 

 

Main

Users Manual
Technical Manual
Source Code
Download
Contact