Return-Path: <tiff-admin@remotesensing.org>
Received: from inmx009.isp.belgacom.be (inmx009.isp.belgacom.be [195.238.3.146])
        by mailst006.isp.belgacom.be (8.12.9/8.12.9/Skynet-MAILSTORE-2.14) with ESMTP id i4PKHbCx019019
        for <joris.at.lebbeke@skynet.be>; Tue, 25 May 2004 22:17:44 +0200
        (envelope-from <tiff-admin@remotesensing.org>)
Received: from yoda.imagelinks.com ([208.24.120.44])
        by inmx009.isp.belgacom.be (8.12.9/8.12.9/Skynet-IN-2.32) with ESMTP id i4PKFOpN001713
        for <joris.at.lebbeke@skynet.be>; Tue, 25 May 2004 22:15:25 +0200
        (envelope-from <tiff-admin@remotesensing.org>)
Received: from yoda.imagelinks.com (localhost.localdomain [127.0.0.1])
	by yoda.imagelinks.com (8.11.6/8.11.6) with ESMTP id i4PKE5x15688;
	Tue, 25 May 2004 16:14:05 -0400
Received: from sabre.velocet.net (postfix@sabre.velocet.net [216.138.209.205])
	by yoda.imagelinks.com (8.11.6/8.11.6) with ESMTP id i4PKDLx15648
	for <tiff@remotesensing.org>; Tue, 25 May 2004 16:13:22 -0400
Received: from pobox.com (H156.C195.tor.velocet.net [216.138.195.156])
	by sabre.velocet.net (Postfix) with ESMTP
	id 93ADE139323; Tue, 25 May 2004 16:13:20 -0400 (EDT)
Message-ID: <40B3A8E3.5000600@pobox.com>
From: Frank Warmerdam <warmerdam@pobox.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Penn Shan <pennshan@yahoo.com>
Cc: tiff@remotesensing.org
Subject: Re: [Tiff] read and write stacks of image
References: <20040524223943.35696.qmail@web50109.mail.yahoo.com>
In-Reply-To: <20040524223943.35696.qmail@web50109.mail.yahoo.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Sender: tiff-admin@remotesensing.org
Errors-To: tiff-admin@remotesensing.org
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.0.13
Precedence: bulk
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Post: <mailto:tiff@remotesensing.org>
List-Subscribe: <http://remotesensing.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
List-Id: TIFF and libtiff discussion <tiff.remotesensing.org>
List-Unsubscribe: <http://remotesensing.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://remotesensing.org/pipermail/tiff/>
Date: Tue, 25 May 2004 16:13:23 -0400
X-UIDL: 47d770f65a9d11b7ec3a04bcd9d247b8

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

_______________________________________________
Tiff mailing list
Tiff@remotesensing.org
http://remotesensing.org/mailman/listinfo/tiff
