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

Sadie_Plot.c File Reference

Tcl/Tk interfaces to plotting and region of interest operations. More...

#include <tcl.h>
#include <tk.h>
#include <stdio.h>
#include <string.h>
#include <sadie.h>
#include "tclsadie.h"
#include "bresenham.h"
#include "tclSadie_ROI.h"

Go to the source code of this file.

Functions

int Sadie_Plot_ProfileCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Plot the profiles of image values between two specified image points.
int Sadie_Plot_StatisticsCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Compute summary statistics and value distribution historams for an image.
int Sadie_Plot_CreateROICmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Define a rectangular region of interest within an image.
int Sadie_Plot_Init (Tcl_Interp *interp)
 Make the commands defined in this file accessible to the Tcl interpreter.


Detailed Description

Tcl/Tk interfaces to plotting and region of interest operations.

The operations to display histograms and other pixel value statistics (and analyse regions of interest within images) are largely defined elsewhere (including callbacks that must be pre-registered with the SADIE library and utilities defined within tclSadie), but we define the high-level Tcl/Tk interfaces to these here.

Author:
University of Arizona Digital Image Analysis Lab
Date:
1999, 2004
Version:
Id
Sadie_Plot.c,v 2.4 2005/03/22 21:01:45 mmunro Exp

Definition in file Sadie_Plot.c.


Function Documentation

int Sadie_Plot_CreateROICmd ClientData  client_data,
Tcl_Interp *  interp,
int  objc,
Tcl_Obj *const   objv[]
 

Define a rectangular region of interest within an image.

Although the SADIE library does not support Regions of Interest (ROIs), an extension within tclSadie allows definition of multiple rectangular ROIs associated with particular images. Here we add a new ROI to an image using this extension (see the file tclSadie_ROI.c for more details). The array of Tcl object arguments is arranged in the following pattern:

  • objv[0] the command name.
  • objv[1] compute statistics on the image with this ID.
  • objv[2] the sub-sampling increment (pixel units).
  • objv[3] the number of histogram bins for each band.
  • objv[4] set 1 if a covarience matrix is needed, 0 otherwise.
  • objv[5] the horizontal coordinate of one ROI corner.
  • objv[6] the vertical coordinate of one ROI corner.
  • objv[7] the horizontal coordinate of the opposite ROI corner.
  • objv[8] the vertical coordinate of the opposite ROI corner.
  • objv[9] the ROI name.

Parameters:
[in] client_data (unused).
[in] interp the main Tcl interpreter.
[in] objc the number of Tcl object arguments (always four).
[in] objv the array of Tcl object arguments.
Returns:
TCL_OK, or TCL_ERROR on errors.

Definition at line 288 of file Sadie_Plot.c.

References CREATE_ROI(), GetSadieDkeyFromObj(), GetSadieImageFromObj(), GetSadieUintFromObj(), and nlev.

Referenced by Sadie_Plot_Init().

int Sadie_Plot_Init Tcl_Interp *  interp  ) 
 

Make the commands defined in this file accessible to the Tcl interpreter.

Parameters:
[in] interp the main Tcl interpreter.
Returns:
TCL_OK on success.

Definition at line 339 of file Sadie_Plot.c.

References Sadie_Plot_CreateROICmd(), Sadie_Plot_ProfileCmd(), and Sadie_Plot_StatisticsCmd().

Referenced by Tcl_AppInit().

int Sadie_Plot_ProfileCmd ClientData  client_data,
Tcl_Interp *  interp,
int  objc,
Tcl_Obj *const   objv[]
 

Plot the profiles of image values between two specified image points.

A callback that handles most of the Tcl/Tk drawing interface should already be registered with the SADIE library (see the tclSadie_plot.c file for details), and the PLOT function invokes this. However it doesn't extract the values to be plotted from the image itself, so here we must define a temporary array to hold them (extracting each band independently), and track positions along the profile line with the Bresenham algorithm (there is no interpolation, so the number of profile points will not equal the Euclidean distance between the points in pixel units). An option code determines the scaling on the plot (one of the constants UNIT, NORM or LOG defined in sadie.h). The Tcl object arguments that specify all the plot details are in the following arrangement:

  • objv[0] the command name.
  • objv[1] locate the profile within the image with this ID.
  • objv[2] the horizontal coordinate of the profile start.
  • objv[3] the vertical coordinate of the profile start.
  • objv[4] the horizontal coordinate of the profile end.
  • objv[5] the vertical coordinate of the profile end.
  • objv[6] a scaling option code.

Parameters:
[in] client_data (unused).
[in] interp the main Tcl interpreter.
[in] objc the number of Tcl object arguments (always four).
[in] objv the array of Tcl object arguments.
Returns:
TCL_OK, or TCL_ERROR on errors.

Definition at line 74 of file Sadie_Plot.c.

References bresenham_from_s_coord(), bresenham_linep_t, bresenham_next(), demolish_bresenham(), and GetSadieImageFromObj().

Referenced by Sadie_Plot_Init().

int Sadie_Plot_StatisticsCmd ClientData  client_data,
Tcl_Interp *  interp,
int  objc,
Tcl_Obj *const   objv[]
 

Compute summary statistics and value distribution historams for an image.

The SADIE library function STATS computes a variety of statistics for the pixel values of an image, including the histograms of the value distributions in the first few bands (using the same Tcl/Tk-aware callback used indirectly by Sadie_Plot_ProfileCmd). However it requires provision of some temporary workspace for accumulating the statistics for each band, and we augment it here with the RANGE function for finding maxima and minima, and the COVAR function for the optional band covariance matrix. The range option code specifies how to handle the specified range of pixel values, as one of the constants IGNORE, INCLUDE or EXCLUDE defined in sadie.h. The array holding the Tcl object arguments is arranged as follows:

  • objv[0] the command name.
  • objv[1] compute statistics on the image with this ID.
  • objv[2] the sub-sampling increment (pixel units).
  • objv[3] the number of histogram bins for each band.
  • objv[4] set 1 if a covarience matrix is needed, 0 otherwise.
  • objv[5] the range option code.
  • objv[6] the start of the range of pixel values.
  • objv[7] the end of the range of pixel values.

Parameters:
[in] client_data (unused).
[in] interp the main Tcl interpreter.
[in] objc the number of Tcl object arguments (always four).
[in] objv the array of Tcl object arguments.
Returns:
TCL_OK, or TCL_ERROR on errors.

Definition at line 180 of file Sadie_Plot.c.

References GetSadieImageFromObj(), gmax, and gmin.

Referenced by Sadie_Plot_Init().


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