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