GDAL
gdal_alg.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: gdal_alg.h 25741 2013-03-13 19:19:16Z ilucena $
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 #ifndef DOXYGEN_SKIP
00040 #include "gdal.h"
00041 #include "cpl_minixml.h"
00042 #include "ogr_api.h"
00043 #endif
00044 
00045 CPL_C_START
00046 
00047 int CPL_DLL CPL_STDCALL GDALComputeMedianCutPCT( GDALRasterBandH hRed, 
00048                              GDALRasterBandH hGreen, 
00049                              GDALRasterBandH hBlue, 
00050                              int (*pfnIncludePixel)(int,int,void*),
00051                              int nColors, 
00052                              GDALColorTableH hColorTable,
00053                              GDALProgressFunc pfnProgress, 
00054                              void * pProgressArg );
00055 
00056 int CPL_DLL CPL_STDCALL GDALDitherRGB2PCT( GDALRasterBandH hRed, 
00057                        GDALRasterBandH hGreen, 
00058                        GDALRasterBandH hBlue, 
00059                        GDALRasterBandH hTarget, 
00060                        GDALColorTableH hColorTable, 
00061                        GDALProgressFunc pfnProgress, 
00062                        void * pProgressArg );
00063 
00064 int CPL_DLL CPL_STDCALL GDALChecksumImage( GDALRasterBandH hBand, 
00065                                int nXOff, int nYOff, int nXSize, int nYSize );
00066                                
00067 CPLErr CPL_DLL CPL_STDCALL 
00068 GDALComputeProximity( GDALRasterBandH hSrcBand, 
00069                       GDALRasterBandH hProximityBand,
00070                       char **papszOptions,
00071                       GDALProgressFunc pfnProgress, 
00072                       void * pProgressArg );
00073 
00074 CPLErr CPL_DLL CPL_STDCALL
00075 GDALFillNodata( GDALRasterBandH hTargetBand, 
00076                 GDALRasterBandH hMaskBand,
00077                 double dfMaxSearchDist, 
00078                 int bDeprecatedOption,
00079                 int nSmoothingIterations,
00080                 char **papszOptions,
00081                 GDALProgressFunc pfnProgress, 
00082                 void * pProgressArg );
00083 
00084 CPLErr CPL_DLL CPL_STDCALL
00085 GDALPolygonize( GDALRasterBandH hSrcBand, 
00086                 GDALRasterBandH hMaskBand,
00087                 OGRLayerH hOutLayer, int iPixValField, 
00088                 char **papszOptions,
00089                 GDALProgressFunc pfnProgress, 
00090                 void * pProgressArg );
00091 
00092 CPLErr CPL_DLL CPL_STDCALL
00093 GDALFPolygonize( GDALRasterBandH hSrcBand,
00094                 GDALRasterBandH hMaskBand,
00095                 OGRLayerH hOutLayer, int iPixValField,
00096                 char **papszOptions,
00097                 GDALProgressFunc pfnProgress,
00098                 void * pProgressArg );
00099 
00100 CPLErr CPL_DLL CPL_STDCALL
00101 GDALSieveFilter( GDALRasterBandH hSrcBand, GDALRasterBandH hMaskBand,
00102                  GDALRasterBandH hDstBand,
00103                  int nSizeThreshold, int nConnectedness,
00104                  char **papszOptions,
00105                  GDALProgressFunc pfnProgress, 
00106                  void * pProgressArg );
00107 
00108 /*
00109  * Warp Related.
00110  */
00111 
00112 typedef int 
00113 (*GDALTransformerFunc)( void *pTransformerArg, 
00114                         int bDstToSrc, int nPointCount, 
00115                         double *x, double *y, double *z, int *panSuccess );
00116 
00117 typedef struct {
00118     char szSignature[4];
00119     const char *pszClassName;
00120     GDALTransformerFunc pfnTransform;
00121     void (*pfnCleanup)( void * );
00122     CPLXMLNode *(*pfnSerialize)( void * );
00123     /* TODO GDAL 2.0 : add a void* (*pfnClone) (void *) member */
00124 } GDALTransformerInfo;
00125 
00126 void CPL_DLL GDALDestroyTransformer( void *pTransformerArg );
00127 int  CPL_DLL GDALUseTransformer( void *pTranformerArg, 
00128                                  int bDstToSrc, int nPointCount, 
00129                                  double *x, double *y, double *z, 
00130                                  int *panSuccess );
00131 
00132 /* High level transformer for going from image coordinates on one file
00133    to image coordiantes on another, potentially doing reprojection, 
00134    utilizing GCPs or using the geotransform. */
00135 
00136 void CPL_DLL *
00137 GDALCreateGenImgProjTransformer( GDALDatasetH hSrcDS, const char *pszSrcWKT,
00138                                  GDALDatasetH hDstDS, const char *pszDstWKT,
00139                                  int bGCPUseOK, double dfGCPErrorThreshold,
00140                                  int nOrder );
00141 void CPL_DLL *
00142 GDALCreateGenImgProjTransformer2( GDALDatasetH hSrcDS, GDALDatasetH hDstDS, 
00143                                   char **papszOptions );
00144 void CPL_DLL *
00145 GDALCreateGenImgProjTransformer3( const char *pszSrcWKT,
00146                                   const double *padfSrcGeoTransform,
00147                                   const char *pszDstWKT,
00148                                   const double *padfDstGeoTransform );
00149 void CPL_DLL GDALSetGenImgProjTransformerDstGeoTransform( void *, 
00150                                                           const double * );
00151 void CPL_DLL GDALDestroyGenImgProjTransformer( void * );
00152 int CPL_DLL GDALGenImgProjTransform( 
00153     void *pTransformArg, int bDstToSrc, int nPointCount,
00154     double *x, double *y, double *z, int *panSuccess );
00155 
00156 /* Geo to geo reprojection transformer. */
00157 void CPL_DLL *
00158 GDALCreateReprojectionTransformer( const char *pszSrcWKT, 
00159                                    const char *pszDstWKT );
00160 void CPL_DLL GDALDestroyReprojectionTransformer( void * );
00161 int CPL_DLL GDALReprojectionTransform( 
00162     void *pTransformArg, int bDstToSrc, int nPointCount,
00163     double *x, double *y, double *z, int *panSuccess );
00164 
00165 /* GCP based transformer ... forward is to georef coordinates */
00166 void CPL_DLL *
00167 GDALCreateGCPTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 
00168                           int nReqOrder, int bReversed );
00169                           
00170 /* GCP based transformer with refinement of the GCPs ... forward is to georef coordinates */
00171 void CPL_DLL *
00172 GDALCreateGCPRefineTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 
00173                                 int nReqOrder, int bReversed, double tolerance, int minimumGcps);
00174                           
00175 void CPL_DLL GDALDestroyGCPTransformer( void *pTransformArg );
00176 int CPL_DLL GDALGCPTransform( 
00177     void *pTransformArg, int bDstToSrc, int nPointCount,
00178     double *x, double *y, double *z, int *panSuccess );
00179 
00180 /* Thin Plate Spine transformer ... forward is to georef coordinates */
00181 
00182 void CPL_DLL *
00183 GDALCreateTPSTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 
00184                           int bReversed );
00185 void CPL_DLL GDALDestroyTPSTransformer( void *pTransformArg );
00186 int CPL_DLL GDALTPSTransform( 
00187     void *pTransformArg, int bDstToSrc, int nPointCount,
00188     double *x, double *y, double *z, int *panSuccess );
00189 
00190 char CPL_DLL ** RPCInfoToMD( GDALRPCInfo *psRPCInfo );
00191 
00192 /* RPC based transformer ... src is pixel/line/elev, dst is long/lat/elev */
00193 
00194 void CPL_DLL *
00195 GDALCreateRPCTransformer( GDALRPCInfo *psRPC, int bReversed, 
00196                           double dfPixErrThreshold,
00197                           char **papszOptions );
00198 void CPL_DLL GDALDestroyRPCTransformer( void *pTransformArg );
00199 int CPL_DLL GDALRPCTransform( 
00200     void *pTransformArg, int bDstToSrc, int nPointCount,
00201     double *x, double *y, double *z, int *panSuccess );
00202 
00203 /* Geolocation transformer */
00204 
00205 void CPL_DLL *
00206 GDALCreateGeoLocTransformer( GDALDatasetH hBaseDS, 
00207                              char **papszGeolocationInfo,
00208                              int bReversed );
00209 void CPL_DLL GDALDestroyGeoLocTransformer( void *pTransformArg );
00210 int CPL_DLL GDALGeoLocTransform( 
00211     void *pTransformArg, int bDstToSrc, int nPointCount,
00212     double *x, double *y, double *z, int *panSuccess );
00213 
00214 /* Approximate transformer */
00215 void CPL_DLL *
00216 GDALCreateApproxTransformer( GDALTransformerFunc pfnRawTransformer, 
00217                              void *pRawTransformerArg, double dfMaxError );
00218 void CPL_DLL GDALApproxTransformerOwnsSubtransformer( void *pCBData, 
00219                                                       int bOwnFlag );
00220 void CPL_DLL GDALDestroyApproxTransformer( void *pApproxArg );
00221 int  CPL_DLL GDALApproxTransform(
00222     void *pTransformArg, int bDstToSrc, int nPointCount,
00223     double *x, double *y, double *z, int *panSuccess );
00224 
00225                       
00226 
00227 
00228 int CPL_DLL CPL_STDCALL
00229 GDALSimpleImageWarp( GDALDatasetH hSrcDS, 
00230                      GDALDatasetH hDstDS, 
00231                      int nBandCount, int *panBandList,
00232                      GDALTransformerFunc pfnTransform,
00233                      void *pTransformArg,
00234                      GDALProgressFunc pfnProgress, 
00235                      void *pProgressArg, 
00236                      char **papszWarpOptions );
00237 
00238 CPLErr CPL_DLL CPL_STDCALL
00239 GDALSuggestedWarpOutput( GDALDatasetH hSrcDS, 
00240                          GDALTransformerFunc pfnTransformer,
00241                          void *pTransformArg,
00242                          double *padfGeoTransformOut, 
00243                          int *pnPixels, int *pnLines );
00244 CPLErr CPL_DLL CPL_STDCALL
00245 GDALSuggestedWarpOutput2( GDALDatasetH hSrcDS, 
00246                           GDALTransformerFunc pfnTransformer,
00247                           void *pTransformArg,
00248                           double *padfGeoTransformOut, 
00249                           int *pnPixels, int *pnLines,
00250                           double *padfExtents, 
00251                           int nOptions );
00252 
00253 CPLXMLNode CPL_DLL *
00254 GDALSerializeTransformer( GDALTransformerFunc pfnFunc, void *pTransformArg );
00255 CPLErr CPL_DLL GDALDeserializeTransformer( CPLXMLNode *psTree, 
00256                                            GDALTransformerFunc *ppfnFunc, 
00257                                            void **ppTransformArg );
00258 
00259 CPLErr CPL_DLL
00260 GDALTransformGeolocations( GDALRasterBandH hXBand, 
00261                            GDALRasterBandH hYBand, 
00262                            GDALRasterBandH hZBand,
00263                            GDALTransformerFunc pfnTransformer, 
00264                            void *pTransformArg, 
00265                            GDALProgressFunc pfnProgress, 
00266                            void *pProgressArg,
00267                            char **papszOptions );
00268 
00269 /* -------------------------------------------------------------------- */
00270 /*      Contour Line Generation                                         */
00271 /* -------------------------------------------------------------------- */
00272 
00273 typedef CPLErr (*GDALContourWriter)( double dfLevel, int nPoints,
00274                                      double *padfX, double *padfY, void * );
00275 
00276 typedef void *GDALContourGeneratorH;
00277 
00278 GDALContourGeneratorH CPL_DLL
00279 GDAL_CG_Create( int nWidth, int nHeight, 
00280                 int bNoDataSet, double dfNoDataValue,
00281                 double dfContourInterval, double dfContourBase,
00282                 GDALContourWriter pfnWriter, void *pCBData );
00283 CPLErr CPL_DLL GDAL_CG_FeedLine( GDALContourGeneratorH hCG, 
00284                                  double *padfScanline );
00285 void CPL_DLL GDAL_CG_Destroy( GDALContourGeneratorH hCG );
00286 
00287 typedef struct 
00288 {
00289     void   *hLayer;
00290 
00291     double adfGeoTransform[6];
00292     
00293     int    nElevField;
00294     int    nIDField;
00295     int    nNextID;
00296 } OGRContourWriterInfo;
00297 
00298 CPLErr CPL_DLL 
00299 OGRContourWriter( double, int, double *, double *, void *pInfo );
00300 
00301 CPLErr CPL_DLL
00302 GDALContourGenerate( GDALRasterBandH hBand, 
00303                             double dfContourInterval, double dfContourBase,
00304                             int nFixedLevelCount, double *padfFixedLevels,
00305                             int bUseNoData, double dfNoDataValue, 
00306                             void *hLayer, int iIDField, int iElevField,
00307                             GDALProgressFunc pfnProgress, void *pProgressArg );
00308 
00309 /************************************************************************/
00310 /*      Rasterizer API - geometries burned into GDAL raster.            */
00311 /************************************************************************/
00312 
00313 CPLErr CPL_DLL 
00314 GDALRasterizeGeometries( GDALDatasetH hDS, 
00315                          int nBandCount, int *panBandList, 
00316                          int nGeomCount, OGRGeometryH *pahGeometries,
00317                          GDALTransformerFunc pfnTransformer, 
00318                          void *pTransformArg, 
00319                          double *padfGeomBurnValue,
00320                          char **papszOptions,
00321                          GDALProgressFunc pfnProgress, 
00322                          void * pProgressArg );
00323 CPLErr CPL_DLL
00324 GDALRasterizeLayers( GDALDatasetH hDS, 
00325                      int nBandCount, int *panBandList,
00326                      int nLayerCount, OGRLayerH *pahLayers,
00327                      GDALTransformerFunc pfnTransformer, 
00328                      void *pTransformArg, 
00329                      double *padfLayerBurnValues,
00330                      char **papszOptions,
00331                      GDALProgressFunc pfnProgress, 
00332                      void *pProgressArg );
00333 
00334 CPLErr CPL_DLL 
00335 GDALRasterizeLayersBuf( void *pData, int nBufXSize, int nBufYSize,
00336                         GDALDataType eBufType, int nPixelSpace, int nLineSpace,
00337                         int nLayerCount, OGRLayerH *pahLayers,
00338                         const char *pszDstProjection,
00339                         double *padfDstGeoTransform,
00340                         GDALTransformerFunc pfnTransformer, 
00341                         void *pTransformArg, double dfBurnValue,
00342                         char **papszOptions, GDALProgressFunc pfnProgress, 
00343                         void *pProgressArg );
00344 
00345 
00346 /************************************************************************/
00347 /*  Gridding interface.                                                 */
00348 /************************************************************************/
00349 
00351 typedef enum {    GGA_InverseDistanceToAPower = 1,                 GGA_MovingAverage = 2,               GGA_NearestNeighbor = 3,    GGA_MetricMinimum = 4,    GGA_MetricMaximum = 5,       GGA_MetricRange = 6, GGA_MetricCount = 7, GGA_MetricAverageDistance = 8,
00361                                         GGA_MetricAverageDistancePts = 9
00362 } GDALGridAlgorithm;
00363 
00365 typedef struct
00366 {
00368     double  dfPower;
00370     double  dfSmoothing;
00372     double  dfAnisotropyRatio;
00374     double  dfAnisotropyAngle;
00376     double  dfRadius1;
00378     double  dfRadius2;
00383     double  dfAngle;
00390     GUInt32 nMaxPoints;
00396     GUInt32 nMinPoints;
00398     double  dfNoDataValue;
00399 } GDALGridInverseDistanceToAPowerOptions;
00400 
00402 typedef struct
00403 {
00405     double  dfRadius1;
00407     double  dfRadius2;
00412     double  dfAngle;
00418     GUInt32 nMinPoints;
00420     double  dfNoDataValue;
00421 } GDALGridMovingAverageOptions;
00422 
00424 typedef struct
00425 {
00427     double  dfRadius1;
00429     double  dfRadius2;
00434     double  dfAngle;
00436     double  dfNoDataValue;
00437 } GDALGridNearestNeighborOptions;
00438 
00440 typedef struct
00441 {
00443     double  dfRadius1;
00445     double  dfRadius2;
00450     double  dfAngle;
00456     GUInt32 nMinPoints;
00458     double  dfNoDataValue;
00459 } GDALGridDataMetricsOptions;
00460 
00461 CPLErr CPL_DLL
00462 GDALGridCreate( GDALGridAlgorithm, const void *, GUInt32,
00463                 const double *, const double *, const double *,
00464                 double, double, double, double,
00465                 GUInt32, GUInt32, GDALDataType, void *,
00466                 GDALProgressFunc, void *);
00467 
00468 GDAL_GCP CPL_DLL *
00469 GDALComputeMatchingPoints( GDALDatasetH hFirstImage,
00470                            GDALDatasetH hSecondImage,
00471                            char **papszOptions,
00472                            int *pnGCPCount ); 
00473 CPL_C_END
00474                             
00475 #endif /* ndef GDAL_ALG_H_INCLUDED */

Generated for GDAL by doxygen 1.7.6.1.