[gdal-dev] Is there a way to determine if my bands are interleaved?

Even Rouault even.rouault at mines-paris.org
Thu Nov 19 16:48:45 EST 2009

tasmith3 at rockwellcollins.com a écrit :

In fact, you don't need to know if the TIFF file is interleaved or not. 
It is abstracted by GDAL. The interleaving parameters of the RasterIO() 
call determine the interleaving parameters of the result buffer you 
wish. So they can be completely unrelated to the actual interleaving of 
the source file. By default, if you let the spacing parameters to 0, 
GDAL will return a planar buffer.

If you really want to get the interleaving or planar config of a GTiff 
file, you can query the "INTERLEAVE" metadata item of the 
"IMAGE_STRUCTURE" metadata domain. If it's "PIXEL", it's pixel 
interleaved, if it's "BAND" it's planar.

> TIFF is one type of data that I need to read in.  Some of the RGB 
> images are pixel interleaved while others are planar 
> (non-interleaved).  I was intending to use the GDALDataset::RasterIO 
> function to read in my data, as I only need a buffer containing the 
> entire image exactly as it exists on disk.  If I'm going to use 
> GDALDataset::RasterIO, I need to know the offset between bands (it's 
> the last parameter to the function).  That value is going to be 
> different depending on whether or not the bands are interleaved.  If I 
> was using libtiff, I could get the TIFF_TAG that told me how the data 
> was organized, but how can I get that information with GDAL so I know 
> how to fill in that last parameter to GDALDataset::RasterIO correctly?
> Or... is there a better way to do this altogether?  
> Thanks,
> Todd
> ------------------------------------------------------------------------
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

More information about the gdal-dev mailing list