GDAL
gdal_alg.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: gdal_alg.h 18227 2009-12-09 13:08:16Z chaitanya $
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 GDALSieveFilter( GDALRasterBandH hSrcBand, GDALRasterBandH hMaskBand,
00094                  GDALRasterBandH hDstBand,
00095                  int nSizeThreshold, int nConnectedness,
00096                  char **papszOptions,
00097                  GDALProgressFunc pfnProgress, 
00098                  void * pProgressArg );
00099 
00100 /*
00101  * Warp Related.
00102  */
00103 
00104 typedef int 
00105 (*GDALTransformerFunc)( void *pTransformerArg, 
00106                         int bDstToSrc, int nPointCount, 
00107                         double *x, double *y, double *z, int *panSuccess );
00108 
00109 typedef struct {
00110     char szSignature[4];
00111     const char *pszClassName;
00112     GDALTransformerFunc pfnTransform;
00113     void (*pfnCleanup)( void * );
00114     CPLXMLNode *(*pfnSerialize)( void * );
00115 } GDALTransformerInfo;
00116 
00117 void CPL_DLL GDALDestroyTransformer( void *pTransformerArg );
00118 int  CPL_DLL GDALUseTransformer( void *pTranformerArg, 
00119                                  int bDstToSrc, int nPointCount, 
00120                                  double *x, double *y, double *z, 
00121                                  int *panSuccess );
00122 
00123 /* High level transformer for going from image coordinates on one file
00124    to image coordiantes on another, potentially doing reprojection, 
00125    utilizing GCPs or using the geotransform. */
00126 
00127 void CPL_DLL *
00128 GDALCreateGenImgProjTransformer( GDALDatasetH hSrcDS, const char *pszSrcWKT,
00129                                  GDALDatasetH hDstDS, const char *pszDstWKT,
00130                                  int bGCPUseOK, double dfGCPErrorThreshold,
00131                                  int nOrder );
00132 void CPL_DLL *
00133 GDALCreateGenImgProjTransformer2( GDALDatasetH hSrcDS, GDALDatasetH hDstDS, 
00134                                   char **papszOptions );
00135 void CPL_DLL *
00136 GDALCreateGenImgProjTransformer3( const char *pszSrcWKT,
00137                                   const double *padfSrcGeoTransform,
00138                                   const char *pszDstWKT,
00139                                   const double *padfDstGeoTransform );
00140 void CPL_DLL GDALSetGenImgProjTransformerDstGeoTransform( void *, 
00141                                                           const double * );
00142 void CPL_DLL GDALDestroyGenImgProjTransformer( void * );
00143 int CPL_DLL GDALGenImgProjTransform( 
00144     void *pTransformArg, int bDstToSrc, int nPointCount,
00145     double *x, double *y, double *z, int *panSuccess );
00146 
00147 /* Geo to geo reprojection transformer. */
00148 void CPL_DLL *
00149 GDALCreateReprojectionTransformer( const char *pszSrcWKT, 
00150                                    const char *pszDstWKT );
00151 void CPL_DLL GDALDestroyReprojectionTransformer( void * );
00152 int CPL_DLL GDALReprojectionTransform( 
00153     void *pTransformArg, int bDstToSrc, int nPointCount,
00154     double *x, double *y, double *z, int *panSuccess );
00155 
00156 /* GCP based transformer ... forward is to georef coordinates */
00157 void CPL_DLL *
00158 GDALCreateGCPTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 
00159                           int nReqOrder, int bReversed );
00160 void CPL_DLL GDALDestroyGCPTransformer( void *pTransformArg );
00161 int CPL_DLL GDALGCPTransform( 
00162     void *pTransformArg, int bDstToSrc, int nPointCount,
00163     double *x, double *y, double *z, int *panSuccess );
00164 
00165 /* Thin Plate Spine transformer ... forward is to georef coordinates */
00166 
00167 void CPL_DLL *
00168 GDALCreateTPSTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 
00169                           int bReversed );
00170 void CPL_DLL GDALDestroyTPSTransformer( void *pTransformArg );
00171 int CPL_DLL GDALTPSTransform( 
00172     void *pTransformArg, int bDstToSrc, int nPointCount,
00173     double *x, double *y, double *z, int *panSuccess );
00174 
00175 /* RPC based transformer ... src is pixel/line/elev, dst is long/lat/elev */
00176 
00177 void CPL_DLL *
00178 GDALCreateRPCTransformer( GDALRPCInfo *psRPC, int bReversed, 
00179                           double dfPixErrThreshold,
00180                           char **papszOptions );
00181 void CPL_DLL GDALDestroyRPCTransformer( void *pTransformArg );
00182 int CPL_DLL GDALRPCTransform( 
00183     void *pTransformArg, int bDstToSrc, int nPointCount,
00184     double *x, double *y, double *z, int *panSuccess );
00185 
00186 /* Geolocation transformer */
00187 
00188 void CPL_DLL *
00189 GDALCreateGeoLocTransformer( GDALDatasetH hBaseDS, 
00190                              char **papszGeolocationInfo,
00191                              int bReversed );
00192 void CPL_DLL GDALDestroyGeoLocTransformer( void *pTransformArg );
00193 int CPL_DLL GDALGeoLocTransform( 
00194     void *pTransformArg, int bDstToSrc, int nPointCount,
00195     double *x, double *y, double *z, int *panSuccess );
00196 
00197 /* Approximate transformer */
00198 void CPL_DLL *
00199 GDALCreateApproxTransformer( GDALTransformerFunc pfnRawTransformer, 
00200                              void *pRawTransformerArg, double dfMaxError );
00201 void CPL_DLL GDALApproxTransformerOwnsSubtransformer( void *pCBData, 
00202                                                       int bOwnFlag );
00203 void CPL_DLL GDALDestroyApproxTransformer( void *pApproxArg );
00204 int  CPL_DLL GDALApproxTransform(
00205     void *pTransformArg, int bDstToSrc, int nPointCount,
00206     double *x, double *y, double *z, int *panSuccess );
00207 
00208                       
00209 
00210 
00211 int CPL_DLL CPL_STDCALL
00212 GDALSimpleImageWarp( GDALDatasetH hSrcDS, 
00213                      GDALDatasetH hDstDS, 
00214                      int nBandCount, int *panBandList,
00215                      GDALTransformerFunc pfnTransform,
00216                      void *pTransformArg,
00217                      GDALProgressFunc pfnProgress, 
00218                      void *pProgressArg, 
00219                      char **papszWarpOptions );
00220 
00221 CPLErr CPL_DLL CPL_STDCALL
00222 GDALSuggestedWarpOutput( GDALDatasetH hSrcDS, 
00223                          GDALTransformerFunc pfnTransformer,
00224                          void *pTransformArg,
00225                          double *padfGeoTransformOut, 
00226                          int *pnPixels, int *pnLines );
00227 CPLErr CPL_DLL CPL_STDCALL
00228 GDALSuggestedWarpOutput2( GDALDatasetH hSrcDS, 
00229                           GDALTransformerFunc pfnTransformer,
00230                           void *pTransformArg,
00231                           double *padfGeoTransformOut, 
00232                           int *pnPixels, int *pnLines,
00233                           double *padfExtents, 
00234                           int nOptions );
00235 
00236 CPLXMLNode CPL_DLL *
00237 GDALSerializeTransformer( GDALTransformerFunc pfnFunc, void *pTransformArg );
00238 CPLErr CPL_DLL GDALDeserializeTransformer( CPLXMLNode *psTree, 
00239                                            GDALTransformerFunc *ppfnFunc, 
00240                                            void **ppTransformArg );
00241                                       
00242 
00243 /* -------------------------------------------------------------------- */
00244 /*      Contour Line Generation                                         */
00245 /* -------------------------------------------------------------------- */
00246 
00247 typedef CPLErr (*GDALContourWriter)( double dfLevel, int nPoints,
00248                                      double *padfX, double *padfY, void * );
00249 
00250 typedef void *GDALContourGeneratorH;
00251 
00252 GDALContourGeneratorH CPL_DLL
00253 GDAL_CG_Create( int nWidth, int nHeight, 
00254                 int bNoDataSet, double dfNoDataValue,
00255                 double dfContourInterval, double dfContourBase,
00256                 GDALContourWriter pfnWriter, void *pCBData );
00257 CPLErr CPL_DLL GDAL_CG_FeedLine( GDALContourGeneratorH hCG, 
00258                                  double *padfScanline );
00259 void CPL_DLL GDAL_CG_Destroy( GDALContourGeneratorH hCG );
00260 
00261 typedef struct 
00262 {
00263     void   *hLayer;
00264 
00265     double adfGeoTransform[6];
00266     
00267     int    nElevField;
00268     int    nIDField;
00269     int    nNextID;
00270 } OGRContourWriterInfo;
00271 
00272 CPLErr CPL_DLL 
00273 OGRContourWriter( double, int, double *, double *, void *pInfo );
00274 
00275 CPLErr CPL_DLL
00276 GDALContourGenerate( GDALRasterBandH hBand, 
00277                             double dfContourInterval, double dfContourBase,
00278                             int nFixedLevelCount, double *padfFixedLevels,
00279                             int bUseNoData, double dfNoDataValue, 
00280                             void *hLayer, int iIDField, int iElevField,
00281                             GDALProgressFunc pfnProgress, void *pProgressArg );
00282 
00283 /************************************************************************/
00284 /*      Rasterizer API - geometries burned into GDAL raster.            */
00285 /************************************************************************/
00286 
00287 CPLErr CPL_DLL 
00288 GDALRasterizeGeometries( GDALDatasetH hDS, 
00289                          int nBandCount, int *panBandList, 
00290                          int nGeomCount, OGRGeometryH *pahGeometries,
00291                          GDALTransformerFunc pfnTransformer, 
00292                          void *pTransformArg, 
00293                          double *padfGeomBurnValue,
00294                          char **papszOptions,
00295                          GDALProgressFunc pfnProgress, 
00296                          void * pProgressArg );
00297 CPLErr CPL_DLL
00298 GDALRasterizeLayers( GDALDatasetH hDS, 
00299                      int nBandCount, int *panBandList,
00300                      int nLayerCount, OGRLayerH *pahLayers,
00301                      GDALTransformerFunc pfnTransformer, 
00302                      void *pTransformArg, 
00303                      double *padfLayerBurnValues,
00304                      char **papszOptions,
00305                      GDALProgressFunc pfnProgress, 
00306                      void *pProgressArg );
00307 
00308 CPLErr CPL_DLL 
00309 GDALRasterizeLayersBuf( void *pData, int nBufXSize, int nBufYSize,
00310                         GDALDataType eBufType, int nPixelSpace, int nLineSpace,
00311                         int nLayerCount, OGRLayerH *pahLayers,
00312                         const char *pszDstProjection,
00313                         double *padfDstGeoTransform,
00314                         GDALTransformerFunc pfnTransformer, 
00315                         void *pTransformArg, double dfBurnValue,
00316                         char **papszOptions, GDALProgressFunc pfnProgress, 
00317                         void *pProgressArg );
00318 
00319 
00320 /************************************************************************/
00321 /*  Gridding interface.                                                 */
00322 /************************************************************************/
00323 
00325 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,
00335                                         GGA_MetricAverageDistancePts = 9
00336 } GDALGridAlgorithm;
00337 
00339 typedef struct
00340 {
00342     double  dfPower;
00344     double  dfSmoothing;
00346     double  dfAnisotropyRatio;
00348     double  dfAnisotropyAngle;
00350     double  dfRadius1;
00352     double  dfRadius2;
00357     double  dfAngle;
00364     GUInt32 nMaxPoints;
00370     GUInt32 nMinPoints;
00372     double  dfNoDataValue;
00373 } GDALGridInverseDistanceToAPowerOptions;
00374 
00376 typedef struct
00377 {
00379     double  dfRadius1;
00381     double  dfRadius2;
00386     double  dfAngle;
00392     GUInt32 nMinPoints;
00394     double  dfNoDataValue;
00395 } GDALGridMovingAverageOptions;
00396 
00398 typedef struct
00399 {
00401     double  dfRadius1;
00403     double  dfRadius2;
00408     double  dfAngle;
00410     double  dfNoDataValue;
00411 } GDALGridNearestNeighborOptions;
00412 
00414 typedef struct
00415 {
00417     double  dfRadius1;
00419     double  dfRadius2;
00424     double  dfAngle;
00430     GUInt32 nMinPoints;
00432     double  dfNoDataValue;
00433 } GDALGridDataMetricsOptions;
00434 
00435 CPLErr CPL_DLL
00436 GDALGridCreate( GDALGridAlgorithm, const void *, GUInt32,
00437                 const double *, const double *, const double *,
00438                 double, double, double, double,
00439                 GUInt32, GUInt32, GDALDataType, void *,
00440                 GDALProgressFunc, void *);
00441 CPL_C_END
00442                             
00443 #endif /* ndef GDAL_ALG_H_INCLUDED */

Generated for GDAL by doxygen 1.7.6.1.