Il giorno Tue, 02 Sep 2008 10:49:02 -0400 Frank Warmerdam <[EMAIL PROTECTED]> ha scritto:
> Antonio Valentino wrote: > > I hoped there was a way to use derived bands described in > > http://www.gdal.org/gdal_vrttut.html > > > > <VRTRasterBand dataType="Float32" band="1" > > subClass="VRTDerivedRasterBand">> > > <Description>Magnitude</Description> > > <PixelFunctionType>MyFirstFunction</PixelFunctionType> > > <SourceTransferType>"CFloat64"</SourceTransferType> > > > > ... but is seems that this approach requires C++ coding > > Antonio, > > Ah, I hadn't thought about that approach, but indeed it still > requires C++ coding. > > >> or the commandline utilities. But I have added a small sample > >> script doing this with numpy and python if you would be interested > >> in working from that. > >> > >> > >> http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/python/samples/magphase.py > > > > thank you Frank. > > Right now I'm using a similar python script: > > Ah, well you are considerably ahead of me in sophistication > here already. > > > 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. Hi Frank, please find attached the patch against svn r15340 and a small test program (using gdal_translate). The patch provides 6 pixel functions: - "module": extract module from complex datasets - "phase": extract phase from complex datasets - "real": extract real part from complex datasets (OK this is redundant) - "imag": extract imaginary part from complex datasets - "sum": sum 2 or more datasets - "diff": computes the difference between 2 datasets (dataset1-dataset2) and a function for registering them all: GDALRegisterDefaultPixelFunc(); to be used at the beginning of GDAL utilities code just like GDALAllRegister: --- apps/gdal_translate.cpp (revisione 15340) +++ apps/gdal_translate.cpp (copia locale) @@ -133,6 +133,7 @@ /* command options. */ /* -------------------------------------------------------------------- */ GDALAllRegister(); + GDALRegisterDefaultPixelFunc(); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 1 ) exit( -argc ); Note that I didn't updated bindings related code. Virtual files in the test directory could be used as examples in the vrt tutorial if you like. Best regards -- Antonio Valentino
pixfun-patch-20080908.tar.gz
Description: GNU Zip compressed data
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev