GDAL
|
00001 /****************************************************************************** 00002 * $Id: gdal_alg.h 22655 2011-07-06 18:29:28Z rouault $ 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 #ifndef DOXYGEN_SKIP 00040 #include "gdal.h" 00041 #include "cpl_minixml.h" 00042 #include "ogr_api.h" 00043 #endif 00044 00045 CPL_C_START 00046 00047 int CPL_DLL CPL_STDCALL GDALComputeMedianCutPCT( GDALRasterBandH hRed, 00048 GDALRasterBandH hGreen, 00049 GDALRasterBandH hBlue, 00050 int (*pfnIncludePixel)(int,int,void*), 00051 int nColors, 00052 GDALColorTableH hColorTable, 00053 GDALProgressFunc pfnProgress, 00054 void * pProgressArg ); 00055 00056 int CPL_DLL CPL_STDCALL GDALDitherRGB2PCT( GDALRasterBandH hRed, 00057 GDALRasterBandH hGreen, 00058 GDALRasterBandH hBlue, 00059 GDALRasterBandH hTarget, 00060 GDALColorTableH hColorTable, 00061 GDALProgressFunc pfnProgress, 00062 void * pProgressArg ); 00063 00064 int CPL_DLL CPL_STDCALL GDALChecksumImage( GDALRasterBandH hBand, 00065 int nXOff, int nYOff, int nXSize, int nYSize ); 00066 00067 CPLErr CPL_DLL CPL_STDCALL 00068 GDALComputeProximity( GDALRasterBandH hSrcBand, 00069 GDALRasterBandH hProximityBand, 00070 char **papszOptions, 00071 GDALProgressFunc pfnProgress, 00072 void * pProgressArg ); 00073 00074 CPLErr CPL_DLL CPL_STDCALL 00075 GDALFillNodata( GDALRasterBandH hTargetBand, 00076 GDALRasterBandH hMaskBand, 00077 double dfMaxSearchDist, 00078 int bDeprecatedOption, 00079 int nSmoothingIterations, 00080 char **papszOptions, 00081 GDALProgressFunc pfnProgress, 00082 void * pProgressArg ); 00083 00084 CPLErr CPL_DLL CPL_STDCALL 00085 GDALPolygonize( GDALRasterBandH hSrcBand, 00086 GDALRasterBandH hMaskBand, 00087 OGRLayerH hOutLayer, int iPixValField, 00088 char **papszOptions, 00089 GDALProgressFunc pfnProgress, 00090 void * pProgressArg ); 00091 00092 CPLErr CPL_DLL CPL_STDCALL 00093 GDALFPolygonize( GDALRasterBandH hSrcBand, 00094 GDALRasterBandH hMaskBand, 00095 OGRLayerH hOutLayer, int iPixValField, 00096 char **papszOptions, 00097 GDALProgressFunc pfnProgress, 00098 void * pProgressArg ); 00099 00100 CPLErr CPL_DLL CPL_STDCALL 00101 GDALSieveFilter( GDALRasterBandH hSrcBand, GDALRasterBandH hMaskBand, 00102 GDALRasterBandH hDstBand, 00103 int nSizeThreshold, int nConnectedness, 00104 char **papszOptions, 00105 GDALProgressFunc pfnProgress, 00106 void * pProgressArg ); 00107 00108 /* 00109 * Warp Related. 00110 */ 00111 00112 typedef int 00113 (*GDALTransformerFunc)( void *pTransformerArg, 00114 int bDstToSrc, int nPointCount, 00115 double *x, double *y, double *z, int *panSuccess ); 00116 00117 typedef struct { 00118 char szSignature[4]; 00119 const char *pszClassName; 00120 GDALTransformerFunc pfnTransform; 00121 void (*pfnCleanup)( void * ); 00122 CPLXMLNode *(*pfnSerialize)( void * ); 00123 } GDALTransformerInfo; 00124 00125 void CPL_DLL GDALDestroyTransformer( void *pTransformerArg ); 00126 int CPL_DLL GDALUseTransformer( void *pTranformerArg, 00127 int bDstToSrc, int nPointCount, 00128 double *x, double *y, double *z, 00129 int *panSuccess ); 00130 00131 /* High level transformer for going from image coordinates on one file 00132 to image coordiantes on another, potentially doing reprojection, 00133 utilizing GCPs or using the geotransform. */ 00134 00135 void CPL_DLL * 00136 GDALCreateGenImgProjTransformer( GDALDatasetH hSrcDS, const char *pszSrcWKT, 00137 GDALDatasetH hDstDS, const char *pszDstWKT, 00138 int bGCPUseOK, double dfGCPErrorThreshold, 00139 int nOrder ); 00140 void CPL_DLL * 00141 GDALCreateGenImgProjTransformer2( GDALDatasetH hSrcDS, GDALDatasetH hDstDS, 00142 char **papszOptions ); 00143 void CPL_DLL * 00144 GDALCreateGenImgProjTransformer3( const char *pszSrcWKT, 00145 const double *padfSrcGeoTransform, 00146 const char *pszDstWKT, 00147 const double *padfDstGeoTransform ); 00148 void CPL_DLL GDALSetGenImgProjTransformerDstGeoTransform( void *, 00149 const double * ); 00150 void CPL_DLL GDALDestroyGenImgProjTransformer( void * ); 00151 int CPL_DLL GDALGenImgProjTransform( 00152 void *pTransformArg, int bDstToSrc, int nPointCount, 00153 double *x, double *y, double *z, int *panSuccess ); 00154 00155 /* Geo to geo reprojection transformer. */ 00156 void CPL_DLL * 00157 GDALCreateReprojectionTransformer( const char *pszSrcWKT, 00158 const char *pszDstWKT ); 00159 void CPL_DLL GDALDestroyReprojectionTransformer( void * ); 00160 int CPL_DLL GDALReprojectionTransform( 00161 void *pTransformArg, int bDstToSrc, int nPointCount, 00162 double *x, double *y, double *z, int *panSuccess ); 00163 00164 /* GCP based transformer ... forward is to georef coordinates */ 00165 void CPL_DLL * 00166 GDALCreateGCPTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 00167 int nReqOrder, int bReversed ); 00168 00169 /* GCP based transformer with refinement of the GCPs ... forward is to georef coordinates */ 00170 void CPL_DLL * 00171 GDALCreateGCPRefineTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 00172 int nReqOrder, int bReversed, double tolerance, int minimumGcps); 00173 00174 void CPL_DLL GDALDestroyGCPTransformer( void *pTransformArg ); 00175 int CPL_DLL GDALGCPTransform( 00176 void *pTransformArg, int bDstToSrc, int nPointCount, 00177 double *x, double *y, double *z, int *panSuccess ); 00178 00179 /* Thin Plate Spine transformer ... forward is to georef coordinates */ 00180 00181 void CPL_DLL * 00182 GDALCreateTPSTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 00183 int bReversed ); 00184 void CPL_DLL GDALDestroyTPSTransformer( void *pTransformArg ); 00185 int CPL_DLL GDALTPSTransform( 00186 void *pTransformArg, int bDstToSrc, int nPointCount, 00187 double *x, double *y, double *z, int *panSuccess ); 00188 00189 /* RPC based transformer ... src is pixel/line/elev, dst is long/lat/elev */ 00190 00191 void CPL_DLL * 00192 GDALCreateRPCTransformer( GDALRPCInfo *psRPC, int bReversed, 00193 double dfPixErrThreshold, 00194 char **papszOptions ); 00195 void CPL_DLL GDALDestroyRPCTransformer( void *pTransformArg ); 00196 int CPL_DLL GDALRPCTransform( 00197 void *pTransformArg, int bDstToSrc, int nPointCount, 00198 double *x, double *y, double *z, int *panSuccess ); 00199 00200 /* Geolocation transformer */ 00201 00202 void CPL_DLL * 00203 GDALCreateGeoLocTransformer( GDALDatasetH hBaseDS, 00204 char **papszGeolocationInfo, 00205 int bReversed ); 00206 void CPL_DLL GDALDestroyGeoLocTransformer( void *pTransformArg ); 00207 int CPL_DLL GDALGeoLocTransform( 00208 void *pTransformArg, int bDstToSrc, int nPointCount, 00209 double *x, double *y, double *z, int *panSuccess ); 00210 00211 /* Approximate transformer */ 00212 void CPL_DLL * 00213 GDALCreateApproxTransformer( GDALTransformerFunc pfnRawTransformer, 00214 void *pRawTransformerArg, double dfMaxError ); 00215 void CPL_DLL GDALApproxTransformerOwnsSubtransformer( void *pCBData, 00216 int bOwnFlag ); 00217 void CPL_DLL GDALDestroyApproxTransformer( void *pApproxArg ); 00218 int CPL_DLL GDALApproxTransform( 00219 void *pTransformArg, int bDstToSrc, int nPointCount, 00220 double *x, double *y, double *z, int *panSuccess ); 00221 00222 00223 00224 00225 int CPL_DLL CPL_STDCALL 00226 GDALSimpleImageWarp( GDALDatasetH hSrcDS, 00227 GDALDatasetH hDstDS, 00228 int nBandCount, int *panBandList, 00229 GDALTransformerFunc pfnTransform, 00230 void *pTransformArg, 00231 GDALProgressFunc pfnProgress, 00232 void *pProgressArg, 00233 char **papszWarpOptions ); 00234 00235 CPLErr CPL_DLL CPL_STDCALL 00236 GDALSuggestedWarpOutput( GDALDatasetH hSrcDS, 00237 GDALTransformerFunc pfnTransformer, 00238 void *pTransformArg, 00239 double *padfGeoTransformOut, 00240 int *pnPixels, int *pnLines ); 00241 CPLErr CPL_DLL CPL_STDCALL 00242 GDALSuggestedWarpOutput2( GDALDatasetH hSrcDS, 00243 GDALTransformerFunc pfnTransformer, 00244 void *pTransformArg, 00245 double *padfGeoTransformOut, 00246 int *pnPixels, int *pnLines, 00247 double *padfExtents, 00248 int nOptions ); 00249 00250 CPLXMLNode CPL_DLL * 00251 GDALSerializeTransformer( GDALTransformerFunc pfnFunc, void *pTransformArg ); 00252 CPLErr CPL_DLL GDALDeserializeTransformer( CPLXMLNode *psTree, 00253 GDALTransformerFunc *ppfnFunc, 00254 void **ppTransformArg ); 00255 00256 00257 /* -------------------------------------------------------------------- */ 00258 /* Contour Line Generation */ 00259 /* -------------------------------------------------------------------- */ 00260 00261 typedef CPLErr (*GDALContourWriter)( double dfLevel, int nPoints, 00262 double *padfX, double *padfY, void * ); 00263 00264 typedef void *GDALContourGeneratorH; 00265 00266 GDALContourGeneratorH CPL_DLL 00267 GDAL_CG_Create( int nWidth, int nHeight, 00268 int bNoDataSet, double dfNoDataValue, 00269 double dfContourInterval, double dfContourBase, 00270 GDALContourWriter pfnWriter, void *pCBData ); 00271 CPLErr CPL_DLL GDAL_CG_FeedLine( GDALContourGeneratorH hCG, 00272 double *padfScanline ); 00273 void CPL_DLL GDAL_CG_Destroy( GDALContourGeneratorH hCG ); 00274 00275 typedef struct 00276 { 00277 void *hLayer; 00278 00279 double adfGeoTransform[6]; 00280 00281 int nElevField; 00282 int nIDField; 00283 int nNextID; 00284 } OGRContourWriterInfo; 00285 00286 CPLErr CPL_DLL 00287 OGRContourWriter( double, int, double *, double *, void *pInfo ); 00288 00289 CPLErr CPL_DLL 00290 GDALContourGenerate( GDALRasterBandH hBand, 00291 double dfContourInterval, double dfContourBase, 00292 int nFixedLevelCount, double *padfFixedLevels, 00293 int bUseNoData, double dfNoDataValue, 00294 void *hLayer, int iIDField, int iElevField, 00295 GDALProgressFunc pfnProgress, void *pProgressArg ); 00296 00297 /************************************************************************/ 00298 /* Rasterizer API - geometries burned into GDAL raster. */ 00299 /************************************************************************/ 00300 00301 CPLErr CPL_DLL 00302 GDALRasterizeGeometries( GDALDatasetH hDS, 00303 int nBandCount, int *panBandList, 00304 int nGeomCount, OGRGeometryH *pahGeometries, 00305 GDALTransformerFunc pfnTransformer, 00306 void *pTransformArg, 00307 double *padfGeomBurnValue, 00308 char **papszOptions, 00309 GDALProgressFunc pfnProgress, 00310 void * pProgressArg ); 00311 CPLErr CPL_DLL 00312 GDALRasterizeLayers( GDALDatasetH hDS, 00313 int nBandCount, int *panBandList, 00314 int nLayerCount, OGRLayerH *pahLayers, 00315 GDALTransformerFunc pfnTransformer, 00316 void *pTransformArg, 00317 double *padfLayerBurnValues, 00318 char **papszOptions, 00319 GDALProgressFunc pfnProgress, 00320 void *pProgressArg ); 00321 00322 CPLErr CPL_DLL 00323 GDALRasterizeLayersBuf( void *pData, int nBufXSize, int nBufYSize, 00324 GDALDataType eBufType, int nPixelSpace, int nLineSpace, 00325 int nLayerCount, OGRLayerH *pahLayers, 00326 const char *pszDstProjection, 00327 double *padfDstGeoTransform, 00328 GDALTransformerFunc pfnTransformer, 00329 void *pTransformArg, double dfBurnValue, 00330 char **papszOptions, GDALProgressFunc pfnProgress, 00331 void *pProgressArg ); 00332 00333 00334 /************************************************************************/ 00335 /* Gridding interface. */ 00336 /************************************************************************/ 00337 00339 typedef enum { GGA_InverseDistanceToAPower = 1, GGA_MovingAverage = 2, GGA_NearestNeighbor = 3, GGA_MetricMinimum = 4, GGA_MetricMaximum = 5, GGA_MetricRange = 6, GGA_MetricCount = 7, GGA_MetricAverageDistance = 8, 00349 GGA_MetricAverageDistancePts = 9 00350 } GDALGridAlgorithm; 00351 00353 typedef struct 00354 { 00356 double dfPower; 00358 double dfSmoothing; 00360 double dfAnisotropyRatio; 00362 double dfAnisotropyAngle; 00364 double dfRadius1; 00366 double dfRadius2; 00371 double dfAngle; 00378 GUInt32 nMaxPoints; 00384 GUInt32 nMinPoints; 00386 double dfNoDataValue; 00387 } GDALGridInverseDistanceToAPowerOptions; 00388 00390 typedef struct 00391 { 00393 double dfRadius1; 00395 double dfRadius2; 00400 double dfAngle; 00406 GUInt32 nMinPoints; 00408 double dfNoDataValue; 00409 } GDALGridMovingAverageOptions; 00410 00412 typedef struct 00413 { 00415 double dfRadius1; 00417 double dfRadius2; 00422 double dfAngle; 00424 double dfNoDataValue; 00425 } GDALGridNearestNeighborOptions; 00426 00428 typedef struct 00429 { 00431 double dfRadius1; 00433 double dfRadius2; 00438 double dfAngle; 00444 GUInt32 nMinPoints; 00446 double dfNoDataValue; 00447 } GDALGridDataMetricsOptions; 00448 00449 CPLErr CPL_DLL 00450 GDALGridCreate( GDALGridAlgorithm, const void *, GUInt32, 00451 const double *, const double *, const double *, 00452 double, double, double, double, 00453 GUInt32, GUInt32, GDALDataType, void *, 00454 GDALProgressFunc, void *); 00455 CPL_C_END 00456 00457 #endif /* ndef GDAL_ALG_H_INCLUDED */