#include <tcl.h>
#include <tk.h>
#include <sadie.h>
#include "project_utilities.h"
Go to the source code of this file.
BEGIN_C_DECLARATIONSStrings used to reference Tcl data. | |
Default or constant strings serving as Tcl names or array indexes. We follow a convention that defines the strings in one place (here), then copies them into private character arrays within the files that need to reference them. | |
#define | SADIEVAR_ARRAYNAME "SadieVar" |
The name of the global Tcl array for SADIE settings. | |
#define | DEFAULT_IN_IMAGE_ADDR_INDEX "inimg,addr" |
The usual index for finding a SADIE image ID within a Tcl array. | |
#define | DEFAULT_OUT_IMAGE_NAME_INDEX "outname" |
The usual index for finding an output image name within a Tcl array. | |
#define | DEFAULT_MESSAGE_INDEX "message" |
A trace on an array element with this index updates the session log. | |
#define | DEFAULT_ERR_POPUP ".dlg" |
The canvas name for pop-up modal dialogs. | |
#define | DEFAULT_SESSION_LOG_CANVAS ".sessionlog.canvas" |
The canvas name for the session log window. | |
#define | DEFAULT_SESSION_LOG_POS_INDEX "sessionlog,pos" |
The index of a Tcl array element tracking the session log insert point. | |
#define | DEFAULT_SESSION_LOG_REFRESH "update_sessionlog_view" |
The name of a Tcl command for updating the session log. | |
#define | DEFAULT_TCL_ARRAY_TITLE "arrayname" |
The name to use for a Tcl array in error messages, etc. | |
Defines | |
#define | TCLSADIE_H 1 |
The standard guard against including the same header twice. | |
Typedefs | |
typedef Tclsadie_app_data * | tclsadie_app_datap_t |
The pointer to the private data, recovered from void* in callbacks. | |
typedef Tclsadie_cmd_skel * | tclsadie_cmd_skelp_t |
A pointer to a pre-parsed Tcl object command. | |
Functions | |
int | tclsadie_private_data_init (Tcl_Interp *interp) |
Set up the tclSadie-specific private data structure for the SADIE library. | |
int | tclsadie_app_init (void) |
Register all the necessary callbacks with the SADIE library. | |
int | ProgMeter_Create (const char *title, void *data) |
Create a pop-up progress meter widget. | |
int | ProgMeter_Update (int gaugenum, double value, void *data) |
Modify the progress displayed by an existing progress meter. | |
int | ProgMeter_Destroy (int gaugenum, void *data) |
Destroy a pop-up progress meter widget. | |
Tcl_Obj * | NewSadieImageObj (IMAGE *img) |
Create a Tcl object representation from a SADIE image. | |
Tcl_Obj * | NewSadieImageObj2 (Tcl_Interp *interp, Tcl_Obj *arrayobjPtr, const char *ixname, IMAGE *imagePtr) |
Make a Tcl object representing a SADIE image ID, resetting the image name. | |
int | SetSadieNamedImageResult (Tcl_Interp *interp, IMAGE *imagePtr, Tcl_Obj *nameobjPtr) |
Reset a SADIE image name, then return its ID as the Tcl interpreter result. | |
int | GetSadieImageFromObj (Tcl_Obj *objPtr, IMAGE **imagehandle) |
Recover a pointer to a SADIE image from a Tcl object. | |
int | GetSadieDkeyFromObj (Tcl_Obj *objPtr, const char **dkeyhandle) |
Obtain a hashable string from a Tcl object representing a SADIE image ID. | |
int | GetSadieImageFromObj2 (Tcl_Interp *interp, Tcl_Obj *arrayobjPtr, const char *ixname, IMAGE **imagehandle) |
Recover a pointer to a SADIE image from a Tcl array element. | |
int | SetSadieImageObj2 (Tcl_Interp *interp, Tcl_Obj *arrayobjPtr, const char *ixname, IMAGE *imagePtr) |
Set the Tcl interpreter result to the ID of a renamed SADIE image. | |
int | SetSadieComponentObj2 (Tcl_Interp *interp, Tcl_Obj *arrayobjPtr, const char **ixname, IMAGE **comp_image) |
Set the Tcl interpreter result to a list representing a SADIE image pair. | |
int | GetSadiePixelFromObj2 (Tcl_Interp *interp, Tcl_Obj *arrayobjPtr, const char *ixname, PIXEL *pixelPtr) |
Recover a PIXEL value from a Tcl array element. | |
int | GetSadieUintFromObj (Tcl_Interp *interp, Tcl_Obj *objPtr, uint32_t *uintPtr) |
Recover a 32-bit unsigned integer value from a Tcl object. | |
int | GetSadieUint64FromObj (Tcl_Interp *interp, Tcl_Obj *objPtr, uint64_t *uintPtr) |
Recover a 64-bit unsigned integer value from a Tcl object. | |
int | GetSadieUintFromObj2 (Tcl_Interp *interp, Tcl_Obj *arrayobjPtr, const char *ixname, uint32_t *uintPtr) |
Recover a 32-bit unsigned integer value from a Tcl array element. | |
int | GetSadieIntFromObj2 (Tcl_Interp *interp, Tcl_Obj *arrayobjPtr, const char *ixname, int *intPtr) |
Recover an integer value from a Tcl array element. | |
int | GetSadieDoubleFromObj2 (Tcl_Interp *interp, Tcl_Obj *arrayobjPtr, const char *ixname, double *doublePtr) |
Recover a double value from a Tcl array element. | |
int | GetSadieBooleanFromObj2 (Tcl_Interp *interp, Tcl_Obj *arrayobjPtr, const char *ixname, int *boolPtr) |
Recover an Boolean value from a Tcl array element. | |
int | GetSadieDkeyFromObj2 (Tcl_Interp *interp, Tcl_Obj *arrayobjPtr, const char *ixname, const char **dkeyhandle) |
Obtain a hashable string value from a Tcl array element. |
Visible interfaces for the utility functions that recover data from Tcl arrays, implement progress bars, and maintain tclSadie's private data within the SADIE library.
Definition in file tclsadie.h.
|
Recover an Boolean value from a Tcl array element.
Tcl Boolean values are a little more versatile than just the integer constants 0 and 1. Objects whose string representation is
Definition at line 617 of file tclSadie_getset.c. Referenced by Sadie_Classify_MaxLikeCmd(), Sadie_Classify_MinDistCmd(), and Sadie_Filter_ImageConvCmd(). |
|
Obtain a hashable string from a Tcl object representing a SADIE image ID. The string representation of the image ID object is already a reasonable hash key. Note however that we do not copy it here, and it should generally be copied for subsequent use, lest the Tcl object be nodified or freed.
Definition at line 664 of file tclSadie_getset.c. Referenced by GetSadieDkeyFromObj2(), Sadie_General_IndexImageCmd(), and Sadie_Plot_CreateROICmd(). |
|
Obtain a hashable string value from a Tcl array element. The standard Tcl library function Tcl_ObjGetVar2 finds the string value through a pair of Tcl objects: an array name (provided as an existing Tcl object) and an index (newly created from the specified C string), then GetSadieDkeyFromObj recovers the string pointer, which we deposit in dkeyhandle, or set this NULL if an error arises.
Definition at line 699 of file tclSadie_getset.c. References GetSadieDkeyFromObj(). Referenced by Sadie_Classify_LvlSliceCmd(), Sadie_Classify_MaxLikeCmd(), and Sadie_Classify_MinDistCmd(). |
|
Recover a double value from a Tcl array element. We use Tcl_ObjGetVar2 to find the double value through a pair of Tcl objects: an array name (provided as an existing Tcl object) and an index (newly created from a C string argument). If possible, we deposit the value in the location specified by doublePtr, but otherwise set this to zero.
Definition at line 561 of file tclSadie_getset.c. Referenced by Sadie_Classify_MaxLikeCmd(), Sadie_Classify_SegmentCmd(), Sadie_Contrast_LinearStretchCmd(), Sadie_Contrast_NormStretchCmd(), Sadie_Filter_FFTFiltCmd(), Sadie_Filter_MajFiltCmd(), Sadie_Filter_MaskConvCmd(), Sadie_Filter_MaskGradCmd(), Sadie_Multi_CombineCmd(), Sadie_NewFunctions_ChirpCmd(), Sadie_NewFunctions_FunctionCmd(), Sadie_NewFunctions_RandomCmd(), Sadie_NewFunctions_SineStarCmd(), Sadie_NewFunctions_SineWaveCmd(), Sadie_Tools_ContMapCmd(), and Sadie_Tools_ReliefCmd(). |
|
Recover a pointer to a SADIE image from a Tcl object. If possible, we deposit a pointer to a SADIE image in the specified location, but otherwise set it to NULL. Note that the string representation we use here may change in future.
Definition at line 73 of file tclSadie_getset.c. Referenced by Sadie_FileIO_SaveCmd(), Sadie_FileIO_SaveEPSCmd(), Sadie_FileIO_SavePNMCmd(), Sadie_FileIO_SaveTEXTCmd(), Sadie_FileIO_SaveTIFFCmd(), Sadie_General_GetNumBandsCmd(), Sadie_General_GetPixelCmd(), Sadie_General_GmaxCmd(), Sadie_General_GminCmd(), Sadie_General_HeightCmd(), Sadie_General_IndexImageCmd(), Sadie_General_SetNameCmd(), Sadie_General_WidthCmd(), Sadie_Plot_CreateROICmd(), Sadie_Plot_ProfileCmd(), and Sadie_Plot_StatisticsCmd(). |
|
|
Recover an integer value from a Tcl array element. We use Tcl_ObjGetVar2 to find the integer value through a pair of Tcl objects: an array name (provided as an existing Tcl object) and an index (newly created from a C string argument). If possible, we deposit the value in the location specified by intPtr, but otherwise set this to zero.
Definition at line 511 of file tclSadie_getset.c. Referenced by Sadie_Classify_ClusterCmd(), Sadie_Classify_LvlSliceCmd(), Sadie_Classify_MaxLikeCmd(), Sadie_Classify_MinDistCmd(), Sadie_Classify_SegmentCmd(), Sadie_Contrast_LinearStretchCmd(), Sadie_Filter_FFTCmd(), Sadie_Filter_FFTConvCmd(), Sadie_Filter_FFTFiltCmd(), Sadie_Filter_FHTCmd(), Sadie_Filter_LibGradCmd(), Sadie_Filter_PSpectCmd(), Sadie_Multi_CombineCmd(), Sadie_Multi_Comp2RealCmd(), Sadie_Multi_CompareCmd(), Sadie_Multi_Real2CompCmd(), Sadie_Multi_RotateCubeCmd(), Sadie_NewFunctions_FunctionCmd(), Sadie_NewFunctions_RandomCmd(), Sadie_Tools_ContMapCmd(), and Sadie_Tools_DestripeCmd(). |
|
Recover a PIXEL value from a Tcl array element. A straightforward application of Tcl_ObjGetVar2 finds the PIXEL value through a pair of Tcl objects: an array name (provided as an existing Tcl object) and an index (newly created from the specified C string). If possible, we deposit the value in the specified location, but otherwise set it to zero.
Definition at line 345 of file tclSadie_getset.c. Referenced by Sadie_Classify_ClusterCmd(), Sadie_Classify_LvlSliceCmd(), Sadie_Classify_SegmentCmd(), Sadie_Contrast_NormStretchCmd(), Sadie_Contrast_PWLStretchCmd(), Sadie_Contrast_QntStretchCmd(), Sadie_Contrast_SatStretchCmd(), Sadie_Contrast_TblStretchCmd(), Sadie_Contrast_ThreshStretchCmd(), Sadie_Filter_CAvgFiltCmd(), and Sadie_NewFunctions_GrayScaleCmd(). |
|
Recover a 64-bit unsigned integer value from a Tcl object. Newer versions of Tcl support 64-bit values through the Tcl_WideInt type, but we fall back to using longs if this isn't available, and in ether case set the value to zero on errors.
Definition at line 420 of file tclSadie_getset.c. Referenced by Sadie_FileIO_ImportCmd(), and Sadie_FileIO_OpenCmd(). |
|
Recover a 32-bit unsigned integer value from a Tcl object. We rely on the Tcl object's long value being large enough to encode an unsigned 32-bit value, which we deposit in the specified location if possible, but otherwise set it to zero.
Definition at line 395 of file tclSadie_getset.c. Referenced by Sadie_FileIO_ImportCmd(), Sadie_FileIO_SaveCmd(), Sadie_FileIO_SaveEPSCmd(), Sadie_FileIO_SaveTIFFCmd(), Sadie_General_GetPixelCmd(), and Sadie_Plot_CreateROICmd(). |
|
Recover a 32-bit unsigned integer value from a Tcl array element. A straightforward application of Tcl_ObjGetVar2 finds a 32-bit unsigned integer value through a pair of Tcl objects: an array name (provided as an existing Tcl object) and an index (newly created from the specified C string). If possible, we deposit the value in the specified location, but otherwise set it to zero.
Definition at line 458 of file tclSadie_getset.c. Referenced by Sadie_Contrast_AdaptStretchCmd(), Sadie_Contrast_HisteqStretchCmd(), Sadie_Contrast_NormStretchCmd(), Sadie_Contrast_QntStretchCmd(), Sadie_Contrast_RefStretchCmd(), Sadie_Filter_CAvgFiltCmd(), Sadie_Filter_MajFiltCmd(), Sadie_Filter_MaskConvCmd(), Sadie_Filter_MedFiltCmd(), Sadie_Multi_PCSCmd(), Sadie_Multi_PCTCmd(), Sadie_NewFunctions_CheckerboardCmd(), Sadie_NewFunctions_ChirpCmd(), Sadie_NewFunctions_FunctionCmd(), Sadie_NewFunctions_GrayScaleCmd(), Sadie_NewFunctions_RandomCmd(), Sadie_NewFunctions_SineStarCmd(), Sadie_NewFunctions_SineWaveCmd(), Sadie_Tools_ScatterCmd(), and tclsadie_plotter(). |
|
Create a Tcl object representation from a SADIE image. Note that the object has a zero reference count, and the particular string representation may change in future.
Definition at line 53 of file tclSadie_getset.c. Referenced by SetSadieNamedImageResult(). |
|
Make a Tcl object representing a SADIE image ID, resetting the image name. We create a new Tcl object (with a zero reference count) to represent the ID of a SADIE image, resetting the image name to a string taken from a Tcl array element.
Definition at line 192 of file tclSadie_getset.c. Referenced by Sadie_Multi_BIL2BSQCmd(), and SetSadieComponentObj2(). |
|
Create a pop-up progress meter widget. There should already be a Tcl/Tk command that will create the widget within the current GUI in its initial state (no progress yet). Here we invoke it, passing it a title string for the widget.
Definition at line 89 of file ProgMeter.c. Referenced by tclsadie_app_init(). |
|
Destroy a pop-up progress meter widget. There should already be a Tcl/Tk command that will destroy the widget within the current GUI, given its ID number, so we invoke it, returning any error status.
Definition at line 192 of file ProgMeter.c. Referenced by tclsadie_app_init(). |
|
Modify the progress displayed by an existing progress meter. The progress meter should already exist, and there should be a Tcl command that will update it, given an ID number and an indication of the current percentage progress. This invokes the command, and returns a value showing if the user clicked on a cancel button within the widget since the previous update.
Definition at line 138 of file ProgMeter.c. Referenced by tclsadie_app_init(). |
|
Set the Tcl interpreter result to a list representing a SADIE image pair. We create new Tcl objects representing the IDs of two SADIE images, renaming these to strings taken from two Tcl array elements (specified by a Tcl object giving the array name, and a pair of index strings). The list as a whole has a reference count of zero, but the image ID objects end up with reference counts of one (they have their counts incremented before inserting them in the list, so just after insertion they are briefly two, and must be decremented).
Definition at line 301 of file tclSadie_getset.c. References NewSadieImageObj2(). Referenced by Sadie_Filter_ImageGradCmd(), Sadie_Filter_LibGradCmd(), Sadie_Filter_MaskGradCmd(), and Sadie_Multi_Comp2RealCmd(). |
|
Set the Tcl interpreter result to the ID of a renamed SADIE image. We create a new Tcl object (with a zero reference count) to represent the ID of a SADIE image, resetting the image name to a string taken from a Tcl array element, and return the image ID object through the Tcl interpreter result. Note that the string representation of the image ID may change in future.
Definition at line 246 of file tclSadie_getset.c. Referenced by Sadie_Classify_ClusterCmd(), Sadie_Classify_LvlSliceCmd(), Sadie_Classify_MaxLikeCmd(), Sadie_Classify_MinDistCmd(), Sadie_Classify_SegmentCmd(), Sadie_Classify_SigMapCmd(), 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(), Sadie_Contrast_ThreshStretchCmd(), Sadie_Filter_CAvgFiltCmd(), Sadie_Filter_FFTCmd(), Sadie_Filter_FFTConvCmd(), Sadie_Filter_FFTFiltCmd(), Sadie_Filter_FHTCmd(), Sadie_Filter_ImageConvCmd(), Sadie_Filter_MajFiltCmd(), Sadie_Filter_MaskConvCmd(), Sadie_Filter_MedFiltCmd(), Sadie_Filter_PSpectCmd(), Sadie_Multi_BSQ2BILCmd(), Sadie_Multi_CombineCmd(), Sadie_Multi_CompareCmd(), Sadie_Multi_HSV2RGBCmd(), Sadie_Multi_PCSCmd(), Sadie_Multi_PCTCmd(), Sadie_Multi_Real2CompCmd(), Sadie_Multi_RGB2HSVCmd(), Sadie_Multi_RotateCubeCmd(), Sadie_NewFunctions_CheckerboardCmd(), Sadie_NewFunctions_ChirpCmd(), Sadie_NewFunctions_FunctionCmd(), Sadie_NewFunctions_GrayScaleCmd(), Sadie_NewFunctions_RandomCmd(), Sadie_NewFunctions_SineStarCmd(), Sadie_NewFunctions_SineWaveCmd(), Sadie_Tools_ContMapCmd(), Sadie_Tools_DestripeCmd(), Sadie_Tools_ReliefCmd(), and Sadie_Tools_ScatterCmd(). |
|
Reset a SADIE image name, then return its ID as the Tcl interpreter result. We create a new Tcl object representing the ID of a SADIE image, set the name of this image to a string extracted from another Tcl object, and make the image ID object the current interpreter result.
Definition at line 102 of file tclSadie_getset.c. References NewSadieImageObj(). Referenced by Sadie_FileIO_ImportCmd(), Sadie_FileIO_OpenCmd(), Sadie_FileIO_OpenPNMCmd(), and Sadie_FileIO_OpenTIFFCmd(). |
|
Register all the necessary callbacks with the SADIE library.
Note that this registers all the SADIE callbacks (including the plotter and progress meter callbacks), not just the ones defined in
Definition at line 454 of file tclSadie_app.c. References ProgMeter_Create(), ProgMeter_Destroy(), ProgMeter_Update(), tclsadie_error_messenger(), tclsadie_plotter(), and tclsadie_warning_messenger(). Referenced by Tcl_AppInit(). |
|
Set up the tclSadie-specific private data structure for the SADIE library. The tclSadie callbacks need access to information such as the particular Tk canvas used for the SADIE session log, the name of the top-level window to use for pop-up dialog boxes, and the pre-parsed Tcl/Tk command templates, but cannot obtain it from SADIE, so here we initialize the relevant global data structure for their benefit.
Definition at line 258 of file tclSadie_app.c. References DEFAULT_SESSION_LOG_CANVAS, dispose_private_data(), Tclsadie_app_data::err_popup, Tclsadie_app_data::log_refresh, Tclsadie_app_data::main_interp, Tclsadie_app_data::sadievar, SADIEVAR_ARRAYNAME, Tclsadie_app_data::sessionlog_canvas, and tclsadie_demolish_private_data(). Referenced by Tcl_AppInit(). |