[Gdal-dev] GDALDatasetComputeStatistics()

Frank Warmerdam warmerdam at pobox.com
Tue Jul 11 17:33:53 EDT 2006


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




More information about the Gdal-dev mailing list