Bug report #1380

No Data values are counted as values in the histogram

Added by alobo - about 11 years ago. Updated about 7 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Rasters
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:duplicate
Crashes QGIS or corrupts data:No Copied to github as #:11440

Description

After setting a given value as No Data for a raster, the histogram
and min-max statistics are not updated.
Y axis in the histogram is often too high

History

#1 Updated by Giovanni Manghi over 10 years ago

Seems to me still true on qgis 1.2 from trunk under Ubuntu 9.04

#2 Updated by ersts - over 10 years ago

  • Status changed from Open to Closed
  • Resolution set to fixed

fixed in 1c3390e1 (SVN r11190)

#3 Updated by ersts - about 10 years ago

  • Status changed from Closed to Feedback
  • Resolution deleted (fixed)

I have to reopen this. The nodata values were removed from the raster band stats, but they are still showing up in the histogram. It is either something to do with the GDALGetRasterHistogram() or the logic behind which bins to display in QgsRasterLayerProperties::on_pbnHistRefresh_clicked() or a combination of both

#4 Updated by Paolo Cavallini about 10 years ago

Perhaps related to that: if you build pyramids, the histogram will count all the cells from all levels of pyramids as valid values, thus giving inflated and incorrect results

#5 Updated by Paolo Cavallini almost 10 years ago

Confirmed this in Windows XP, not in a fresh Debian box

#6 Updated by alobo - almost 9 years ago

  • Status changed from Feedback to Open

Hi Agus,

As far as I know this is so because your raster does not define a null
value in the GDAL sense (use GDAL tools to set a null value for that
raster, NOT the QGIS raster properties)

Yes (as extremely delayed feedback to Benoit too) I plan to rewrite
the raster histogramming at some point to not use gdal so that we can
take into account user defined transparency settings etc. I will do
this when I get a few hours to spare!

Regards

Tim

Hope this helps,
Benoit

On 01/12/2010 17:14, Agustin Lobo wrote:

Raster histograms include null values, which in many cases severely distorts the
histograms (i.e., images in which a large part of ocean is present or
just images
in which the scene is not a rectangle)
Also, the ability to customize the axes (in particular the x axis) is
very important

#7 Updated by Alister Hood about 8 years ago

  • Pull Request or Patch supplied set to No

Nodata values are also counted when using the "load min/max values from band" feature on the "Style" tab.

This was supposed to be fixed a long time ago: #857-2
I guess I should probably reopen that bug, or file a new one... but it might be the same issue as this with the histogram.

Should this really be "low" priority?

#8 Updated by alobo - about 8 years ago

  • Priority changed from Low to High

#9 Updated by Giovanni Manghi almost 8 years ago

  • Target version changed from Version 1.7.0 to Version 1.7.4

#10 Updated by Giovanni Manghi almost 8 years ago

  • OS version deleted (ubuntu 8.04, ubuntu 9.04)
  • Crashes QGIS or corrupts data set to No
  • Assignee deleted (Tim Sutton)
  • Operating System deleted (Linux)
  • Affected QGIS version set to master

Probably this is related/duplicate/consequence of #3840

Actually the "no data value" does not make anything NULL, it just turn the pixels transparent, but they retain they original value.

#11 Updated by Paolo Cavallini almost 8 years ago

  • Priority changed from High to Normal

#12 Updated by alobo - over 7 years ago

  • Priority changed from Normal to 6

#13 Updated by Giovanni Manghi over 7 years ago

  • Priority changed from 6 to High

#14 Updated by Paolo Cavallini over 7 years ago

  • Target version changed from Version 1.7.4 to Version 1.8.0

#15 Updated by Paolo Cavallini about 7 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

#16 Updated by Giovanni Manghi about 7 years ago

  • Status changed from Open to Closed
  • Status info deleted (0)
  • Resolution set to duplicate

Duplicate of #3840

Also available in: Atom PDF