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