Main Page | Data Structures | Directories | File List | Data Fields | Globals

tclSadie_plot.c File Reference

Provide a callback that lets the SADIE library plot bar graphs using Tk. More...

#include <tcl.h>
#include <tk.h>
#include <sadie.h>
#include "tclsadie.h"

Go to the source code of this file.

Typedefs

typedef const struct Line_value_rangeline_value_rangep_t
 An immutable coordinate range.
typedef double(* bar_sizer_t )(double val, line_value_rangep_t range)
 Define a generic graph bar scaling operation.

Enumerations

enum  plot_pos {
  TOP_MARGIN = 15, RIGHT_MARGIN = 100, TOP_SPACING = 10, LEFT_SPACING = 61,
  Y_HEIGHT = 100, AXIS_DEPTH = 1, MINOR_DEPTH = 4, MAJOR_DEPTH = 6,
  CAPTION_DEPTH = 8, PLOT_HEIGHT = 140, TICK_SPACE = 16, MAJOR_SPACE = 2
}
 Constants for positioning parts of the plotted bar graphs. More...
enum  label_index {
  LBL_XMIN, LBL_XMAX, LBL_YMIN, LBL_YMAX,
  max_label_index
}
 Array slots for axis labels. More...
enum  plot_obj_index {
  ANCHOR, AXISWIDTH, BLACK, BLUE,
  CREATE, E, FILL, GREEN,
  LINE, N, RED, TEXT,
  TEXTOPT, WIDTH, max_obj_index
}
 Slots for constants. More...
enum  axis_line_template_index {
  AXL_PATHNAME, AXL_CREATE, AXL_LINE, AXL_X1,
  AXL_Y1, AXL_X2, AXL_Y2, AXL_WIDTH,
  AXL_OUTLINEWIDTH, max_axl_index
}
 Template slots for a pre-parsed Tcl/Tk axis line command. More...
enum  bar_template_index {
  BAR_PATHNAME, BAR_CREATE, BAR_LINE, BAR_X1,
  BAR_Y1, BAR_X2, BAR_Y2, BAR_FILL,
  BAR_COLOR, max_bar_index
}
 Template slots for a pre-parsed Tcl/Tk bar graph bar command. More...
enum  text_template_index {
  TXT_PATHNAME, TXT_CREATE, TXT_TEXT, TXT_X,
  TXT_Y, TXT_ANCHOR, TXT_ANCHORPOS, TXT_FILL,
  TXT_COLOR, TXT_TEXTOPT, TXT_STRING, max_text_index
}
 Template slots for a pre-parsed Tcl/Tk text label command. More...
enum  y_preset_index {
  Y_TOP, Y_BASE, Y_MINOR, Y_MAJOR,
  Y_CAPTION, max_y_preset_index
}
 Slots for pre-set y coordinates. More...
enum  x_preset_index {
  X_BASE, X_MAJOR, X_CAPTION, X_RIGHT,
  max_x_preset_index
}
 Slots for pre-set x coordinates. More...

Functions

int tclsadie_plotter (PIXEL *line, uint32_t nbnd, uint32_t npix, const char *minxlbl, const char *maxxlbl, int option, PIXEL gmin, PIXEL gmax, void *data)
 Declare the plotting callback (defined elsewhere) so we can register it.


Detailed Description

Provide a callback that lets the SADIE library plot bar graphs using Tk.

The SADIE library function PLOT can use a callback to invoke some arbitrary external plotting operation. Here we define one to meet the requirements of tclSadie: the drawing operations use Tk, and the resulting graphs appear directly within the tclSadie session log.

Author:
University of Arizona Digital Image Analysis Lab
Date:
1999, 2004
Version:
Id
tclSadie_plot.c,v 1.1 2005/03/22 20:45:52 mmunro Exp

Definition in file tclSadie_plot.c.


Enumeration Type Documentation

enum axis_line_template_index
 

Template slots for a pre-parsed Tcl/Tk axis line command.

Enumeration values:
AXL_PATHNAME  the Tcl/Tk canvas pathName.
AXL_CREATE  the create widget command.
AXL_LINE  the line item type.
AXL_X1  the starting x coordinate of the line.
AXL_Y1  the starting y coordinate of the line.
AXL_X2  the ending x coordinate of the line.
AXL_Y2  the ending y coordinate of the line.
AXL_WIDTH  the -width standard option.
AXL_OUTLINEWIDTH  the width value slot.
max_axl_index  the number of axis line template slots

Definition at line 72 of file tclSadie_plot.c.

enum bar_template_index
 

Template slots for a pre-parsed Tcl/Tk bar graph bar command.

Enumeration values:
BAR_PATHNAME  the Tcl/Tk canvas pathName.
BAR_CREATE  the create widget command.
BAR_LINE  the line item type.
BAR_X1  the starting x coordinate of the line.
BAR_Y1  the starting y coordinate of the line.
BAR_X2  the ending x coordinate of the line.
BAR_Y2  the ending y coordinate of the line.
BAR_FILL  the -fill standard option.
BAR_COLOR  the color value slot.
max_bar_index  the number of bar graph bar template slots

Definition at line 87 of file tclSadie_plot.c.

enum label_index
 

Array slots for axis labels.

Enumeration values:
LBL_XMIN  minimum x axis slot.
LBL_XMAX  maximum x axis slot.
LBL_YMIN  minimum y axis slot.
LBL_YMAX  maximum y axis slot.
max_label_index  the number of axis label slots

Definition at line 55 of file tclSadie_plot.c.

enum plot_obj_index
 

Slots for constants.

See also:
initialize_plot_objs for the strings.

Definition at line 65 of file tclSadie_plot.c.

enum plot_pos
 

Constants for positioning parts of the plotted bar graphs.

Enumeration values:
TOP_MARGIN  vertical whitespace before the start of the plot.
RIGHT_MARGIN  horizontal whitespace before a band bar graph.
TOP_SPACING  additional space at the top of the y axis.
LEFT_SPACING  additional space to the left of the y axis.
Y_HEIGHT  positive y axis height (maximum bar height).
AXIS_DEPTH  offset for the thickness of the axis line.
MINOR_DEPTH  length of minor ticks on an axis.
MAJOR_DEPTH  length of major ticks on an axis.
CAPTION_DEPTH  offset for postioning the graph caption.
PLOT_HEIGHT  the total vertical distance taken by the plots.
TICK_SPACE  the frequency of axis ticks (unit intervals).
MAJOR_SPACE  the frequency of major ticks (axis tick intervals)

Definition at line 38 of file tclSadie_plot.c.

enum text_template_index
 

Template slots for a pre-parsed Tcl/Tk text label command.

Enumeration values:
TXT_PATHNAME  the Tcl/Tk canvas pathName.
TXT_CREATE  the create widget command.
TXT_TEXT  the text item type.
TXT_X  the x coordinate of the text's positioning point.
TXT_Y  the y coordinate of the text's positioning point.
TXT_ANCHORPOS  the -anchor option.
TXT_FILL  how to position the text relative to the point. the -fill standard option.
TXT_COLOR  the color value slot.
TXT_TEXTOPT  -text standard option.
TXT_STRING  the label text slot.
max_text_index  the number of text label template slots

Definition at line 102 of file tclSadie_plot.c.

enum x_preset_index
 

Slots for pre-set x coordinates.

Enumeration values:
X_BASE  just left of the x axis.
X_MAJOR  distal end of a major axis tick.
X_CAPTION  horizontal position at which to plot the caption.
X_RIGHT  the right end of the x axis.
max_x_preset_index  the number of x coordinate pre-set slots

Definition at line 130 of file tclSadie_plot.c.

enum y_preset_index
 

Slots for pre-set y coordinates.

Enumeration values:
Y_TOP  the top of the y axis.
Y_BASE  starting y coordinate for drawing the graph bars.
Y_MINOR  distal end of a minor axis tick.
Y_MAJOR  distal end of a major axis tick.
Y_CAPTION  vertical position at which to plot the caption.
max_y_preset_index  the number of y coordinate pre-set slots

Definition at line 119 of file tclSadie_plot.c.


Function Documentation

int tclsadie_plotter PIXEL *  line,
uint32_t  nbnd,
uint32_t  npix,
const char *  minxlbl,
const char *  maxxlbl,
int  option,
PIXEL  gmin,
PIXEL  gmax,
void *  data
 

Declare the plotting callback (defined elsewhere) so we can register it.

Because SADIE knows nothing of the Tcl/Tk specifics of tclSadie's session log (notably the Tk canvas it uses and the current vertical position within this), we first recover the relevant details from the private application-specific data. Then for each band in the image we plot a bar graph, arranging them horizontally within the session log (for large hyperspectral images this may be unwieldy). The first three bands of a multi-band image get plotted in red, green and blue respectively: everything else in black. The bar lengths are scaled according to the option code, one of the values defined in sadie.h :

  • UNIT values truncated at the unit interval (broken?),
  • NORM linear scaling, and
  • LOG logarithmic scaling.

Parameters:
[in] line a band-sequential array of pixel values to plot.
[in] nbnd the number of bands (number of bar graphs).
[in] npix the number of bars to draw for each graph.
[in] minxlbl the label for the x axis minimum.
[in] maxxlbl the label for the x axis maximum.
[in] option the scaling option code.
[in] gmin the low end of the range of pixel values.
[in] gmax the high end of the range of pixel values.
[in] data the tclSadie application private data structure.
Returns:
TCL_OK on success, TCL_ERROR on failure.

Definition at line 702 of file tclSadie_plot.c.

References BAR_COLOR, DEFAULT_SESSION_LOG_POS_INDEX, GetSadieUintFromObj2(), Tclsadie_app_data::log_refresh, Tclsadie_app_data::main_interp, Line_value_range::max, max_axl_index, max_bar_index, max_label_index, max_text_index, max_x_preset_index, max_y_preset_index, Line_value_range::min, RIGHT_MARGIN, Tclsadie_app_data::sadievar, Tclsadie_app_data::sessionlog_canvas, and TOP_MARGIN.

Referenced by tclsadie_app_init().


Generated on Fri Jul 8 14:55:03 2005 for tclSadie by  doxygen 1.4.2