Blame contrib/pds/README

Packit Service 2594b8
Date:    Fri, 01 Aug 1997 20:14:52 MDT
Packit Service 2594b8
To:      Sam Leffler <sam@cthulhu.engr.sgi.com>
Packit Service 2594b8
Packit Service 2594b8
From:    "Conrad J. Poelman (WSAT)" <poelmanc@plk.af.mil>
Packit Service 2594b8
Subject: Potential TIFF library additions
Packit Service 2594b8
Packit Service 2594b8
Delivery-Date: Fri, 01 Aug 1997 19:21:06 -0700
Packit Service 2594b8
Packit Service 2594b8
Sam,
Packit Service 2594b8
Packit Service 2594b8
You probably don't remember me, but I sent in a couple of bug fixes
Packit Service 2594b8
regarding the TIFF library about a 16 months ago or so...
Packit Service 2594b8
Packit Service 2594b8
I just wanted to send you two other additions that I have made to our
Packit Service 2594b8
local version of the TIFF library in hopes that you will want to
Packit Service 2594b8
incorporate them into your next major release of the TIFF library.
Packit Service 2594b8
(These additions are based on TIFF version 3.4beta31, but they sit on
Packit Service 2594b8
top of the library so they shouldn't be much trouble to incorporate them
Packit Service 2594b8
into any more recent version.) They are internally documented to a
Packit Service 2594b8
reasonable extent and we've been successfully using them in our code
Packit Service 2594b8
here for over a year. If you think they would make good additions to the
Packit Service 2594b8
TIFF library, I'd be happy to clean them up more, document them more,
Packit Service 2594b8
and/or integrate them with the latest version of the TIFF library, but I
Packit Service 2594b8
figured I'd see if you were interested in using them before I went to
Packit Service 2594b8
all that trouble.
Packit Service 2594b8
Packit Service 2594b8
TIFF Image Iterator
Packit Service 2594b8
-------------------
Packit Service 2594b8
Your ReadRGBA() routine works well for reading many different formats
Packit Service 2594b8
(TILED, STIP, compressed or not, etc.) of the most basic types of data
Packit Service 2594b8
(RGB, 8-bit greyscale, 8-bit colormapped) into an SGI-style data array,
Packit Service 2594b8
and serves as a good template for users with other needs. I used it as
Packit Service 2594b8
an exmaple of how to make an iterator which, rather than fill a data
Packit Service 2594b8
array, calls an arbitrary user-supplied callback function for each
Packit Service 2594b8
"chunk" of data - that "chunk" might be a strip or a tile, and might
Packit Service 2594b8
have one sample-per-pixel or two, and might be 8-bit data or 16-bit or
Packit Service 2594b8
24-bit. The callback function can do whatever it wants with the data -
Packit Service 2594b8
store it in a big array, convert it to RGBA, or draw it directly to the
Packit Service 2594b8
screen. I was able to use this iterator to read 16-bit greyscale and 32-
Packit Service 2594b8
and 64-bit floating point data, which wasn't possible with ReadRGBA().
Packit Service 2594b8
Packit Service 2594b8
I have tested this routine with 8- and 16-bit greyscale data as well as
Packit Service 2594b8
with 32- and 64-bit floating point data. I believe nearly all of our
Packit Service 2594b8
data is organized in strips, so actually I'd appreciate it if you had
Packit Service 2594b8
some tiled images that I could test it with.
Packit Service 2594b8
Packit Service 2594b8
It should certainly be possible and would be cleanest to reimplement
Packit Service 2594b8
ReadRGBA() in terms of the image iterator, but I haven't done that.
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Private Sub-Directory Read/Write
Packit Service 2594b8
--------------------------------
Packit Service 2594b8
TIFF-PL is a Phillips Laboratory extension to the TIFF tags that allows
Packit Service 2594b8
us to store satellite imaging-specific information in a TIFF format,
Packit Service 2594b8
such as the satellite's trajectory, the imaging time, etc. In order to
Packit Service 2594b8
give us the flexibility to modify the tag definitions without getting
Packit Service 2594b8
approval from the TIFF committee every time, we were given only three
Packit Service 2594b8
TIFF tags - a PL signature, a PL version number, and PL directory
Packit Service 2594b8
offset, which lists the position in the file at which to find a private
Packit Service 2594b8
sub-directory of tags-value pairs. So I wrote two routines:
Packit Service 2594b8
TIFFWritePrivateDataSubDirectory(), which takes a list of tags and a
Packit Service 2594b8
"get" function and writes the tag values into the TIFF file, returning
Packit Service 2594b8
the offset within the file at which it wrote the directory; and
Packit Service 2594b8
TIFFReadPrivateDataSubDirectory(), which takes an offset, a list of
Packit Service 2594b8
tags, and a "set" function and reads all the data from the private
Packit Service 2594b8
directory. The functions themselves are pretty simple. (The files are
Packit Service 2594b8
huge because I had to basically copy all of the tif_dirread.c and
Packit Service 2594b8
tif_dirwrite.c files in order to access the various fetching routines
Packit Service 2594b8
which were all declared static and therefore inaccessible in the TIFF
Packit Service 2594b8
library.)
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
I'm including the four source files (tif_imgiter.h, tif_imgiter.c,
Packit Service 2594b8
tif_pdsdirread.c, tif_pdsdirwrite.c) in case you want to take a look at
Packit Service 2594b8
them. I can also send you some sample code that uses them if you like.
Packit Service 2594b8
If you're interested in having them incorporated into the standard TIFF
Packit Service 2594b8
library, I'd be happy to do that integration and clean up and document
Packit Service 2594b8
the routines. (For example, I've already realized that instead of
Packit Service 2594b8
limiting the SEP callback function to three bands (R,G,B) it should take
Packit Service 2594b8
an array to enable the handling of n-banded multi-spectral data...) If
Packit Service 2594b8
not, I'll just leave them as they are, since they work fine for us now.
Packit Service 2594b8
Packit Service 2594b8
Holler if you have any questions.
Packit Service 2594b8
Packit Service 2594b8
-- Conrad
Packit Service 2594b8
__________________________________________________________________
Packit Service 2594b8
  Capt Conrad J. Poelman         PL/WSAT   (Phillips Laboratory)
Packit Service 2594b8
    505-846-4347                   3550 Aberdeen Ave SE 
Packit Service 2594b8
      (FAX) 505-846-4374             Kirtland AFB, NM 87117-5776
Packit Service 2594b8