gdal_alg.h

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

Generated on Mon Jan 9 18:03:35 2006 for GDAL by  doxygen 1.4.6