gdal_alg.h

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

Generated for GDAL by doxygen 1.5.1.