Giter Club home page Giter Club logo

gdal-pixfun-plugin's Introduction

gdal-pixfun-plugin

IMPORTANT: this package is obsolete. Pixel functions provided by this package have been merged into GDAL.

A gdal plugin that provides a small set of "pixel functions" (see http://www.gdal.org/gdal_vrttut.html) that can be used to create derived raster bands.

The package provides:

  • the implementation of a set of GDALDerivedPixelFunc(s) to be used with source raster band of virtual GDAL datasets
  • a fake GDAL driver to register pixel functions

Note

using the plugin mechanism is a hack aimed to enable python users to use pixel functions without C++ coding

List of pixel functions

"real":extract real part from a single raster band (just a copy if the input is non-complex)
"imag":extract imaginary part from a single raster band (0 for non-complex)
"complex":make a complex band merging two bands used as real and imag values
"mod":extract module from a single raster band (real or complex)
"phase":extract phase from a single raster band (0 for non-complex)
"conj":computes the complex conjugate of a single raster band (just a copy if the input is non-complex)
"sum":sum 2 or more raster bands
"diff":computes the difference between 2 raster bands (b1 - b2)
"mul":multilpy 2 or more raster bands
"cmul":multiply the first band for the complex conjugate of the second
"inv":inverse (1./x). Note: no check is performed on zero division
"intensity":computes the intensity Re(x*conj(x)) of a single raster band (real or complex)
"sqrt":perform the square root of a single raster band (real only)
"log10":compute the logarithm (base 10) of the abs of a single raster band (real or complex): log10( abs( x ) )
"dB2amp":perform scale conversion from logarithmic to linear (amplitude) (i.e. 10 ^ ( x / 20 ) ) of a single raster band (real only)
"dB2pow":perform scale conversion from logarithmic to linear (power) (i.e. 10 ^ ( x / 10 ) ) of a single raster band (real only)

How to get it

The project home page is at https://github.com/avalentino/gdal-pixfun-plugin. A copy of the latest version of the sources can be obtained ising git:

$ git clone https://github.com/avalentino/gdal-pixfun-plugin.git

How to build, test and install

The gdal-pixfun-plugin can be built using the following command:

$ make

in the root folder of the source distribution. It assumes that GDAL is correctly installed on your system.

To run the unit test suite:

$ make check

To install the plugin just copy the generated shared object (gdal_PIXFUN.so) into the GDAL plugin directory (/usr/lib/gdalplugins/1.XX/ on unix).

The plugin can also be used without installing it. The user just needs to set the GDAL_DRIVER_PATH environment variable:

export GDAL_DRIVER_PATH=<PATH_TO_GDAL_PIXFUN_SO>:$GDAL_DRIVER_PATH

License

See the LICENSE.txt file.

gdal-pixfun-plugin's People

Contributors

alexamici avatar avalentino avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

alexamici

gdal-pixfun-plugin's Issues

Please add support for complex data given as real and imag bands

COSMO-SkyMed SLC SAR data are given as two bands with real and imag values, so you cannot use the complex band pixel functions: mod, phase and intensity. A colleague of mine has written two-bands versions of them and I can clean them up for inclusion if you are interested. In case: do you prefer to have different functions, like "mod2" etc, or to overload the current functions to accept two real/int bands treated as real and imaginary parts?

I prefer to add different functions, but I'll comply to your choice.

mod function truncates floating point data types to integer values

The mod pixfun incorrectly truncates floats to integer values in most circumstances, depending on the platform and on something I could not pinpoint, as I get different results on two Ubuntu 14.04 systems. On one machine the mod pixfun works correctly and on the other it returns truncated data.

Furthermore, on Mac OS X I get the following compile-time warning:

$ make
[...]
cc -g -pedantic -fPIC -Wall -Wno-long-long -I/usr/local/Cellar/gdal/1.11.3_1/include    -c -o pixelfunctions.o pixelfunctions.c
pixelfunctions.c:728:35: warning: using integer absolute value function 'abs' when argument is of floating point type
      [-Wabsolute-value]
                dfPixVal = log10( abs( dfPixVal ) );
                                  ^
pixelfunctions.c:728:35: note: use function 'fabs' instead
                dfPixVal = log10( abs( dfPixVal ) );
                                  ^~~
                                  fabs
1 warning generated.
cc -shared -o gdal_PIXFUN.so pixfunplugin.o pixelfunctions.o -L/usr/local/Cellar/gdal/1.11.3_1/lib -lgdal

Looking at the code I see two abs calls (the one in the compile warning and another one inside ModulePixelFunc) that should be fabs calls for floating point data types.

I tried to change them to fabs unconditionally, which may well be wrong, and the test suite passes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.