#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. | |
uint32_t | csize |
Used by WINDOW & WTFCAVG. | |
double | weight |
Used by WINDOW & WTFMAJ. | |
double * | count |
Used by WTFMAJ. | |
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. | |
Defines | |
#define | GRADIENT_KERNEL_SIZE 3 |
The width of the gradient operator kernel, in pixels. | |
#define | GRADIENT_KERNEL_AREA 9 |
The storage required for the gradient operator kernel, in pixels. | |
Functions | |
int | Sadie_Filter_PSpectCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Compute an image power spectrum, either 2D, or 1D (row or column averages). | |
int | Sadie_Filter_FFTConvCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Convolve a image with a function via a Fast Fourier Transform. | |
int | Sadie_Filter_FFTFiltCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Convolve an image with a pre-defined function. | |
int | Sadie_Filter_FFTCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Compute a forward or inverse two-dimensional Fourier transform of an image. | |
int | Sadie_Filter_FHTCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Compute a forward or inverse two-dimensional Hartley transform of an image. | |
int | Sadie_Filter_MaskConvCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Convolve an image with a kernel defined in a Tcl array. | |
int | Sadie_Filter_ImageConvCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Convolve an image with a spatial kernel defined in another image. | |
int | Sadie_Filter_LibGradCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Convolve the image with one of a set of pre-defined gradient operators. | |
int | Sadie_Filter_MaskGradCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Apply a gradient operator defined in Tcl array elements to an image. | |
int | Sadie_Filter_ImageGradCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Apply a gradient operator defined by a pair of images to a third image. | |
int | Sadie_Filter_VarMapCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Compute a local variance map from a sliding sub-window within an image. | |
int | Sadie_Filter_MinFiltCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Compute minima for a sliding sub-window within an image. | |
int | Sadie_Filter_MaxFiltCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Compute maxima for a sliding sub-window within an image. | |
int | Sadie_Filter_DivMapCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Compute greylevel diversity for a sliding sub-window within an image. | |
int | Sadie_Filter_MajFiltCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Apply a local majority filter to an image. | |
int | Sadie_Filter_MedFiltCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Apply a median filter to an image. | |
int | Sadie_Filter_CAvgFiltCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Determine the conditional average of an image. | |
int | Sadie_Filter_Init (Tcl_Interp *interp) |
Make the commands defined in this file accessible to the Tcl interpreter. |
Here are Tcl/Tk interfaces to most of the local convolution kernel-based filtering operations provided by the SADIE library, as well as the Fourier and Hartley transforms and the operations derived from them (such as frequency-domain convolutions and power spectrum determinations). Please note that some of the operations are not thread-safe or even re-entrant, using shared global variables in the SADIE library (see the list of external variable declarations for details).
Definition in file Sadie_Filter.c.
|
Determine the conditional average of an image.
The SADIE library function WTFCAVG implements a conditional average operation within a fixed-sized window. If none of the conditions are met, this is identical to the value of the pixel at the center of the window. If there is no limit on the number of divergent pixels, it is the simple mean of all those pixels whose values are less than the specified threshold from the value of the center pixel. If there are pixels whose values lie beyond this threshold from the center pixel (divegent pixels), the total count of divergent pixels is greater than the limit, and the range of their values is less than the threshold, it is the simple mean of the divergent pixels. We set the parameters from Tcl variables, assign all the necessary global variables (and should maintain the convention that the
Definition at line 923 of file Sadie_Filter.c. References csize, GetSadieImageFromObj2(), GetSadiePixelFromObj2(), GetSadieUintFromObj2(), SetSadieImageObj2(), and thresh. Referenced by Sadie_Filter_Init(). |
|
Compute greylevel diversity for a sliding sub-window within an image. The SADIE library function WTFDIVER computes greylevel diversity within a window: use the WINDOW function to apply it, via the apply_sadie_window() function.
Definition at line 781 of file Sadie_Filter.c. Referenced by Sadie_Filter_Init(). |
|
Compute a forward or inverse two-dimensional Fourier transform of an image.
The SADIE library function FFT2D implements a two-dimensional Fast Fourier Transform algorithm, using the codes
Definition at line 251 of file Sadie_Filter.c. References GetSadieImageFromObj2(), GetSadieIntFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Filter_Init(). |
|
Convolve a image with a function via a Fast Fourier Transform.
We use the SADIE library function FCONVL to convolve one (arbitrary) image with another whose values represent either a set of spatial weights (such as a sampled point spread function), or a sampled frequency-domain transfer function. The codes
Definition at line 130 of file Sadie_Filter.c. References GetSadieImageFromObj2(), GetSadieIntFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Filter_Init(). |
|
Convolve an image with a pre-defined function.
The SADIE library includes a function FILTER that uses a Fast Fourier Transform to convolve an image with members of a family of filter functions that specify an amplitude for a particular combination of two parameters giving x and y spatial frequencies, defined in the interval [0, 1/2], and two scaling parameters giving the radii of the filter in the frequency domain, in cycles per pixel. It also pre-defines some such functions, so here we just select one from several of these pre-defined functions, and convolve the image with it. Note that the filter selection codes differ from those in
The Tcl data should conform to the patterns:
Definition at line 186 of file Sadie_Filter.c. References GetSadieDoubleFromObj2(), GetSadieImageFromObj2(), GetSadieIntFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Filter_Init(). |
|
Compute a forward or inverse two-dimensional Hartley transform of an image.
The SADIE library function FHT2D implements a two-dimensional Fast Hartley Transform algorithm, using the codes
Definition at line 289 of file Sadie_Filter.c. References GetSadieImageFromObj2(), GetSadieIntFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Filter_Init(). |
|
Convolve an image with a spatial kernel defined in another image. The SADIE library function SCONVL convolves an image with a two- dimensional spatial kernel. Here we feed it the kernel weights from another SADIE image, first dividing them by a constant we specify, and apply it to the specified image. The Tcl data should conform to the patterns:
Definition at line 404 of file Sadie_Filter.c. References GetSadieBooleanFromObj2(), GetSadieImageFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Filter_Init(). |
|
Apply a gradient operator defined by a pair of images to a third image. We interpret the pixel values in a pair of SADIE images as discrete versions of the functions that define the gradient in the orthogonal x (horizontal) and y (vertical) directions: the paired square convolution kernels the SADIE function GRADIENT can use to derive paired gradient magnitude and direction images from the input image. The Tcl data should conform to the patterns:
Definition at line 593 of file Sadie_Filter.c. References GetSadieImageFromObj2(), and SetSadieComponentObj2(). Referenced by Sadie_Filter_Init(). |
|
Make the commands defined in this file accessible to the Tcl interpreter.
Definition at line 957 of file Sadie_Filter.c. References Sadie_Filter_CAvgFiltCmd(), Sadie_Filter_DivMapCmd(), Sadie_Filter_FFTCmd(), Sadie_Filter_FFTConvCmd(), Sadie_Filter_FFTFiltCmd(), Sadie_Filter_FHTCmd(), Sadie_Filter_ImageConvCmd(), Sadie_Filter_ImageGradCmd(), Sadie_Filter_LibGradCmd(), Sadie_Filter_MajFiltCmd(), Sadie_Filter_MaskConvCmd(), Sadie_Filter_MaskGradCmd(), Sadie_Filter_MaxFiltCmd(), Sadie_Filter_MedFiltCmd(), Sadie_Filter_MinFiltCmd(), Sadie_Filter_PSpectCmd(), and Sadie_Filter_VarMapCmd(). Referenced by Tcl_AppInit(). |
|
Convolve the image with one of a set of pre-defined gradient operators.
The SADIE library includes a generic gradient function, GRADIENT, and a small set of 3 X 3 gradient kernels that the EDGE function can supply to it to provide some well-known gradient operators. Here we apply EDGE to an image, generating both a magnitude and a direction image, and specify the particular gradient operator by a code that should be one of the constants
Definition at line 482 of file Sadie_Filter.c. References GetSadieImageFromObj2(), GetSadieIntFromObj2(), and SetSadieComponentObj2(). Referenced by Sadie_Filter_Init(). |
|
Apply a local majority filter to an image. The SADIE library function WTFMAJ implements a local majority filter (a little more elaborate than a modal filter, using the specified weighting parameter to handle the treatment of the mid-point of the distribution of values within a fixed-size window). It requires some messy initialization of global variables within the SADIE library, including allocating an array in which to summarize the value distribution. We set the parameters from Tcl variables, assign all the necessary global variables, and let the standard SADIE library function WINDOW apply the filter to the image via a sliding window. The Tcl data should conform to the patterns:
Definition at line 812 of file Sadie_Filter.c. References count, GetSadieDoubleFromObj2(), GetSadieImageFromObj2(), GetSadieUintFromObj2(), gmax, gmin, nlev, SetSadieImageObj2(), and weight. Referenced by Sadie_Filter_Init(). |
|
Convolve an image with a kernel defined in a Tcl array. The SADIE library function SCONVL convolves an image with a two- dimensional spatial kernel. Here we feed it the kernel weights from Tcl array elements, first dividing them by a constant we specify, and apply it to the specified image. The Tcl data should conform to the patterns:
Definition at line 331 of file Sadie_Filter.c. References GetSadieDoubleFromObj2(), GetSadieImageFromObj2(), GetSadieUintFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Filter_Init(). |
|
Apply a gradient operator defined in Tcl array elements to an image. The SADIE library function GRADIENT generates paired gradient direction and magnitude images from an input image and two square convolution kernels, defining the components of the gradient in the x and y (horizontal and vertical) directions. Here we apply it to an image, taking the kernel weights from Tcl array elements. The Tcl data should conform to the patterns:
Definition at line 530 of file Sadie_Filter.c. References GetSadieDoubleFromObj2(), GetSadieImageFromObj2(), GRADIENT_KERNEL_AREA, and SetSadieComponentObj2(). Referenced by Sadie_Filter_Init(). |
|
Compute maxima for a sliding sub-window within an image. The SADIE library function WTFMAX finds the maximum value within a fixed-size window: use the WINDOW function to apply it, via the apply_sadie_window() function, to every sliding window position in an image.
Definition at line 762 of file Sadie_Filter.c. Referenced by Sadie_Filter_Init(). |
|
Apply a median filter to an image. The SADIE library function MEDIAN finds the median of the values for each position of a sliding window within an image. The Tcl data should conform to the patterns:
Definition at line 867 of file Sadie_Filter.c. References GetSadieImageFromObj2(), GetSadieUintFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Filter_Init(). |
|
Compute minima for a sliding sub-window within an image. The SADIE library function WTFMIN finds the minimum value within a fixed-size window: use the WINDOW function to apply it, via the apply_sadie_window() function, to every sliding window position in an image.
Definition at line 742 of file Sadie_Filter.c. Referenced by Sadie_Filter_Init(). |
|
Compute an image power spectrum, either 2D, or 1D (row or column averages).
We use either the SADIE library function PSPECT (for the two-dimensional spectrum) or PSPECT1D (for one-dimensional row or column averages), which in turn use a Fast Fourier Transform-derived power spectrum. The option codes to select 2-D, 1-D rows, or 1-D columns are
Definition at line 86 of file Sadie_Filter.c. References GetSadieImageFromObj2(), GetSadieIntFromObj2(), and SetSadieImageObj2(). Referenced by Sadie_Filter_Init(). |
|
Compute a local variance map from a sliding sub-window within an image. The SADIE library function WTFVAR computes the variance within a window: use the WINDOW function to apply it, via the apply_sadie_window() function.
Definition at line 722 of file Sadie_Filter.c. Referenced by Sadie_Filter_Init(). |