2010.03.05 03:36 "[Tiff] Problem with multipage .stk tiff file", by Shafiq Abedin

2010.03.08 16:29 "Re: [Tiff] Problem with multipage .stk tiff file", by Steve Eddins

I don't think Ashish was trying to tell you to use MATLAB. He was giving you links to sources of information about the STK format.

Steve

From: tiff-bounces@lists.maptools.org [mailto:tiff-bounces@lists.maptools.org] On Behalf Of Shafiq Abedin

Sent: Friday, March 05, 2010 8:58 AM
To: Ashish Uthama
Cc: tiff@lists.maptools.org

Great source! I apologize if I sound arrogant but I am trying to accomplish this with libtiff and c. We already process our data with Matlab. Thank you though :)

Shafiq Abedin

sha33@pitt.edu<mailto:sha33@pitt.edu>

On Mar 5, 2010, at 7:46 AM, Ashish Uthama wrote:

Information in this thread might be useful:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/265330

points to: http://support.meta.moleculardevices.com/docs/t10243.pdf and ftp://ftp.meta.moleculardevices.com/support/stack/STK.doc

From: tiff-bounces@lists.maptools.org<mailto:tiff-bounces@lists.maptools.org> [mailto:tiff-bounces@lists.maptools.org] On Behalf Of Shafiq Abedin

To: tiff@lists.maptools.org<mailto:tiff@lists.maptools.org>

Hello All:

I am writing this post after pulling my hair multiple times (I am bald now!) and doing many many google searches (all the webpages related to libtiff is now imprinted in my brain). I have failed to find a post on this mailing list that solves the problem or anywhere for that matter. I hate to be repetitive but I have the same problem described in this post (http://www.asmail.be/msg0054982856.html). Solution given here is too vague for me to pick up on (is it really like a linked list?). I didn't find any post related to reading the .stk file (I wish I could give you a sample right now but they are extremely big - 2gb ). I can read the first in the stack but cant go beyond that. This particular image has 7400 slices but whenever i do a tiffdump, this is what I get:

test.stk:

Magic: 0x4949 <little-endian> Version: 0x2a
Directory 0: offset 1342567917 (0x5005f5ed) next 0 (0)
SubFileType (254) LONG (4) 1<0>
ImageWidth (256) LONG (4) 1<348>
ImageLength (257) LONG (4) 1<260>
BitsPerSample (258) SHORT (3) 1<16>
Compression (259) SHORT (3) 1<1>
Photometric (262) SHORT (3) 1<1>
ImageDescription (270) ASCII (2) 2545600<Acquired from Photometri ...>
StripOffsets (273) LONG (4) 24<8 7664 15320 22976 30632 38288 45944 53600 61256 68912 76568 84224 91880 99536 107192 114848 122504 130160 137816 145472 153128 160784 168440 176096>
SamplesPerPixel (277) SHORT (3) 1<1>
RowsPerStrip (278) LONG (4) 1<11>
StripByteCounts (279) LONG (4) 24<7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 7656 4872>
XResolution (282) RATIONAL (5) 1<72>
YResolution (283) RATIONAL (5) 1<72>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>

Software (305) ASCII (2) 18<MetaMorph 7.1.7.0\0>

DateTime (306) ASCII (2) 21<2009:09:08 17:54:57\0\0>
Predictor (317) SHORT (3) 1<1>
33628 (0x835c) LONG (4) 7435<0 0 1 0 2 4095 3 0 4 1341649855 5 1341649863 6 1341649871 7 1341649880 8 0 9 255 11 128 12 64 ...>

33629 (0x835d) RATIONAL (5) 7400<0 0.0383822 0.0380645 0 0.0383822 0.0380645 0 0.0383821 0.0380645 0 0.0383821 0.0380645 0 0.038382 0.0380645 0 0.038382 0.0380645 0 0.038382 0.0380645 0 0.0383819 0.0380645 ...>

33630 (0x835e) RATIONAL (5) 7400<0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...>
33631 (0x835f) LONG (4) 7400<28 65536 0 65536 0 65536 0 65536 0 65536 0 65536 0 65536 0 65536 0 65536 0 65536 0 65536 0 65536 ...>

My attempt to get the the read Strip or Tile have failed because the libtiff TIFFTAG_TILEBYTECOUNTS and TIFFTAG_STRIPBYTECOUNTS returns only 24. Although I can see the offset info in the dump, I dont know actually how to get to the next image and read (using TIFFReadScanline) it so that I can manipulate it. I should also menti