AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
May 2004

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2004.05.24 22:39 "read and write stacks of image", by Penn Shan
2004.05.25 20:13 "Re: read and write stacks of image", by Frank Warmerdam

2004.05.25 20:13 "Re: read and write stacks of image", by Frank Warmerdam

Penn Shan wrote:
> Hello,
>  
> I met a problem in reading and writing stacks of image in TIFF, for 
> example 512x512x10. Using my own function, I was able to write the whole 
> data into a long 1-D array with dimension of [512x512x10, 1]. Now I 
> would like to output this array to a file as stacks of images, i.e., 
> 512x512x10.
>  
> Can someone show me how to use libtiff's function to do this?

Penn,

Are you ok with emitting the file with PLANARCONFIG_CONTIG?  This implies
all sample values for the first pixel appear, followed by all the sample values
for the second pixel and so on.

Just make sure you set the TIFFTAG_PLANARCONFIG to PLANARCONFIG_CONTIG and then
when you call TIFFWriteStrip(), TIFFWriteTile(), or TIFFWriteScanline() that
you write all samples of the data for the region in question interleaved
as explained above.  Honestly, if you look at example code that writes out
RGB or RGBA data you should see what to do - just extent it to 10 samples.

There is a link to an IBM DeveloperWorks tutorial on libtiff on the libtiff
web site that might be helpful.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent