GDAL

gdal_alg.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: gdal_alg.h 15399 2008-09-21 22:40:54Z warmerdam $
00003  *
00004  * Project:  GDAL Image Processing Algorithms
00005  * Purpose:  Prototypes, and definitions for various GDAL based algorithms.
00006  * Author:   Frank Warmerdam, warmerdam@pobox.com
00007  *
00008  ******************************************************************************
00009  * Copyright (c) 2001, Frank Warmerdam
00010  *
00011  * Permission is hereby granted, free of charge, to any person obtaining a
00012  * copy of this software and associated documentation files (the "Software"),
00013  * to deal in the Software without restriction, including without limitation
00014  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00015  * and/or sell copies of the Software, and to permit persons to whom the
00016  * Software is furnished to do so, subject to the following conditions:
00017  *
00018  * The above copyright notice and this permission notice shall be included
00019  * in all copies or substantial portions of the Software.
00020  *
00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00022  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00024  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00026  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00027  * DEALINGS IN THE SOFTWARE.
00028  ****************************************************************************/
00029 
00030 #ifndef GDAL_ALG_H_INCLUDED
00031 #define GDAL_ALG_H_INCLUDED
00032 
00039 #include "gdal.h"
00040 #include "cpl_minixml.h"
00041 #include "ogr_api.h"
00042 
00043 CPL_C_START
00044 
00045 int CPL_DLL CPL_STDCALL GDALComputeMedianCutPCT( GDALRasterBandH hRed, 
00046                              GDALRasterBandH hGreen, 
00047                              GDALRasterBandH hBlue, 
00048                              int (*pfnIncludePixel)(int,int,void*),
00049                              int nColors, 
00050                              GDALColorTableH hColorTable,
00051                              GDALProgressFunc pfnProgress, 
00052                              void * pProgressArg );
00053 
00054 int CPL_DLL CPL_STDCALL GDALDitherRGB2PCT( GDALRasterBandH hRed, 
00055                        GDALRasterBandH hGreen, 
00056                        GDALRasterBandH hBlue, 
00057                        GDALRasterBandH hTarget, 
00058                        GDALColorTableH hColorTable, 
00059                        GDALProgressFunc pfnProgress, 
00060                        void * pProgressArg );
00061 
00062 int CPL_DLL CPL_STDCALL GDALChecksumImage( GDALRasterBandH hBand, 
00063                                int nXOff, int nYOff, int nXSize, int nYSize );
00064                                
00065 CPLErr CPL_DLL CPL_STDCALL 
00066 GDALComputeProximity( GDALRasterBandH hSrcBand, 
00067                       GDALRasterBandH hProximityBand,
00068                       char **papszOptions,
00069                       GDALProgressFunc pfnProgress, 
00070                       void * pProgressArg );
00071 
00072 CPLErr CPL_DLL CPL_STDCALL
00073 GDALFillNodata( GDALRasterBandH hTargetBand, 
00074                 GDALRasterBandH hMaskBand,
00075                 double dfMaxSearchDist, 
00076                 int bConicSearch, 
00077                 int nSmoothingIterations,
00078                 char **papszOptions,
00079                 GDALProgressFunc pfnProgress, 
00080                 void * pProgressArg );
00081 
00082 CPLErr CPL_DLL CPL_STDCALL
00083 GDALPolygonize( GDALRasterBandH hSrcBand, 
00084                 GDALRasterBandH hMaskBand,
00085                 OGRLayerH hOutLayer, int iPixValField, 
00086                 char **papszOptions,
00087                 GDALProgressFunc pfnProgress, 
00088                 void * pProgressArg );
00089 
00090 CPLErr CPL_DLL CPL_STDCALL
00091 GDALSieveFilter( GDALRasterBandH hSrcBand, GDALRasterBandH hMaskBand,
00092                  GDALRasterBandH hDstBand,
00093                  int nSizeThreshold, int nConnectedness,
00094                  char **papszOptions,
00095                  GDALProgressFunc pfnProgress, 
00096                  void * pProgressArg );
00097 
00098 /*
00099  * Warp Related.
00100  */
00101 
00102 typedef int 
00103 (*GDALTransformerFunc)( void *pTransformerArg, 
00104                         int bDstToSrc, int nPointCount, 
00105                         double *x, double *y, double *z, int *panSuccess );
00106 
00107 typedef struct {
00108     char szSignature[4];
00109     const char *pszClassName;
00110     GDALTransformerFunc pfnTransform;
00111     void (*pfnCleanup)( void * );
00112     CPLXMLNode *(*pfnSerialize)( void * );
00113 } GDALTransformerInfo;
00114 
00115 void CPL_DLL GDALDestroyTransformer( void *pTransformerArg );
00116 int  CPL_DLL GDALUseTransformer( void *pTranformerArg, 
00117                                  int bDstToSrc, int nPointCount, 
00118                                  double *x, double *y, double *z, 
00119                                  int *panSuccess );
00120 
00121 /* High level transformer for going from image coordinates on one file
00122    to image coordiantes on another, potentially doing reprojection, 
00123    utilizing GCPs or using the geotransform. */
00124 
00125 void CPL_DLL *
00126 GDALCreateGenImgProjTransformer( GDALDatasetH hSrcDS, const char *pszSrcWKT,
00127                                  GDALDatasetH hDstDS, const char *pszDstWKT,
00128                                  int bGCPUseOK, double dfGCPErrorThreshold,
00129                                  int nOrder );
00130 void CPL_DLL *
00131 GDALCreateGenImgProjTransformer2( GDALDatasetH hSrcDS, GDALDatasetH hDstDS, 
00132                                   char **papszOptions );
00133 void CPL_DLL GDALSetGenImgProjTransformerDstGeoTransform( void *, 
00134                                                           const double * );
00135 void CPL_DLL GDALDestroyGenImgProjTransformer( void * );
00136 int CPL_DLL GDALGenImgProjTransform( 
00137     void *pTransformArg, int bDstToSrc, int nPointCount,
00138     double *x, double *y, double *z, int *panSuccess );
00139 
00140 /* Geo to geo reprojection transformer. */
00141 void CPL_DLL *
00142 GDALCreateReprojectionTransformer( const char *pszSrcWKT, 
00143                                    const char *pszDstWKT );
00144 void CPL_DLL GDALDestroyReprojectionTransformer( void * );
00145 int CPL_DLL GDALReprojectionTransform( 
00146     void *pTransformArg, int bDstToSrc, int nPointCount,
00147     double *x, double *y, double *z, int *panSuccess );
00148 
00149 /* GCP based transformer ... forward is to georef coordinates */
00150 void CPL_DLL *
00151 GDALCreateGCPTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 
00152                           int nReqOrder, int bReversed );
00153 void CPL_DLL GDALDestroyGCPTransformer( void *pTransformArg );
00154 int CPL_DLL GDALGCPTransform( 
00155     void *pTransformArg, int bDstToSrc, int nPointCount,
00156     double *x, double *y, double *z, int *panSuccess );
00157 
00158 /* Thin Plate Spine transformer ... forward is to georef coordinates */
00159 
00160 void CPL_DLL *
00161 GDALCreateTPSTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 
00162                           int bReversed );
00163 void CPL_DLL GDALDestroyTPSTransformer( void *pTransformArg );
00164 int CPL_DLL GDALTPSTransform( 
00165     void *pTransformArg, int bDstToSrc, int nPointCount,
00166     double *x, double *y, double *z, int *panSuccess );
00167 
00168 /* RPC based transformer ... src is pixel/line/elev, dst is long/lat/elev */
00169 
00170 void CPL_DLL *
00171 GDALCreateRPCTransformer( GDALRPCInfo *psRPC, int bReversed, 
00172                           double dfPixErrThreshold,
00173                           char **papszOptions );
00174 void CPL_DLL GDALDestroyRPCTransformer( void *pTransformArg );
00175 int CPL_DLL GDALRPCTransform( 
00176     void *pTransformArg, int bDstToSrc, int nPointCount,
00177     double *x, double *y, double *z, int *panSuccess );
00178 
00179 /* Geolocation transformer */
00180 
00181 void CPL_DLL *
00182 GDALCreateGeoLocTransformer( GDALDatasetH hBaseDS, 
00183                              char **papszGeolocationInfo,
00184                              int bReversed );
00185 void CPL_DLL GDALDestroyGeoLocTransformer( void *pTransformArg );
00186 int CPL_DLL GDALGeoLocTransform( 
00187     void *pTransformArg, int bDstToSrc, int nPointCount,
00188     double *x, double *y, double *z, int *panSuccess );
00189 
00190 /* Approximate transformer */
00191 void CPL_DLL *
00192 GDALCreateApproxTransformer( GDALTransformerFunc pfnRawTransformer, 
00193                              void *pRawTransformerArg, double dfMaxError );
00194 void CPL_DLL GDALApproxTransformerOwnsSubtransformer( void *pCBData, 
00195                                                       int bOwnFlag );
00196 void CPL_DLL GDALDestroyApproxTransformer( void *pApproxArg );
00197 int  CPL_DLL GDALApproxTransform(
00198     void *pTransformArg, int bDstToSrc, int nPointCount,
00199     double *x, double *y, double *z, int *panSuccess );
00200 
00201                       
00202 
00203 
00204 int CPL_DLL CPL_STDCALL
00205 GDALSimpleImageWarp( GDALDatasetH hSrcDS, 
00206                      GDALDatasetH hDstDS, 
00207                      int nBandCount, int *panBandList,
00208                      GDALTransformerFunc pfnTransform,
00209                      void *pTransformArg,
00210                      GDALProgressFunc pfnProgress, 
00211                      void *pProgressArg, 
00212                      char **papszWarpOptions );
00213 
00214 CPLErr CPL_DLL CPL_STDCALL
00215 GDALSuggestedWarpOutput( GDALDatasetH hSrcDS, 
00216                          GDALTransformerFunc pfnTransformer,
00217                          void *pTransformArg,
00218                          double *padfGeoTransformOut, 
00219                          int *pnPixels, int *pnLines );
00220 CPLErr CPL_DLL CPL_STDCALL
00221 GDALSuggestedWarpOutput2( GDALDatasetH hSrcDS, 
00222                           GDALTransformerFunc pfnTransformer,
00223                           void *pTransformArg,
00224                           double *padfGeoTransformOut, 
00225                           int *pnPixels, int *pnLines,
00226                           double *padfExtents, 
00227                           int nOptions );
00228 
00229 CPLXMLNode CPL_DLL *
00230 GDALSerializeTransformer( GDALTransformerFunc pfnFunc, void *pTransformArg );
00231 CPLErr CPL_DLL GDALDeserializeTransformer( CPLXMLNode *psTree, 
00232                                            GDALTransformerFunc *ppfnFunc, 
00233                                            void **ppTransformArg );
00234                                       
00235 
00236 /* -------------------------------------------------------------------- */
00237 /*      Contour Line Generation                                         */
00238 /* -------------------------------------------------------------------- */
00239 
00240 typedef CPLErr (*GDALContourWriter)( double dfLevel, int nPoints,
00241                                      double *padfX, double *padfY, void * );
00242 
00243 typedef void *GDALContourGeneratorH;
00244 
00245 GDALContourGeneratorH CPL_DLL
00246 GDAL_CG_Create( int nWidth, int nHeight, 
00247                 int bNoDataSet, double dfNoDataValue,
00248                 double dfContourInterval, double dfContourBase,
00249                 GDALContourWriter pfnWriter, void *pCBData );
00250 CPLErr CPL_DLL GDAL_CG_FeedLine( GDALContourGeneratorH hCG, 
00251                                  double *padfScanline );
00252 void CPL_DLL GDAL_CG_Destroy( GDALContourGeneratorH hCG );
00253 
00254 typedef struct 
00255 {
00256     void   *hLayer;
00257 
00258     double adfGeoTransform[6];
00259     
00260     int    nElevField;
00261     int    nIDField;
00262     int    nNextID;
00263 } OGRContourWriterInfo;
00264 
00265 CPLErr CPL_DLL 
00266 OGRContourWriter( double, int, double *, double *, void *pInfo );
00267 
00268 CPLErr CPL_DLL
00269 GDALContourGenerate( GDALRasterBandH hBand, 
00270                             double dfContourInterval, double dfContourBase,
00271                             int nFixedLevelCount, double *padfFixedLevels,
00272                             int bUseNoData, double dfNoDataValue, 
00273                             void *hLayer, int iIDField, int iElevField,
00274                             GDALProgressFunc pfnProgress, void *pProgressArg );
00275 
00276 /************************************************************************/
00277 /*      Rasterizer API - geometries burned into GDAL raster.            */
00278 /************************************************************************/
00279 
00280 CPLErr CPL_DLL 
00281 GDALRasterizeGeometries( GDALDatasetH hDS, 
00282                          int nBandCount, int *panBandList, 
00283                          int nGeomCount, OGRGeometryH *pahGeometries,
00284                          GDALTransformerFunc pfnTransformer, 
00285                          void *pTransformArg, 
00286                          double *padfGeomBurnValue,
00287                          char **papszOptions,
00288                          GDALProgressFunc pfnProgress, 
00289                          void * pProgressArg );
00290 CPLErr CPL_DLL
00291 GDALRasterizeLayers( GDALDatasetH hDS, 
00292                      int nBandCount, int *panBandList,
00293                      int nLayerCount, OGRLayerH *pahLayers,
00294                      GDALTransformerFunc pfnTransformer, 
00295                      void *pTransformArg, 
00296                      double *padfLayerBurnValues,
00297                      char **papszOptions,
00298                      GDALProgressFunc pfnProgress, 
00299                      void *pProgressArg );
00300 
00301 /************************************************************************/
00302 /*  Gridding interface.                                                 */
00303 /************************************************************************/
00304 
00306 typedef enum {    GGA_InverseDistanceToAPower = 1,                 GGA_MovingAverage = 2,               GGA_NearestNeighbor = 3,    GGA_MetricMinimum = 4,    GGA_MetricMaximum = 5,       GGA_MetricRange = 6
00313 } GDALGridAlgorithm;
00314 
00316 typedef struct
00317 {
00319     double  dfPower;
00321     double  dfSmoothing;
00323     double  dfAnisotropyRatio;
00325     double  dfAnisotropyAngle;
00327     double  dfRadius1;
00329     double  dfRadius2;
00334     double  dfAngle;
00341     GUInt32 nMaxPoints;
00347     GUInt32 nMinPoints;
00349     double  dfNoDataValue;
00350 } GDALGridInverseDistanceToAPowerOptions;
00351 
00353 typedef struct
00354 {
00356     double  dfRadius1;
00358     double  dfRadius2;
00363     double  dfAngle;
00369     GUInt32 nMinPoints;
00371     double  dfNoDataValue;
00372 } GDALGridMovingAverageOptions;
00373 
00375 typedef struct
00376 {
00378     double  dfRadius1;
00380     double  dfRadius2;
00385     double  dfAngle;
00387     double  dfNoDataValue;
00388 } GDALGridNearestNeighborOptions;
00389 
00391 typedef struct
00392 {
00394     double  dfRadius1;
00396     double  dfRadius2;
00401     double  dfAngle;
00407     GUInt32 nMinPoints;
00409     double  dfNoDataValue;
00410 } GDALGridDataMetricsOptions;
00411 
00412 CPLErr CPL_DLL
00413 GDALGridCreate( GDALGridAlgorithm, const void *, GUInt32,
00414                 const double *, const double *, const double *,
00415                 double, double, double, double,
00416                 GUInt32, GUInt32, GDALDataType, void *,
00417                 GDALProgressFunc, void *);
00418 
00419 CPL_C_END
00420                             
00421 #endif /* ndef GDAL_ALG_H_INCLUDED */

Generated for GDAL by doxygen 1.7.3.