gdal_alg.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: gdal_alg.h 15128 2008-08-09 02:20:48Z 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 /*
00083  * Warp Related.
00084  */
00085 
00086 typedef int 
00087 (*GDALTransformerFunc)( void *pTransformerArg, 
00088                         int bDstToSrc, int nPointCount, 
00089                         double *x, double *y, double *z, int *panSuccess );
00090 
00091 typedef struct {
00092     char szSignature[4];
00093     const char *pszClassName;
00094     GDALTransformerFunc pfnTransform;
00095     void (*pfnCleanup)( void * );
00096     CPLXMLNode *(*pfnSerialize)( void * );
00097 } GDALTransformerInfo;
00098 
00099 void CPL_DLL GDALDestroyTransformer( void *pTransformerArg );
00100 int  CPL_DLL GDALUseTransformer( void *pTranformerArg, 
00101                                  int bDstToSrc, int nPointCount, 
00102                                  double *x, double *y, double *z, 
00103                                  int *panSuccess );
00104 
00105 /* High level transformer for going from image coordinates on one file
00106    to image coordiantes on another, potentially doing reprojection, 
00107    utilizing GCPs or using the geotransform. */
00108 
00109 void CPL_DLL *
00110 GDALCreateGenImgProjTransformer( GDALDatasetH hSrcDS, const char *pszSrcWKT,
00111                                  GDALDatasetH hDstDS, const char *pszDstWKT,
00112                                  int bGCPUseOK, double dfGCPErrorThreshold,
00113                                  int nOrder );
00114 void CPL_DLL *
00115 GDALCreateGenImgProjTransformer2( GDALDatasetH hSrcDS, GDALDatasetH hDstDS, 
00116                                   char **papszOptions );
00117 void CPL_DLL GDALSetGenImgProjTransformerDstGeoTransform( void *, 
00118                                                           const double * );
00119 void CPL_DLL GDALDestroyGenImgProjTransformer( void * );
00120 int CPL_DLL GDALGenImgProjTransform( 
00121     void *pTransformArg, int bDstToSrc, int nPointCount,
00122     double *x, double *y, double *z, int *panSuccess );
00123 
00124 /* Geo to geo reprojection transformer. */
00125 void CPL_DLL *
00126 GDALCreateReprojectionTransformer( const char *pszSrcWKT, 
00127                                    const char *pszDstWKT );
00128 void CPL_DLL GDALDestroyReprojectionTransformer( void * );
00129 int CPL_DLL GDALReprojectionTransform( 
00130     void *pTransformArg, int bDstToSrc, int nPointCount,
00131     double *x, double *y, double *z, int *panSuccess );
00132 
00133 /* GCP based transformer ... forward is to georef coordinates */
00134 void CPL_DLL *
00135 GDALCreateGCPTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 
00136                           int nReqOrder, int bReversed );
00137 void CPL_DLL GDALDestroyGCPTransformer( void *pTransformArg );
00138 int CPL_DLL GDALGCPTransform( 
00139     void *pTransformArg, int bDstToSrc, int nPointCount,
00140     double *x, double *y, double *z, int *panSuccess );
00141 
00142 /* Thin Plate Spine transformer ... forward is to georef coordinates */
00143 
00144 void CPL_DLL *
00145 GDALCreateTPSTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 
00146                           int bReversed );
00147 void CPL_DLL GDALDestroyTPSTransformer( void *pTransformArg );
00148 int CPL_DLL GDALTPSTransform( 
00149     void *pTransformArg, int bDstToSrc, int nPointCount,
00150     double *x, double *y, double *z, int *panSuccess );
00151 
00152 /* RPC based transformer ... src is pixel/line/elev, dst is long/lat/elev */
00153 
00154 void CPL_DLL *
00155 GDALCreateRPCTransformer( GDALRPCInfo *psRPC, int bReversed, 
00156                           double dfPixErrThreshold,
00157                           char **papszOptions );
00158 void CPL_DLL GDALDestroyRPCTransformer( void *pTransformArg );
00159 int CPL_DLL GDALRPCTransform( 
00160     void *pTransformArg, int bDstToSrc, int nPointCount,
00161     double *x, double *y, double *z, int *panSuccess );
00162 
00163 /* Geolocation transformer */
00164 
00165 void CPL_DLL *
00166 GDALCreateGeoLocTransformer( GDALDatasetH hBaseDS, 
00167                              char **papszGeolocationInfo,
00168                              int bReversed );
00169 void CPL_DLL GDALDestroyGeoLocTransformer( void *pTransformArg );
00170 int CPL_DLL GDALGeoLocTransform( 
00171     void *pTransformArg, int bDstToSrc, int nPointCount,
00172     double *x, double *y, double *z, int *panSuccess );
00173 
00174 /* Approximate transformer */
00175 void CPL_DLL *
00176 GDALCreateApproxTransformer( GDALTransformerFunc pfnRawTransformer, 
00177                              void *pRawTransformerArg, double dfMaxError );
00178 void CPL_DLL GDALApproxTransformerOwnsSubtransformer( void *pCBData, 
00179                                                       int bOwnFlag );
00180 void CPL_DLL GDALDestroyApproxTransformer( void *pApproxArg );
00181 int  CPL_DLL GDALApproxTransform(
00182     void *pTransformArg, int bDstToSrc, int nPointCount,
00183     double *x, double *y, double *z, int *panSuccess );
00184 
00185                       
00186 
00187 
00188 int CPL_DLL CPL_STDCALL
00189 GDALSimpleImageWarp( GDALDatasetH hSrcDS, 
00190                      GDALDatasetH hDstDS, 
00191                      int nBandCount, int *panBandList,
00192                      GDALTransformerFunc pfnTransform,
00193                      void *pTransformArg,
00194                      GDALProgressFunc pfnProgress, 
00195                      void *pProgressArg, 
00196                      char **papszWarpOptions );
00197 
00198 CPLErr CPL_DLL CPL_STDCALL
00199 GDALSuggestedWarpOutput( GDALDatasetH hSrcDS, 
00200                          GDALTransformerFunc pfnTransformer,
00201                          void *pTransformArg,
00202                          double *padfGeoTransformOut, 
00203                          int *pnPixels, int *pnLines );
00204 CPLErr CPL_DLL CPL_STDCALL
00205 GDALSuggestedWarpOutput2( GDALDatasetH hSrcDS, 
00206                           GDALTransformerFunc pfnTransformer,
00207                           void *pTransformArg,
00208                           double *padfGeoTransformOut, 
00209                           int *pnPixels, int *pnLines,
00210                           double *padfExtents, 
00211                           int nOptions );
00212 
00213 CPLXMLNode CPL_DLL *
00214 GDALSerializeTransformer( GDALTransformerFunc pfnFunc, void *pTransformArg );
00215 CPLErr CPL_DLL GDALDeserializeTransformer( CPLXMLNode *psTree, 
00216                                            GDALTransformerFunc *ppfnFunc, 
00217                                            void **ppTransformArg );
00218                                       
00219 
00220 /* -------------------------------------------------------------------- */
00221 /*      Contour Line Generation                                         */
00222 /* -------------------------------------------------------------------- */
00223 
00224 typedef CPLErr (*GDALContourWriter)( double dfLevel, int nPoints,
00225                                      double *padfX, double *padfY, void * );
00226 
00227 typedef void *GDALContourGeneratorH;
00228 
00229 GDALContourGeneratorH CPL_DLL
00230 GDAL_CG_Create( int nWidth, int nHeight, 
00231                 int bNoDataSet, double dfNoDataValue,
00232                 double dfContourInterval, double dfContourBase,
00233                 GDALContourWriter pfnWriter, void *pCBData );
00234 CPLErr CPL_DLL GDAL_CG_FeedLine( GDALContourGeneratorH hCG, 
00235                                  double *padfScanline );
00236 void CPL_DLL GDAL_CG_Destroy( GDALContourGeneratorH hCG );
00237 
00238 typedef struct 
00239 {
00240     void   *hLayer;
00241 
00242     double adfGeoTransform[6];
00243     
00244     int    nElevField;
00245     int    nIDField;
00246     int    nNextID;
00247 } OGRContourWriterInfo;
00248 
00249 CPLErr CPL_DLL 
00250 OGRContourWriter( double, int, double *, double *, void *pInfo );
00251 
00252 CPLErr CPL_DLL
00253 GDALContourGenerate( GDALRasterBandH hBand, 
00254                             double dfContourInterval, double dfContourBase,
00255                             int nFixedLevelCount, double *padfFixedLevels,
00256                             int bUseNoData, double dfNoDataValue, 
00257                             void *hLayer, int iIDField, int iElevField,
00258                             GDALProgressFunc pfnProgress, void *pProgressArg );
00259 
00260 /************************************************************************/
00261 /*      Rasterizer API - geometries burned into GDAL raster.            */
00262 /************************************************************************/
00263 
00264 CPLErr CPL_DLL 
00265 GDALRasterizeGeometries( GDALDatasetH hDS, 
00266                          int nBandCount, int *panBandList, 
00267                          int nGeomCount, OGRGeometryH *pahGeometries,
00268                          GDALTransformerFunc pfnTransformer, 
00269                          void *pTransformArg, 
00270                          double *padfGeomBurnValue,
00271                          char **papszOptions,
00272                          GDALProgressFunc pfnProgress, 
00273                          void * pProgressArg );
00274 CPLErr CPL_DLL
00275 GDALRasterizeLayers( GDALDatasetH hDS, 
00276                      int nBandCount, int *panBandList,
00277                      int nLayerCount, OGRLayerH *pahLayers,
00278                      GDALTransformerFunc pfnTransformer, 
00279                      void *pTransformArg, 
00280                      double *padfLayerBurnValues,
00281                      char **papszOptions,
00282                      GDALProgressFunc pfnProgress, 
00283                      void *pProgressArg );
00284 
00285 /************************************************************************/
00286 /*  Gridding interface.                                                 */
00287 /************************************************************************/
00288 
00290 typedef enum {    GGA_InverseDistanceToAPower = 1,                 GGA_MovingAverage = 2,               GGA_NearestNeighbor = 3,    GGA_MetricMinimum = 4,    GGA_MetricMaximum = 5,       GGA_MetricRange = 6
00297 } GDALGridAlgorithm;
00298 
00300 typedef struct
00301 {
00303     double  dfPower;
00305     double  dfSmoothing;
00307     double  dfAnisotropyRatio;
00309     double  dfAnisotropyAngle;
00311     double  dfRadius1;
00313     double  dfRadius2;
00318     double  dfAngle;
00325     GUInt32 nMaxPoints;
00331     GUInt32 nMinPoints;
00333     double  dfNoDataValue;
00334 } GDALGridInverseDistanceToAPowerOptions;
00335 
00337 typedef struct
00338 {
00340     double  dfRadius1;
00342     double  dfRadius2;
00347     double  dfAngle;
00353     GUInt32 nMinPoints;
00355     double  dfNoDataValue;
00356 } GDALGridMovingAverageOptions;
00357 
00359 typedef struct
00360 {
00362     double  dfRadius1;
00364     double  dfRadius2;
00369     double  dfAngle;
00371     double  dfNoDataValue;
00372 } GDALGridNearestNeighborOptions;
00373 
00375 typedef struct
00376 {
00378     double  dfRadius1;
00380     double  dfRadius2;
00385     double  dfAngle;
00391     GUInt32 nMinPoints;
00393     double  dfNoDataValue;
00394 } GDALGridDataMetricsOptions;
00395 
00396 CPLErr CPL_DLL
00397 GDALGridCreate( GDALGridAlgorithm, const void *, GUInt32,
00398                 const double *, const double *, const double *,
00399                 double, double, double, double,
00400                 GUInt32, GUInt32, GDALDataType, void *,
00401                 GDALProgressFunc, void *);
00402 
00403 CPL_C_END
00404                             
00405 #endif /* ndef GDAL_ALG_H_INCLUDED */

Generated for GDAL by doxygen 1.5.1.