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

Sadie_FileIO.c File Reference

A Tcl/Tk interface to the SADIE file input/output operations. More...

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

Go to the source code of this file.

Functions

int Sadie_FileIO_OpenCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Read a SADIE-formatted file into a newly allocated image.
int Sadie_FileIO_OpenTIFFCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 An interface to the TIFF2IMG function in the SADIE library (disabled).
int Sadie_FileIO_OpenPNMCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 An interface to the PNM2IMG function in the SADIE library (disabled).
int Sadie_FileIO_ImportCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Import data from an arbitrarily defined image file into a SADIE image.
int Sadie_FileIO_SaveCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Write a SADIE (version 1) formatted image file.
int Sadie_FileIO_SaveEPSCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Write an Encapsulated PostScript formatted image file.
int Sadie_FileIO_SaveTIFFCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Write a TIFF formatted image file.
int Sadie_FileIO_SavePNMCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 An interface to the IMG2PNM function in the SADIE library (disabled).
int Sadie_FileIO_SaveTEXTCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Dump pixel values to a text file.
int Sadie_FileIO_Init (Tcl_Interp *interp)
 Make the commands defined in this file accessible to the Tcl interpreter.


Detailed Description

A Tcl/Tk interface to the SADIE file input/output operations.

Please note that tclSadie also uses an add-on package for Tk called Img. Some of the operations that are disabled here may nevertheless work in tclSadie if it uses Img instead; for more information see http://sourceforge.net/projects/tkimg/ for downloads and the latest versions, but these days it should really be a standard additional option in whatever Tcl/Tk distribution you are using.

Author:
University of Arizona Digital Image Analysis Lab
Date:
1999, 2004
Version:
Id
Sadie_FileIO.c,v 2.10 2005/03/22 20:53:41 mmunro Exp

Definition in file Sadie_FileIO.c.


Function Documentation

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

Import data from an arbitrarily defined image file into a SADIE image.

This is a generic image file reader that should handle most formats using uncompressed regular arrays of pixels. The SADIE library function IMPORT allocates a new image to hold the imported data as well as reading from the file. We set the Tcl interpreter result to an ID string representing the new image. The lengthy array of Tcl object arguments have the following meanings:

  • objv[0] the command name.
  • objv[1] filesystem path to the file (as a string, not a list).
  • objv[2] the number of initial bytes (header bytes) to skip.
  • objv[3] the number of bands in the image.
  • objv[4] the number of lines in each image band.
  • objv[5] the number of pixels in each image line.
  • objv[6] the number of bits per pixel.
  • objv[7] format code: one of BIL, BSQ, or BIP from sadie.h.
  • objv[8] if subsampling is required (a Boolean code).
  • objv[9] first band in the subsample (counting from 1).
  • objv[10] last band in the subsample (counting from 1).
  • objv[11] increment between sampled bands (1 if contiguous).
  • objv[12] the first line in the subsample (counting from 1).
  • objv[13] the last line in the subsample (counting from 1).
  • objv[14] increment between sampled lines (1 if contiguous).
  • objv[15] the first pixel in the subsample (counting from 1).
  • objv[16] the last pixel in the subsample (counting from 1).
  • objv[17] increment between sampled pixels (1 if contiguous).
  • objv[18] the file size.

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

Definition at line 152 of file Sadie_FileIO.c.

References GetSadieUint64FromObj(), GetSadieUintFromObj(), and SetSadieNamedImageResult().

Referenced by Sadie_FileIO_Init().

int Sadie_FileIO_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, TCL_ERROR on errors.

Definition at line 397 of file Sadie_FileIO.c.

References Sadie_FileIO_ImportCmd(), Sadie_FileIO_OpenCmd(), Sadie_FileIO_OpenPNMCmd(), Sadie_FileIO_OpenTIFFCmd(), Sadie_FileIO_SaveCmd(), Sadie_FileIO_SaveEPSCmd(), Sadie_FileIO_SavePNMCmd(), Sadie_FileIO_SaveTEXTCmd(), and Sadie_FileIO_SaveTIFFCmd().

Referenced by Tcl_AppInit().

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

Read a SADIE-formatted file into a newly allocated image.

The SADIE library function DISK2IMG should read files in either the SADIE version 0 or version 1 format, and will allocate space for the image. We set the Tcl interpreter result to an ID string representing the new image. The Tcl object array always contains the following elements:

  • objv[0] the command name.
  • objv[1] filesystem path to the file (as a string, not a list).
  • objv[2] the file size.
  • objv[3] a title for the newly read image.

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

Definition at line 61 of file Sadie_FileIO.c.

References GetSadieUint64FromObj(), and SetSadieNamedImageResult().

Referenced by Sadie_FileIO_Init().

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

An interface to the PNM2IMG function in the SADIE library (disabled).

This should read PNM files into SADIE images, but is currently disabled.

Definition at line 103 of file Sadie_FileIO.c.

References SetSadieNamedImageResult().

Referenced by Sadie_FileIO_Init().

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

An interface to the TIFF2IMG function in the SADIE library (disabled).

This should read TIFF files into SADIE images, but is currently disabled.

Definition at line 84 of file Sadie_FileIO.c.

References SetSadieNamedImageResult().

Referenced by Sadie_FileIO_Init().

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

Write a SADIE (version 1) formatted image file.

Given a image ID string and the specified number of bits per pixel, we use the SADIE library function IMG2DISK to write a SADIE v. 1 formatted image to the specified file (version 1 is the post-2003 SADIE file format; the original format is version 0, and isn't handled here). The Tcl object arguments are in an array with the following layout:

  • objv[0] the command name.
  • objv[1] the image ID string.
  • objv[2] filesystem path to the file (as a string, not a list).
  • objv[3] the desired number of bits per pixel.

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

Definition at line 244 of file Sadie_FileIO.c.

References GetSadieImageFromObj(), and GetSadieUintFromObj().

Referenced by Sadie_FileIO_Init().

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

Write an Encapsulated PostScript formatted image file.

Given a image ID string and the specified number of bits per pixel, we use the SADIE library function IMG2EPSF to write an EPS formatted image to the specified file. The Tcl object arguments are in an array with the following layout:

  • objv[0] the command name.
  • objv[1] the image ID string.
  • objv[2] filesystem path to the file (as a string, not a list).
  • objv[3] the desired number of bits per pixel.

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

Definition at line 281 of file Sadie_FileIO.c.

References GetSadieImageFromObj(), and GetSadieUintFromObj().

Referenced by Sadie_FileIO_Init().

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

An interface to the IMG2PNM function in the SADIE library (disabled).

This should write PNM files from SADIE images, but is currently disabled.

Definition at line 341 of file Sadie_FileIO.c.

References GetSadieImageFromObj().

Referenced by Sadie_FileIO_Init().

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

Dump pixel values to a text file.

Given a image ID string, we use the SADIE library function IMG2TEXT to dump the formatted numeric values of the image pixels to the specified file. The Tcl objects passed through the array argument have the following meanings:

  • objv[0] the command name.
  • objv[1] the image ID string.
  • objv[2] filesystem path to the file (as a string, not a list).

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

Definition at line 374 of file Sadie_FileIO.c.

References GetSadieImageFromObj().

Referenced by Sadie_FileIO_Init().

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

Write a TIFF formatted image file.

Given a image ID string and the specified number of bits per pixel, we use the SADIE library function IMG2TIFF to write a TIFF formatted image to the specified file. This is probably better handled by the Img add-on package for Tk. The Tcl object argument array is arranged as follows:

  • objv[0] the command name.
  • objv[1] the image ID string.
  • objv[2] filesystem path to the file (as a string, not a list).
  • objv[3] the desired number of bits per pixel.

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

Definition at line 318 of file Sadie_FileIO.c.

References GetSadieImageFromObj(), and GetSadieUintFromObj().

Referenced by Sadie_FileIO_Init().


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