gdal_alg.h

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

Generated on Sun Jul 2 22:18:26 2006 for GDAL by  doxygen 1.4.6