[Qgis-developer] histogram fixes and improvements

Etienne Tourigny etourigny.dev at gmail.com
Sat Jul 14 11:31:19 PDT 2012


i devs,

I would like to announce changes in the histogram which I have just
commited (my first commits as part of the team!)

There are some changes that might cause minor disruption, so I would
like that anyone who has interest please check out latest code and
test it a bit. I have tested on a few datasets, so there may be a few
kinks and bugs to sort out, as well as possible objections.

I have also made some changes to the raster properties UI Style tab to
make things a bit more compact and clean, as well as changes in
QgsRasterLayer and QgsRasterDataProvider, some of which are note
entirely related to the histogram UI and backend.

Here is a summary of changes (mostly based on the different commits)

- add UI to pick min/max band values in histogram
- add histogram zoom in/out
- verify that raster has cached histogram, compute on demand
- prevent double refresh of histogram tab (#4132)
- don't use color interpretation band names when band count > 1
- make multiband color raster widget more compact
- fix histogram and stats compute (set bapprox=false) for gdal
provider ; fix histogram display for non-Byte data
- add various action to load min/maxes, and display certain bands only
(selected band, RGB bands, etc.)

The range of the histogram bins (256) in the gdal provider has changed
from (bandMin-bandMax) to -0.5 - 255.5 for byte data, because there is
not point in having 256 samples in an interval that is smaller than
256 - this creates gaps in the histogram. This also solves
displacement issues of the center of the band curves. Still needs some
tweaking for non-byte data though. See attached images for an
illustration. If have not looked at other providers (grass...) though.

http://dl.dropbox.com/u/15998214/qgis/histo1.jpg
http://dl.dropbox.com/u/15998214/qgis/histo2.jpg

I will next re-factor the code so that histogram computation and UI
are dealt with separatey, in order to write some tests.
Here is Martin's suggestion (from another thread in the qgis-psc
list), perhaps others have good ideas about this?

Or simply have a HistogramGraph class in core lib - that would take
care of bare histogram drawing (to any paint device) - and
HistogramGraphWidget in gui lib that would take care of interactivity
and would make use of HistogramGraph.

cheers,
Etienne


More information about the Qgis-developer mailing list