function voronoi

Perform adaptive spatial binning of Integral-Field Spectroscopic (IFS) data to reach a chosen constant signal-to-noise ratio per bin. This method is required for the proper analysis of IFS observations, but can also be used for standard photometric imagery or any other two-dimensional data. Further information on VORONOI_2D_BINNING algorithm can be found in Cappellari M., Copin Y., 2003, MNRAS, 342, 345

Syntax
result = voronoi(signal, noise, target, targetSN [, /map])

Arguments
signal:   A 2D map with the signal in each pixel
noise:   A 2D map specifying the noise in each pixel. Pixels with a noise value of zero will be neglected in the voronoi binning
target:   The image which should be binned (can be the same as the signal map)
targetSN:   The Signal/Noise value which should be reached


Switches
/map:   Instead of applying the binning to an image, return a map with regions and their respective IDs


Returns
Either the binned image or the map of regions

Notes
The original IDL code was written by Michele Cappellari, Leiden Observatory, The Netherlands cappellari@strw.leidenuniv.nl. If you have found this software useful for your research, he would appreciate an acknowledgment to use of `the Voronoi 2D-binning method by Cappellari & Copin (2003)'.