#include <tcl.h>
#include <tk.h>
#include <sadie.h>
#include "tclsadie.h"
Go to the source code of this file.
SADIE library globals | |
Global variables within the SADIE library that augment function arguments. | |
*uint32_t | nlev |
Used by STRETCH, TFQUANT & WTFMAJ. | |
PIXEL | gain |
Used by STRETCH & TFLINEAR. | |
PIXEL | bias |
Used by STRETCH & TFLINEAR. | |
PIXEL | gmin |
Used by STRETCH, TFQUANT, TFSAT, TFSCALE & WTFMAJ. | |
PIXEL | gmax |
Used by STRETCH, TFINVERT, TFQUANT, TFSAT & TFSCALE. | |
PIXEL | thresh |
Used by STRETCH, TFTHRESH, WINDOW & WTFCAVG. | |
PIXEL | gbrk [2][4] |
Used by STRETCH & TFPLT. | |
PIXEL * | table |
Used by STRETCH & TFTABLE. | |
Functions | |
int | Sadie_Contrast_NormStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Normalize the contrast within an image. | |
int | Sadie_Contrast_HisteqStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Apply a histogram equalization to an image. | |
int | Sadie_Contrast_LinearStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Apply a linear contrast stretch to an image. | |
int | Sadie_Contrast_LogStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Apply a log transform to an image. | |
int | Sadie_Contrast_PWLStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Apply a three-segment piecewise linear transformation to an image. | |
int | Sadie_Contrast_RootStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Apply a square root transformation to an image. | |
int | Sadie_Contrast_SqrStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Square all the image pixel values. | |
int | Sadie_Contrast_TblStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Re-map image greylevels using an arbitrary look-up table. | |
int | Sadie_Contrast_QntStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Quantize image pixel values to a specified number of greylevels. | |
int | Sadie_Contrast_SatStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Apply a saturation stretch to an image. | |
int | Sadie_Contrast_ThreshStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Convert a continuous image to a binary (two-valued) one. | |
int | Sadie_Contrast_AdaptStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Transform an image with the Local Range Modification algorithm. | |
int | Sadie_Contrast_RefStretchCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Transform the greylevels in an image to match those in a reference image. | |
int | Sadie_Contrast_Init (Tcl_Interp *interp) |
Make the commands defined in this file accessible to the Tcl interpreter. |
The SADIE library includes several operations to re-scale pixel values, notably contrast stretching operations. Unfortunately several of these use shared global data structures within the library, and are not thread-safe or re-entrant even in versions that protect other shared data with locks: see the list of extern declarations within this file for details.
Definition in file Sadie_Contrast.c.
|
Transform an image with the Local Range Modification algorithm. The SADIE library function VSTRETCH does all the real work, evaluating a maximal linear stretch for fixed-size square regions that completely tile the image, interpolating between these to give a per-pixel transformation, and applying this to the image. The Tcl data should conform to the patterns:
Definition at line 566 of file Sadie_Contrast.c. References GetSadieImageFromObj2(), GetSadieUintFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Contrast_Init(). |
|
Apply a histogram equalization to an image. Given an image and the number of histogram bins, this uses the SADIE library function HISTEQ to re-map the image values using the empirically determined value distribution as a look-up table, optionally downsampling the image in the process. The Tcl data should conform to the patterns:
Definition at line 130 of file Sadie_Contrast.c. References GetSadieImageFromObj2(), GetSadieUintFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Contrast_Init(). |
|
Make the commands defined in this file accessible to the Tcl interpreter.
Definition at line 645 of file Sadie_Contrast.c. References Sadie_Contrast_AdaptStretchCmd(), Sadie_Contrast_HisteqStretchCmd(), Sadie_Contrast_LinearStretchCmd(), Sadie_Contrast_LogStretchCmd(), Sadie_Contrast_NormStretchCmd(), Sadie_Contrast_PWLStretchCmd(), Sadie_Contrast_QntStretchCmd(), Sadie_Contrast_RefStretchCmd(), Sadie_Contrast_RootStretchCmd(), Sadie_Contrast_SatStretchCmd(), Sadie_Contrast_SqrStretchCmd(), Sadie_Contrast_TblStretchCmd(), and Sadie_Contrast_ThreshStretchCmd(). Referenced by Tcl_AppInit(). |
|
Apply a linear contrast stretch to an image. We select either the SADIE library function TFSCALE, which uses linear interpolation between the specified maximum and minimum levels, or TFLINEAR, which uses new_value = bias + gain * old_value for each pixel. The Tcl data should conform to the patterns:
Definition at line 173 of file Sadie_Contrast.c. References bias, gain, GetSadieDoubleFromObj2(), GetSadieImageFromObj2(), GetSadieIntFromObj2(), gmax, gmin, and SetSadieImageObj2(). Referenced by Sadie_Contrast_Init(). |
|
Apply a log transform to an image. This is simply an interface to the SADIE library function TFLOG, which applies the log10 function to the pixel values, while retaining values less than or equal to zero. The Tcl data should conform to the patterns:
Definition at line 226 of file Sadie_Contrast.c. References GetSadieImageFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Contrast_Init(). |
|
Normalize the contrast within an image. Taking an arbitrary input image, this generates an output image whose pixels have the specified mean and standard deviation (optionally down-sampling in the process), using the SADIE library function CONTNORM. The Tcl data should conform to the patterns:
Definition at line 84 of file Sadie_Contrast.c. References GetSadieDoubleFromObj2(), GetSadieImageFromObj2(), GetSadiePixelFromObj2(), GetSadieUintFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Contrast_Init(). |
|
Apply a three-segment piecewise linear transformation to an image. We define the linear segments by the values (breakpoints) of their ends in both the original image and the transformed image, so for three segments we need two sets of four breakpoint values. The SADIE library function TFPLT handles the actual transformation. The Tcl data should conform to the patterns:
Definition at line 270 of file Sadie_Contrast.c. References gbrk, GetSadieImageFromObj2(), GetSadiePixelFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Contrast_Init(). |
|
Quantize image pixel values to a specified number of greylevels.
Given a image whose greylevels are continuous (down to the numerical precision of the
Definition at line 447 of file Sadie_Contrast.c. References GetSadieImageFromObj2(), GetSadiePixelFromObj2(), GetSadieUintFromObj2(), gmax, gmin, nlev, and SetSadieImageObj2(). Referenced by Sadie_Contrast_Init(). |
|
Transform the greylevels in an image to match those in a reference image. Given an arbitrary image to be transformed and a reference image (of identical size), the SADIE library function MATCH can apply a reference stretch according two one of two selectable algorithms: either by inverting the cumulative distribution function (CDF) of the reference image, or by using the observed joint distribution of greylevels in the two images to derive an averaged look-up table (LUT). The SADIE library refers to the LUT option as the "least squares transformation", but it does not do any kind of regression. The Tcl data should conform to the patterns:
Definition at line 611 of file Sadie_Contrast.c. References GetSadieImageFromObj2(), GetSadieUintFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Contrast_Init(). |
|
Apply a square root transformation to an image. This is simply an interface to the SADIE library function TFROOT, which takes the square root of the pixel values, not generating complex values if they are negative. The Tcl data should conform to the patterns:
Definition at line 321 of file Sadie_Contrast.c. References GetSadieImageFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Contrast_Init(). |
|
Apply a saturation stretch to an image. Re-assign image pixel values above a specified threshold to the maximum value in the image, and those below a specified threshold to the minimum value in the image, using the SADIE library function TFSAT. The Tcl data should conform to the patterns:
Definition at line 489 of file Sadie_Contrast.c. References GetSadieImageFromObj2(), GetSadiePixelFromObj2(), gmax, gmin, and SetSadieImageObj2(). Referenced by Sadie_Contrast_Init(). |
|
Square all the image pixel values. This is an interface to the SADIE library function TFSQUARE, which computes the squares of all the pixel values. The Tcl data should conform to the patterns:
Definition at line 354 of file Sadie_Contrast.c. References GetSadieImageFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Contrast_Init(). |
|
Re-map image greylevels using an arbitrary look-up table. We require not only an image to transform, but a Tcl array (not a list) whose indices include the numeric value of each greylevel in the range found within the image, assigned a the new value to replace this in the transformed image. The SADIE library function TFTABLE handles the actual trasformation. The Tcl data should conform to the patterns:
Definition at line 391 of file Sadie_Contrast.c. References GetSadieImageFromObj2(), GetSadiePixelFromObj2(), nlev, SetSadieImageObj2(), and table. Referenced by Sadie_Contrast_Init(). |
|
Convert a continuous image to a binary (two-valued) one. This maps all the pixel values below a theshold to the current minimum value, and all the pixel values greater than or equal to the threshold to the current maximum value, using the SADIE library TFTHRESH function. The Tcl data should conform to the patterns:
Definition at line 528 of file Sadie_Contrast.c. References GetSadieImageFromObj2(), GetSadiePixelFromObj2(), SetSadieImageObj2(), and thresh. Referenced by Sadie_Contrast_Init(). |