[Gdal-dev] GDALDatasetComputeStatistics()

Ivan Lucena ILucena at clarku.edu
Wed Jul 12 07:27:29 EDT 2006


Frank,

That is great!

But don't forget to add it to the Python API. 

I personally don't see the need to call "ComputeStatistics" because I
can do it in my own process loop, but I will love to use "SetStatistics"
(that is not in the C API either).

My suggestion is to pass Min, Max, Mean, and StdDev as address and use
NULL as an indicator of NODATA. So, people like me will send only Min
and Max.

You probably remember this function signature from another open
architecture:

"""
(Dlls_and_IFDs.pdf)
long LayerScalarStatisticsWrite(
	void* layerHandle,
	double* minimum,
	double* maximum,
	double* mean,
	double* median,
	double* mode,
	double* stddev
)
...
	The LayerScalarStatisticsWrite function should write the
relevant statistical information to the layer indicated by layerHandle,
**ignoring any parameters it is unable to save**."""

Thanks,

Ivan


-----Original Message-----
From: gdal-dev-bounces at lists.maptools.org
[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Frank
Warmerdam
Sent: 11 July 2006 17:34
To: gdal-dev
Subject: [Gdal-dev] GDALDatasetComputeStatistics ()

Folks,

A client is running into an issue where they need to be able to cancel
the computation of image statistics on very large files.  I am loath to
change the signature of GDALRasterBand::GetStatistics(), so my
suggestion
was to call that first with bForce=FALSE.  This means it should return
if there aren't any stored statistics available.  Then they should
invoke
a function to compute the statistics that uses a progress function to
allow for cancelling out.

Well, it turns out there is no proper function for this.   So I'm
proposing
to implement:

   virtual CPLErr
   GDALRasterBand::ComputeStatistics( int bApproxOK,
                                      double *pdfMin, double *pdfMax,
                                      double *pdfMean, double
*padfStdDev,
                                      GDALProgressFunc, void
*pProgressData );

This will compute all the statistics that would normally be returned
by GetStatistics(), and then use SetStatistics() to apply it back to the
band (saving it as metadata normally).  This would essentially use the
existing code from GetStatistics() which will be changed to call
ComputeStatistics().  There will also be a corresponding C function.

Does anyone have any concerns or suggestions about this?

Best regards,
-- 
---------------------------------------+--------------------------------
------
I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF,
http://osgeo.org

_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/gdal-dev




More information about the Gdal-dev mailing list