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

Sadie_Multi.c File Reference

A Tcl/Tk interface to SADIE operations on multiple images and band formats. More...

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

Go to the source code of this file.

Functions

int Sadie_Multi_CombineCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Arithmetic operations on image pairs.
int Sadie_Multi_CompareCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Logical operations on image pairs.
int Sadie_Multi_PCTCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Generate a principal component transformation of a multi-band image.
int Sadie_Multi_PCSCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Transform a multi-band image by a decorrelation stretch.
int Sadie_Multi_RGB2HSVCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Generate an image that uses hue-saturation-value color coding.
int Sadie_Multi_HSV2RGBCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Decode an image that uses hue-saturation-value color coding.
int Sadie_Multi_BIL2BSQCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Generate a set of images, one for each band in a multi-band image.
int Sadie_Multi_BSQ2BILCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Create a three-band image from three individual single-band images.
int Sadie_Multi_Comp2RealCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Split a complex image into two components.
int Sadie_Multi_Real2CompCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Generate a complex image from two real images.
int Sadie_Multi_RotateCubeCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Change the storage order of bands, lines or pixels in an image.
int Sadie_Multi_Init (Tcl_Interp *interp)
 Make the commands defined in this file accessible to the Tcl interpreter.


Detailed Description

A Tcl/Tk interface to SADIE operations on multiple images and band formats.

The SADIE library supports operations that can merge multiple images into single images, or split a single multi-band image into multiple images; it can also handle principal-components based manipulations of image bands, and changes to the formats used to store multi-band images.

Author:
University of Arizona Digital Image Analysis Lab
Date:
1999, 2004
Version:
Id
Sadie_Multi.c,v 2.5 2005/03/22 22:03:33 mmunro Exp

Definition in file Sadie_Multi.c.


Function Documentation

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

Generate a set of images, one for each band in a multi-band image.

We use the SADIE library function BILTOBSQ to split a multi-band image into a set of single-band images, giving these names taken from Tcl array elements; if there are N bands, the names would be in N Tcl array elements with indices all beginning with "outname" and ending with the band number; the input image ID would be in the same array:

  • tcl_array_name(DEFAULT_IN_IMAGE_ADDR_INDEX) multi-band image ID.
  • tcl_array_name(outname(i)) outname1, outname2, ... outnameN.

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

Definition at line 335 of file Sadie_Multi.c.

References GetSadieImageFromObj2(), and NewSadieImageObj2().

Referenced by Sadie_Multi_Init().

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

Create a three-band image from three individual single-band images.

We use the SADIE library function BSQTOBIL to merge the three specified single-band images into one multi-band image, but don't manage a full inverse of Sadie_Multi_BIL2BSQCmd. The Tcl data should conform to the patterns:

  • tcl_array_name(inimg,addr1) ID of the image to become band 1.
  • tcl_array_name(inimg,addr2) ID of the image to become band 2.
  • tcl_array_name(inimg,addr3) ID of the image to become band 3.
  • tcl_array_name(DEFAULT_OUT_IMAGE_NAME_INDEX) multi-band image name.

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

Definition at line 401 of file Sadie_Multi.c.

References GetSadieImageFromObj2(), and SetSadieImageObj2().

Referenced by Sadie_Multi_Init().

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

Arithmetic operations on image pairs.

Given a pair of existing images, an arithmetic operator code, and a pair of scalar weights, generate a new image by combining corresponding pixels in the two images with the operator after scaling them with the weights, using the SADIE library function COMBINE. The self-explanatory operator codes are defined in sadie.h :

  • ADD
  • SUBTRACT
  • MULTIPLY
  • DIVIDE
  • MINIMUM
  • MAXIMUM

The Tcl data should conform to the patterns:

  • tcl_array_name(inimg,addr1) the first image ID.
  • tcl_array_name(inimg,addr1) the second image ID.
  • tcl_array_name(option) the code for a binary arithmetic operator.
  • tcl_array_name(weight1) the weight to apply to the first image.
  • tcl_array_name(weight2) the weight to apply to the second image.
  • tcl_array_name(DEFAULT_OUT_IMAGE_NAME_INDEX) newly computed image name.

Parameters:
[in] client_data (unused).
[in] interp the Tcl interpreter.
[in] objc number of Tcl object arguments (always two).
[in] objv Tcl object argument list (the Tcl array name).
Returns:
TCL_OK on success, TCL_ERROR on errors.

Definition at line 78 of file Sadie_Multi.c.

References GetSadieDoubleFromObj2(), GetSadieImageFromObj2(), GetSadieIntFromObj2(), and SetSadieImageObj2().

Referenced by Sadie_Multi_Init().

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

Split a complex image into two components.

Given an image that encodes complex pixel values in its first two bands, use the SADIE library function COM2REAL to generate a pair of output images according to an option code taking one of the values defined in sadie.h : REIMAG makes the first image the real component and the second the imaginary, MAGPHA makes the first the magnitude and the second the phase. The Tcl data should conform to the patterns:

  • tcl_array_name(DEFAULT_IN_IMAGE_ADDR_INDEX) ID of the complex image.
  • tcl_array_name(option) real/imaginary, magnitude/phase option code.
  • tcl_array_name((comp_label_index[1])) the first component image name.
  • tcl_array_name((comp_label_index[2])) the second component image name.

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

Definition at line 447 of file Sadie_Multi.c.

References GetSadieImageFromObj2(), GetSadieIntFromObj2(), and SetSadieComponentObj2().

Referenced by Sadie_Multi_Init().

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

Logical operations on image pairs.

Given a pair of existing images, and a logical operator code, generate a binary mask image by combining corresponding pixels in the two images with the operator, using the SADIE library function COMPARE. The operator codes are defined in sadie.h :

  • LT Less than.
  • LE Less than or equal to.
  • GT Greater than.
  • GE Greater than or equal to.
  • EQ Equal to.
  • NE Not equal to.
  • AND Logical and.
  • OR Logical or.
  • XOR Logical exclusive or.
  • NOT Logical not (of the first input image).

The Tcl data should conform to the patterns:

  • tcl_array_name(inimg,addr1) the first image ID.
  • tcl_array_name(inimg,addr2) the second image ID.
  • tcl_array_name(option) the code for a logical operator.
  • tcl_array_name(DEFAULT_OUT_IMAGE_NAME_INDEX) new mask image name.

Parameters:
[in] client_data (unused).
[in] interp the Tcl interpreter.
[in] objc number of Tcl object arguments (always two).
[in] objv Tcl object argument list (the Tcl array name).
Returns:
TCL_OK on success, TCL_ERROR on errors.

Definition at line 137 of file Sadie_Multi.c.

References GetSadieImageFromObj2(), GetSadieIntFromObj2(), and SetSadieImageObj2().

Referenced by Sadie_Multi_Init().

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

Decode an image that uses hue-saturation-value color coding.

Given an image where the first three bands represent hue, saturation and value codes, use the SADIE library function HSVTORGB to generate a three-band image, where the bands encode the same color information as red, green and blue channels. The Tcl data should conform to the patterns:

  • tcl_array_name(DEFAULT_IN_IMAGE_ADDR_INDEX) ID of HSV encoded image.
  • tcl_array_name(incr) spatial subsampling increment.
  • tcl_array_name(DEFAULT_OUT_IMAGE_NAME_INDEX) the RGB image name.

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

Definition at line 299 of file Sadie_Multi.c.

References GetSadieImageFromObj2(), and SetSadieImageObj2().

Referenced by Sadie_Multi_Init().

int Sadie_Multi_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 578 of file Sadie_Multi.c.

References Sadie_Multi_BIL2BSQCmd(), Sadie_Multi_BSQ2BILCmd(), Sadie_Multi_CombineCmd(), Sadie_Multi_Comp2RealCmd(), Sadie_Multi_CompareCmd(), Sadie_Multi_HSV2RGBCmd(), Sadie_Multi_PCSCmd(), Sadie_Multi_PCTCmd(), Sadie_Multi_Real2CompCmd(), Sadie_Multi_RGB2HSVCmd(), and Sadie_Multi_RotateCubeCmd().

Referenced by Tcl_AppInit().

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

Transform a multi-band image by a decorrelation stretch.

From the principal components transform of a multi-band image (identical to the one provided by Sadie_Multi_PCTCmd), normalize the varience of all the components, then do an inverse transformation to project it back into an image with bands having the same significance as in the original image; the SADIE library function DECORSTR handles everything. The Tcl data should conform to the patterns:

  • tcl_array_name(DEFAULT_IN_IMAGE_ADDR_INDEX) a multi-band image ID.
  • tcl_array_name(incr) spatial subsampling increment.
  • tcl_array_name(DEFAULT_OUT_IMAGE_NAME_INDEX) stretched image name.

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

Definition at line 224 of file Sadie_Multi.c.

References GetSadieImageFromObj2(), GetSadieUintFromObj2(), and SetSadieImageObj2().

Referenced by Sadie_Multi_Init().

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

Generate a principal component transformation of a multi-band image.

Given a multi-band image, this generates a new image of identical dimensions where the bands represent loadings on the eigenvectors of the band covariance matrix of the original image (the Karhunen-Loève decomposition, yielding EOFs: empirical orthogonal functions). The EOFs are ordered by the corresponding eigenvalues, and the bands in the output image contain the original image data projected on each EOF in turn, so the first output band is the first principal component image and so on; the SADIE library function PCT handles all the actual computation. The Tcl data should conform to the patterns:

  • tcl_array_name(DEFAULT_IN_IMAGE_ADDR_INDEX) a multi-band image ID.
  • tcl_array_name(incr) spatial subsampling increment.
  • tcl_array_name(DEFAULT_OUT_IMAGE_NAME_INDEX) transformed image name.

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

Definition at line 184 of file Sadie_Multi.c.

References GetSadieImageFromObj2(), GetSadieUintFromObj2(), and SetSadieImageObj2().

Referenced by Sadie_Multi_Init().

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

Generate a complex image from two real images.

Given a pair of real images, use the SADIE library function REAL2COM to generate a complex image, interpreting the image pair as the components specified by an option code taking one of the values defined in sadie.h : REIMAG makes the first image the real component and the second the imaginary, MAGPHA makes the first the magnitude and the second the phase. The Tcl data should conform to the patterns:

  • tcl_array_name(inimg,addr1) ID of the first component image.
  • tcl_array_name(inimg,addr2) ID of the second component image.
  • tcl_array_name(option) real/imaginary, magnitude/phase option code.
  • tcl_array_name(DEFAULT_OUT_IMAGE_NAME_INDEX) the complex image name.

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

Definition at line 489 of file Sadie_Multi.c.

References GetSadieImageFromObj2(), GetSadieIntFromObj2(), and SetSadieImageObj2().

Referenced by Sadie_Multi_Init().

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

Generate an image that uses hue-saturation-value color coding.

Given an image where the first three bands represent red, green and blue channels respectively, use the SADIE library function RGBTOHSV to generate a three-band image, where the bands encode the same color information as hue, saturation and value. The Tcl data should conform to the patterns:

  • tcl_array_name(DEFAULT_IN_IMAGE_ADDR_INDEX) ID of RGB encoded image.
  • tcl_array_name(incr) spatial subsampling increment.
  • tcl_array_name(DEFAULT_OUT_IMAGE_NAME_INDEX) the HSV image name.

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

Definition at line 263 of file Sadie_Multi.c.

References GetSadieImageFromObj2(), and SetSadieImageObj2().

Referenced by Sadie_Multi_Init().

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

Change the storage order of bands, lines or pixels in an image.

From an existing image the SADIE library function ROTATECUBE generates a new image with the interpretation of the image dimensions changed, for example mapping the bands of one scanline of a hyperspectral image onto the pixel dimension of a two-dimensional display, showing how the spectral characteristics vary along the line. Two sets of flags control the image transformations: sign flags take the value 0 to keep the original order of values along an axis, or 1 to invert it; dimension flags specify which axis of the input image to map onto an axis of the output image: 0 specifies the band axis, 1 the line axis and 2 the pixel axis. The Tcl data should conform to the patterns:

  • tcl_array_name(DEFAULT_IN_IMAGE_ADDR_INDEX) ID of the input image.
  • tcl_array_name(x,sign) the sign flag for the x axis.
  • tcl_array_name(y,sign) the sign flag for the y axis.
  • tcl_array_name(z,sign) the sign flag for the z axis.
  • tcl_array_name(x,cubedim) the dimension flag for the x axis.
  • tcl_array_name(y,cubedim) the dimension flag for the y axis.
  • tcl_array_name(z,cubedim) the dimension flag for the z axis.
  • tcl_array_name(DEFAULT_OUT_IMAGE_NAME_INDEX) the output image name.

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

Definition at line 542 of file Sadie_Multi.c.

References GetSadieImageFromObj2(), GetSadieIntFromObj2(), and SetSadieImageObj2().

Referenced by Sadie_Multi_Init().


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