gdal_alg.h

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

Generated for GDAL by doxygen 1.5.1.