gdal_alg.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: gdal_alg.h,v 1.26 2006/08/08 03:16:01 fwarmerdam Exp $
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  * $Log: gdal_alg.h,v $
00031  * Revision 1.26  2006/08/08 03:16:01  fwarmerdam
00032  * preliminary geoloc support
00033  *
00034  * Revision 1.25  2006/07/06 20:29:14  fwarmerdam
00035  * added GDALSuggestedWarpOutput2() to return raw extents
00036  *
00037  * Revision 1.24  2005/10/28 18:30:28  fwarmerdam
00038  * added progress func for rasterize
00039  *
00040  * Revision 1.23  2005/10/28 17:46:29  fwarmerdam
00041  * Added rasterize related stuff
00042  *
00043  * Revision 1.22  2005/08/02 22:19:41  fwarmerdam
00044  * approx transformer now can own its subtransformer
00045  *
00046  * Revision 1.21  2005/04/11 17:36:53  fwarmerdam
00047  * added GDALDestroyTransformer
00048  *
00049  * Revision 1.20  2005/04/04 15:24:16  fwarmerdam
00050  * added CPL_STDCALL to some functions
00051  *
00052  * Revision 1.19  2004/12/26 16:12:21  fwarmerdam
00053  * thin plate spline support now implemented
00054  *
00055  * Revision 1.18  2004/08/11 19:00:06  warmerda
00056  * added GDALSetGenImgProjTransformerDstGeoTransform
00057  *
00058  * Revision 1.17  2004/08/09 14:38:27  warmerda
00059  * added serialize/deserialize support for warpoptions and transformers
00060  *
00061  * Revision 1.16  2003/12/15 15:59:25  warmerda
00062  * added CPL_DLL on contour stuff.
00063  *
00064  * Revision 1.15  2003/10/16 16:44:05  warmerda
00065  * added support for fixed levels
00066  *
00067  * Revision 1.14  2003/10/15 20:22:16  warmerda
00068  * removed C++ contour definitions
00069  *
00070  * Revision 1.13  2003/10/14 15:25:01  warmerda
00071  * added contour stuff
00072  *
00073  * Revision 1.12  2003/06/03 19:42:20  warmerda
00074  * modified rpc api
00075  *
00076  * Revision 1.11  2003/06/03 17:36:47  warmerda
00077  * Added RPC entry points
00078  *
00079  * Revision 1.10  2003/03/02 05:24:35  warmerda
00080  * added GDALChecksumImage
00081  *
00082  * Revision 1.9  2002/12/09 18:56:10  warmerda
00083  * added missing CPL_DLL
00084  *
00085  * Revision 1.8  2002/12/09 16:08:32  warmerda
00086  * added approximating transformer
00087  *
00088  * Revision 1.7  2002/12/07 22:58:42  warmerda
00089  * added initialization support for simple warper
00090  *
00091  * Revision 1.6  2002/12/07 17:09:38  warmerda
00092  * added order flag to GenImgProjTransformer
00093  *
00094  * Revision 1.5  2002/12/06 21:43:12  warmerda
00095  * tweak prototypes
00096  *
00097  * Revision 1.4  2002/12/05 21:44:35  warmerda
00098  * fixed prototype
00099  *
00100  * Revision 1.3  2002/12/05 05:43:28  warmerda
00101  * added warp/transformer definition
00102  *
00103  * Revision 1.2  2001/02/02 21:19:25  warmerda
00104  * added CPL_DLL for functions
00105  *
00106  * Revision 1.1  2001/01/22 22:30:59  warmerda
00107  * New
00108  */
00109 
00110 #ifndef GDAL_ALG_H_INCLUDED
00111 #define GDAL_ALG_H_INCLUDED
00112 
00119 #include "gdal.h"
00120 #include "cpl_minixml.h"
00121 #include "ogr_api.h"
00122 
00123 CPL_C_START
00124 
00125 int CPL_DLL CPL_STDCALL GDALComputeMedianCutPCT( GDALRasterBandH hRed, 
00126                              GDALRasterBandH hGreen, 
00127                              GDALRasterBandH hBlue, 
00128                              int (*pfnIncludePixel)(int,int,void*),
00129                              int nColors, 
00130                              GDALColorTableH hColorTable,
00131                              GDALProgressFunc pfnProgress, 
00132                              void * pProgressArg );
00133 
00134 int CPL_DLL CPL_STDCALL GDALDitherRGB2PCT( GDALRasterBandH hRed, 
00135                        GDALRasterBandH hGreen, 
00136                        GDALRasterBandH hBlue, 
00137                        GDALRasterBandH hTarget, 
00138                        GDALColorTableH hColorTable, 
00139                        GDALProgressFunc pfnProgress, 
00140                        void * pProgressArg );
00141 
00142 int CPL_DLL CPL_STDCALL GDALChecksumImage( GDALRasterBandH hBand, 
00143                                int nXOff, int nYOff, int nXSize, int nYSize );
00144                                
00145 
00146 /*
00147  * Warp Related.
00148  */
00149 
00150 typedef int 
00151 (*GDALTransformerFunc)( void *pTransformerArg, 
00152                         int bDstToSrc, int nPointCount, 
00153                         double *x, double *y, double *z, int *panSuccess );
00154 
00155 typedef struct {
00156     char szSignature[4];
00157     char *pszClassName;
00158     GDALTransformerFunc pfnTransform;
00159     void (*pfnCleanup)( void * );
00160     CPLXMLNode *(*pfnSerialize)( void * );
00161 } GDALTransformerInfo;
00162 
00163 void CPL_DLL GDALDestroyTransformer( void *pTransformerArg );
00164 
00165 
00166 /* High level transformer for going from image coordinates on one file
00167    to image coordiantes on another, potentially doing reprojection, 
00168    utilizing GCPs or using the geotransform. */
00169 
00170 void CPL_DLL *
00171 GDALCreateGenImgProjTransformer( GDALDatasetH hSrcDS, const char *pszSrcWKT,
00172                                  GDALDatasetH hDstDS, const char *pszDstWKT,
00173                                  int bGCPUseOK, double dfGCPErrorThreshold,
00174                                  int nOrder );
00175 void CPL_DLL GDALSetGenImgProjTransformerDstGeoTransform( void *, 
00176                                                           const double * );
00177 void CPL_DLL GDALDestroyGenImgProjTransformer( void * );
00178 int CPL_DLL GDALGenImgProjTransform( 
00179     void *pTransformArg, int bDstToSrc, int nPointCount,
00180     double *x, double *y, double *z, int *panSuccess );
00181 
00182 /* Geo to geo reprojection transformer. */
00183 void CPL_DLL *
00184 GDALCreateReprojectionTransformer( const char *pszSrcWKT, 
00185                                    const char *pszDstWKT );
00186 void CPL_DLL GDALDestroyReprojectionTransformer( void * );
00187 int CPL_DLL GDALReprojectionTransform( 
00188     void *pTransformArg, int bDstToSrc, int nPointCount,
00189     double *x, double *y, double *z, int *panSuccess );
00190 
00191 /* GCP based transformer ... forward is to georef coordinates */
00192 void CPL_DLL *
00193 GDALCreateGCPTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 
00194                           int nReqOrder, int bReversed );
00195 void CPL_DLL GDALDestroyGCPTransformer( void *pTransformArg );
00196 int CPL_DLL GDALGCPTransform( 
00197     void *pTransformArg, int bDstToSrc, int nPointCount,
00198     double *x, double *y, double *z, int *panSuccess );
00199 
00200 /* Thin Plate Spine transformer ... forward is to georef coordinates */
00201 
00202 void CPL_DLL *
00203 GDALCreateTPSTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 
00204                           int bReversed );
00205 void CPL_DLL GDALDestroyTPSTransformer( void *pTransformArg );
00206 int CPL_DLL GDALTPSTransform( 
00207     void *pTransformArg, int bDstToSrc, int nPointCount,
00208     double *x, double *y, double *z, int *panSuccess );
00209 
00210 /* RPC based transformer ... src is pixel/line/elev, dst is long/lat/elev */
00211 
00212 void CPL_DLL *
00213 GDALCreateRPCTransformer( GDALRPCInfo *psRPC, int bReversed, 
00214                           double dfPixErrThreshold );
00215 void CPL_DLL GDALDestroyRPCTransformer( void *pTransformArg );
00216 int CPL_DLL GDALRPCTransform( 
00217     void *pTransformArg, int bDstToSrc, int nPointCount,
00218     double *x, double *y, double *z, int *panSuccess );
00219 
00220 /* Geolocation transformer */
00221 
00222 void CPL_DLL *
00223 GDALCreateGeoLocTransformer( GDALDatasetH hBaseDS, 
00224                              char **papszGeolocationInfo,
00225                              int bReversed );
00226 void CPL_DLL GDALDestroyGeoLocTransformer( void *pTransformArg );
00227 int CPL_DLL GDALGeoLocTransform( 
00228     void *pTransformArg, int bDstToSrc, int nPointCount,
00229     double *x, double *y, double *z, int *panSuccess );
00230 
00231 /* Approximate transformer */
00232 void CPL_DLL *
00233 GDALCreateApproxTransformer( GDALTransformerFunc pfnRawTransformer, 
00234                              void *pRawTransformerArg, double dfMaxError );
00235 void CPL_DLL GDALApproxTransformerOwnsSubtransformer( void *pCBData, 
00236                                                       int bOwnFlag );
00237 void CPL_DLL GDALDestroyApproxTransformer( void *pApproxArg );
00238 int  CPL_DLL GDALApproxTransform(
00239     void *pTransformArg, int bDstToSrc, int nPointCount,
00240     double *x, double *y, double *z, int *panSuccess );
00241 
00242                       
00243 
00244 
00245 int CPL_DLL CPL_STDCALL
00246 GDALSimpleImageWarp( GDALDatasetH hSrcDS, 
00247                      GDALDatasetH hDstDS, 
00248                      int nBandCount, int *panBandList,
00249                      GDALTransformerFunc pfnTransform,
00250                      void *pTransformArg,
00251                      GDALProgressFunc pfnProgress, 
00252                      void *pProgressArg, 
00253                      char **papszWarpOptions );
00254 
00255 CPLErr CPL_DLL CPL_STDCALL
00256 GDALSuggestedWarpOutput( GDALDatasetH hSrcDS, 
00257                          GDALTransformerFunc pfnTransformer,
00258                          void *pTransformArg,
00259                          double *padfGeoTransformOut, 
00260                          int *pnPixels, int *pnLines );
00261 CPLErr CPL_DLL CPL_STDCALL
00262 GDALSuggestedWarpOutput2( GDALDatasetH hSrcDS, 
00263                           GDALTransformerFunc pfnTransformer,
00264                           void *pTransformArg,
00265                           double *padfGeoTransformOut, 
00266                           int *pnPixels, int *pnLines,
00267                           double *padfExtents, 
00268                           int nOptions );
00269 
00270 CPLXMLNode CPL_DLL *
00271 GDALSerializeTransformer( GDALTransformerFunc pfnFunc, void *pTransformArg );
00272 CPLErr CPL_DLL GDALDeserializeTransformer( CPLXMLNode *psTree, 
00273                                            GDALTransformerFunc *ppfnFunc, 
00274                                            void **ppTransformArg );
00275                                       
00276 
00277 /* -------------------------------------------------------------------- */
00278 /*      Contour Line Generation                                         */
00279 /* -------------------------------------------------------------------- */
00280 
00281 typedef CPLErr (*GDALContourWriter)( double dfLevel, int nPoints,
00282                                      double *padfX, double *padfY, void * );
00283 
00284 typedef void *GDALContourGeneratorH;
00285 
00286 GDALContourGeneratorH CPL_DLL
00287 GDAL_CG_Create( int nWidth, int nHeight, 
00288                 int bNoDataSet, double dfNoDataValue,
00289                 double dfContourInterval, double dfContourBase,
00290                 GDALContourWriter pfnWriter, void *pCBData );
00291 CPLErr CPL_DLL GDAL_CG_FeedLine( GDALContourGeneratorH hCG, 
00292                                  double *padfScanline );
00293 void CPL_DLL GDAL_CG_Destroy( GDALContourGeneratorH hCG );
00294 
00295 typedef struct 
00296 {
00297     void   *hLayer;
00298 
00299     double adfGeoTransform[6];
00300     
00301     int    nElevField;
00302     int    nIDField;
00303     int    nNextID;
00304 } OGRContourWriterInfo;
00305 
00306 CPLErr CPL_DLL 
00307 OGRContourWriter( double, int, double *, double *, void *pInfo );
00308 
00309 CPLErr CPL_DLL
00310 GDALContourGenerate( GDALRasterBandH hBand, 
00311                             double dfContourInterval, double dfContourBase,
00312                             int nFixedLevelCount, double *padfFixedLevels,
00313                             int bUseNoData, double dfNoDataValue, 
00314                             void *hLayer, int iIDField, int iElevField,
00315                             GDALProgressFunc pfnProgress, void *pProgressArg );
00316 
00317 /* -------------------------------------------------------------------- */
00318 /*      Low level rasterizer API.                                       */
00319 /* -------------------------------------------------------------------- */
00320 typedef void (*llScanlineFunc)( void *pCBData, int nY, int nXStart, int nXEnd);
00321 
00322 
00323 void GDALdllImageFilledPolygon(int nRasterXSize, int nRasterYSize, 
00324                                int nPartCount, int *panPartSize, 
00325                                double *padfX, double *padfY,
00326                                llScanlineFunc pfnScanlineFunc, void *pCBData );
00327 
00328 /* -------------------------------------------------------------------- */
00329 /*      High level API - GvShapes burned into GDAL raster.              */
00330 /* -------------------------------------------------------------------- */
00331 
00332 CPLErr CPL_DLL 
00333 GDALRasterizeGeometries( GDALDatasetH hDS, 
00334                          int nBandCount, int *panBandList, 
00335                          int nGeomCount, OGRGeometryH *pahGeometries,
00336                          GDALTransformerFunc pfnTransformer, 
00337                          void *pTransformArg, 
00338                          double *padfGeomBurnValue,
00339                          char **papszOptions,
00340                          GDALProgressFunc pfnProgress, 
00341                          void * pProgressArg );
00342 
00343 CPL_C_END
00344                             
00345 #endif /* ndef GDAL_ALG_H_INCLUDED */

Generated for GDAL by doxygen 1.5.1.