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