[gdal-dev] module of a complex dataset

Antonio Valentino antonio.valentino at tiscali.it
Wed Sep 3 12:39:23 EDT 2008


Il giorno Tue, 02 Sep 2008 10:49:02 -0400
Frank Warmerdam <warmerdam at pobox.com> ha scritto:

[...]

> > I think that it would be nice to have a base set of *PixelFunctions*
> > (mod, phase, real, imag, sum, diff, etc.) bundled with the GDAL
> > library in order to allow the user to cook its own virtual datasets
> > and then use standard GDAL tools for further processing.
> 
> This is a plausible idea, but it is not entirely obvious what would
> be sufficiently useful to justify inclusion.  A carefully crafted
> patch, including updates to docs, in this direction would likely be
> well received.

Ok,
I'm trying to implement the new feature but I'm having some problem.
I produced a modified gdal_translate program and a couple of test
files (test.tiff and test.vrt):

$ gdalinfo test.tiff
Using HDF5+
Using HDF5Image+
Driver: GTiff/GeoTIFF
Files: test.tiff
Size is 100, 100
Coordinate System is `'
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  100.0)
Upper Right (  100.0,    0.0)
Lower Right (  100.0,  100.0)
Center      (   50.0,   50.0)
Band 1 Block=100x20 Type=CInt16, ColorInterp=Gray

$ cat test.vrt 
<VRTDataset rasterXSize="100" rasterYSize="100">
  <VRTRasterBand dataType="Float32" band="1"
subClass="VRTDerivedRasterBand"> <Description>Magnitude</Description>
    <PixelFunctionType>module</PixelFunctionType>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">test.tiff</SourceFilename>
      <SourceBand>1</SourceBand>
      <SrcRect xOff="0" yOff="0" xSize="100" ySize="100"/>
      <DstRect xOff="0" yOff="0" xSize="100" ySize="100"/>
    </SimpleSource>
  </VRTRasterBand>
</VRTDataset>

Frank, please confirm that "module" is associated to

CPLErr ModulePixelFunc(void **papoSources, int nSources, void *pData,
                       int nXSize, int nYSize,
                       GDALDataType eSrcType, GDALDataType eBufType,
                       int nPixelSpace, int nLineSpace)

I should get eSrcType==GDT_CInt16 if I launch

$ ./gdal_translate test.vrt mag.tiff
Input file size is 100, 100
0

At the moment the program exits at the first call to "ModulePixelFunc"
because eSrcType==GDT_Float32 the second check fails

    /* ---- Init ---- */
    if (nSources != 1) return CE_Failure;
    if (!GDALDataTypeIsComplex( eSrcType )) return CE_Failure;


Thanks

-- 
Antonio Valentino


More information about the gdal-dev mailing list