GDAL
|
00001 /****************************************************************************** 00002 * $Id: gdal_alg.h 27850 2014-10-12 16:58:09Z 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 * Copyright (c) 2008-2012, Even Rouault <even dot rouault at mines-paris dot org> 00011 * 00012 * Permission is hereby granted, free of charge, to any person obtaining a 00013 * copy of this software and associated documentation files (the "Software"), 00014 * to deal in the Software without restriction, including without limitation 00015 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00016 * and/or sell copies of the Software, and to permit persons to whom the 00017 * Software is furnished to do so, subject to the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be included 00020 * in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00023 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00024 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00025 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00026 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00027 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00028 * DEALINGS IN THE SOFTWARE. 00029 ****************************************************************************/ 00030 00031 #ifndef GDAL_ALG_H_INCLUDED 00032 #define GDAL_ALG_H_INCLUDED 00033 00040 #ifndef DOXYGEN_SKIP 00041 #include "gdal.h" 00042 #include "cpl_minixml.h" 00043 #include "ogr_api.h" 00044 #endif 00045 00046 CPL_C_START 00047 00048 int CPL_DLL CPL_STDCALL GDALComputeMedianCutPCT( GDALRasterBandH hRed, 00049 GDALRasterBandH hGreen, 00050 GDALRasterBandH hBlue, 00051 int (*pfnIncludePixel)(int,int,void*), 00052 int nColors, 00053 GDALColorTableH hColorTable, 00054 GDALProgressFunc pfnProgress, 00055 void * pProgressArg ); 00056 00057 int CPL_DLL CPL_STDCALL GDALDitherRGB2PCT( GDALRasterBandH hRed, 00058 GDALRasterBandH hGreen, 00059 GDALRasterBandH hBlue, 00060 GDALRasterBandH hTarget, 00061 GDALColorTableH hColorTable, 00062 GDALProgressFunc pfnProgress, 00063 void * pProgressArg ); 00064 00065 int CPL_DLL CPL_STDCALL GDALChecksumImage( GDALRasterBandH hBand, 00066 int nXOff, int nYOff, int nXSize, int nYSize ); 00067 00068 CPLErr CPL_DLL CPL_STDCALL 00069 GDALComputeProximity( GDALRasterBandH hSrcBand, 00070 GDALRasterBandH hProximityBand, 00071 char **papszOptions, 00072 GDALProgressFunc pfnProgress, 00073 void * pProgressArg ); 00074 00075 CPLErr CPL_DLL CPL_STDCALL 00076 GDALFillNodata( GDALRasterBandH hTargetBand, 00077 GDALRasterBandH hMaskBand, 00078 double dfMaxSearchDist, 00079 int bDeprecatedOption, 00080 int nSmoothingIterations, 00081 char **papszOptions, 00082 GDALProgressFunc pfnProgress, 00083 void * pProgressArg ); 00084 00085 CPLErr CPL_DLL CPL_STDCALL 00086 GDALPolygonize( GDALRasterBandH hSrcBand, 00087 GDALRasterBandH hMaskBand, 00088 OGRLayerH hOutLayer, int iPixValField, 00089 char **papszOptions, 00090 GDALProgressFunc pfnProgress, 00091 void * pProgressArg ); 00092 00093 CPLErr CPL_DLL CPL_STDCALL 00094 GDALFPolygonize( GDALRasterBandH hSrcBand, 00095 GDALRasterBandH hMaskBand, 00096 OGRLayerH hOutLayer, int iPixValField, 00097 char **papszOptions, 00098 GDALProgressFunc pfnProgress, 00099 void * pProgressArg ); 00100 00101 CPLErr CPL_DLL CPL_STDCALL 00102 GDALSieveFilter( GDALRasterBandH hSrcBand, GDALRasterBandH hMaskBand, 00103 GDALRasterBandH hDstBand, 00104 int nSizeThreshold, int nConnectedness, 00105 char **papszOptions, 00106 GDALProgressFunc pfnProgress, 00107 void * pProgressArg ); 00108 00109 /* 00110 * Warp Related. 00111 */ 00112 00113 typedef int 00114 (*GDALTransformerFunc)( void *pTransformerArg, 00115 int bDstToSrc, int nPointCount, 00116 double *x, double *y, double *z, int *panSuccess ); 00117 00118 #define GDAL_GTI2_SIGNATURE "GTI2" 00119 00120 typedef struct { 00121 GByte abySignature[4]; 00122 const char *pszClassName; 00123 GDALTransformerFunc pfnTransform; 00124 void (*pfnCleanup)( void * pTransformerArg ); 00125 CPLXMLNode *(*pfnSerialize)( void * pTransformerArg ); 00126 void* (*pfnCreateSimilar)( void* pTransformerArg, double dfSrcRatioX, double dfSrcRatioY ); 00127 } GDALTransformerInfo; 00128 00129 void CPL_DLL GDALDestroyTransformer( void *pTransformerArg ); 00130 int CPL_DLL GDALUseTransformer( void *pTranformerArg, 00131 int bDstToSrc, int nPointCount, 00132 double *x, double *y, double *z, 00133 int *panSuccess ); 00134 void* GDALCreateSimilarTransformer( void* psTransformerArg, double dfSrcRatioX, double dfSrcRatioY ); 00135 00136 00137 /* High level transformer for going from image coordinates on one file 00138 to image coordiantes on another, potentially doing reprojection, 00139 utilizing GCPs or using the geotransform. */ 00140 00141 void CPL_DLL * 00142 GDALCreateGenImgProjTransformer( GDALDatasetH hSrcDS, const char *pszSrcWKT, 00143 GDALDatasetH hDstDS, const char *pszDstWKT, 00144 int bGCPUseOK, double dfGCPErrorThreshold, 00145 int nOrder ); 00146 void CPL_DLL * 00147 GDALCreateGenImgProjTransformer2( GDALDatasetH hSrcDS, GDALDatasetH hDstDS, 00148 char **papszOptions ); 00149 void CPL_DLL * 00150 GDALCreateGenImgProjTransformer3( const char *pszSrcWKT, 00151 const double *padfSrcGeoTransform, 00152 const char *pszDstWKT, 00153 const double *padfDstGeoTransform ); 00154 void CPL_DLL GDALSetGenImgProjTransformerDstGeoTransform( void *, 00155 const double * ); 00156 void CPL_DLL GDALDestroyGenImgProjTransformer( void * ); 00157 int CPL_DLL GDALGenImgProjTransform( 00158 void *pTransformArg, int bDstToSrc, int nPointCount, 00159 double *x, double *y, double *z, int *panSuccess ); 00160 00161 void GDALSetTransformerDstGeoTransform( void *, const double * ); 00162 00163 /* Geo to geo reprojection transformer. */ 00164 void CPL_DLL * 00165 GDALCreateReprojectionTransformer( const char *pszSrcWKT, 00166 const char *pszDstWKT ); 00167 void CPL_DLL GDALDestroyReprojectionTransformer( void * ); 00168 int CPL_DLL GDALReprojectionTransform( 00169 void *pTransformArg, int bDstToSrc, int nPointCount, 00170 double *x, double *y, double *z, int *panSuccess ); 00171 00172 /* GCP based transformer ... forward is to georef coordinates */ 00173 void CPL_DLL * 00174 GDALCreateGCPTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 00175 int nReqOrder, int bReversed ); 00176 00177 /* GCP based transformer with refinement of the GCPs ... forward is to georef coordinates */ 00178 void CPL_DLL * 00179 GDALCreateGCPRefineTransformer( int nGCPCount, const GDAL_GCP *pasGCPList, 00180 int nReqOrder, int bReversed, double tolerance, int minimumGcps); 00181 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 char CPL_DLL ** RPCInfoToMD( GDALRPCInfo *psRPCInfo ); 00198 00199 /* RPC based transformer ... src is pixel/line/elev, dst is long/lat/elev */ 00200 00201 void CPL_DLL * 00202 GDALCreateRPCTransformer( GDALRPCInfo *psRPC, int bReversed, 00203 double dfPixErrThreshold, 00204 char **papszOptions ); 00205 void CPL_DLL GDALDestroyRPCTransformer( void *pTransformArg ); 00206 int CPL_DLL GDALRPCTransform( 00207 void *pTransformArg, int bDstToSrc, int nPointCount, 00208 double *x, double *y, double *z, int *panSuccess ); 00209 00210 /* Geolocation transformer */ 00211 00212 void CPL_DLL * 00213 GDALCreateGeoLocTransformer( GDALDatasetH hBaseDS, 00214 char **papszGeolocationInfo, 00215 int bReversed ); 00216 void CPL_DLL GDALDestroyGeoLocTransformer( void *pTransformArg ); 00217 int CPL_DLL GDALGeoLocTransform( 00218 void *pTransformArg, int bDstToSrc, int nPointCount, 00219 double *x, double *y, double *z, int *panSuccess ); 00220 00221 /* Approximate transformer */ 00222 void CPL_DLL * 00223 GDALCreateApproxTransformer( GDALTransformerFunc pfnRawTransformer, 00224 void *pRawTransformerArg, double dfMaxError ); 00225 void CPL_DLL GDALApproxTransformerOwnsSubtransformer( void *pCBData, 00226 int bOwnFlag ); 00227 void CPL_DLL GDALDestroyApproxTransformer( void *pApproxArg ); 00228 int CPL_DLL GDALApproxTransform( 00229 void *pTransformArg, int bDstToSrc, int nPointCount, 00230 double *x, double *y, double *z, int *panSuccess ); 00231 00232 00233 00234 00235 int CPL_DLL CPL_STDCALL 00236 GDALSimpleImageWarp( GDALDatasetH hSrcDS, 00237 GDALDatasetH hDstDS, 00238 int nBandCount, int *panBandList, 00239 GDALTransformerFunc pfnTransform, 00240 void *pTransformArg, 00241 GDALProgressFunc pfnProgress, 00242 void *pProgressArg, 00243 char **papszWarpOptions ); 00244 00245 CPLErr CPL_DLL CPL_STDCALL 00246 GDALSuggestedWarpOutput( GDALDatasetH hSrcDS, 00247 GDALTransformerFunc pfnTransformer, 00248 void *pTransformArg, 00249 double *padfGeoTransformOut, 00250 int *pnPixels, int *pnLines ); 00251 CPLErr CPL_DLL CPL_STDCALL 00252 GDALSuggestedWarpOutput2( GDALDatasetH hSrcDS, 00253 GDALTransformerFunc pfnTransformer, 00254 void *pTransformArg, 00255 double *padfGeoTransformOut, 00256 int *pnPixels, int *pnLines, 00257 double *padfExtents, 00258 int nOptions ); 00259 00260 CPLXMLNode CPL_DLL * 00261 GDALSerializeTransformer( GDALTransformerFunc pfnFunc, void *pTransformArg ); 00262 CPLErr CPL_DLL GDALDeserializeTransformer( CPLXMLNode *psTree, 00263 GDALTransformerFunc *ppfnFunc, 00264 void **ppTransformArg ); 00265 00266 CPLErr CPL_DLL 00267 GDALTransformGeolocations( GDALRasterBandH hXBand, 00268 GDALRasterBandH hYBand, 00269 GDALRasterBandH hZBand, 00270 GDALTransformerFunc pfnTransformer, 00271 void *pTransformArg, 00272 GDALProgressFunc pfnProgress, 00273 void *pProgressArg, 00274 char **papszOptions ); 00275 00276 /* -------------------------------------------------------------------- */ 00277 /* Contour Line Generation */ 00278 /* -------------------------------------------------------------------- */ 00279 00280 typedef CPLErr (*GDALContourWriter)( double dfLevel, int nPoints, 00281 double *padfX, double *padfY, void * ); 00282 00283 typedef void *GDALContourGeneratorH; 00284 00285 GDALContourGeneratorH CPL_DLL 00286 GDAL_CG_Create( int nWidth, int nHeight, 00287 int bNoDataSet, double dfNoDataValue, 00288 double dfContourInterval, double dfContourBase, 00289 GDALContourWriter pfnWriter, void *pCBData ); 00290 CPLErr CPL_DLL GDAL_CG_FeedLine( GDALContourGeneratorH hCG, 00291 double *padfScanline ); 00292 void CPL_DLL GDAL_CG_Destroy( GDALContourGeneratorH hCG ); 00293 00294 typedef struct 00295 { 00296 void *hLayer; 00297 00298 double adfGeoTransform[6]; 00299 00300 int nElevField; 00301 int nIDField; 00302 int nNextID; 00303 } OGRContourWriterInfo; 00304 00305 CPLErr CPL_DLL 00306 OGRContourWriter( double, int, double *, double *, void *pInfo ); 00307 00308 CPLErr CPL_DLL 00309 GDALContourGenerate( GDALRasterBandH hBand, 00310 double dfContourInterval, double dfContourBase, 00311 int nFixedLevelCount, double *padfFixedLevels, 00312 int bUseNoData, double dfNoDataValue, 00313 void *hLayer, int iIDField, int iElevField, 00314 GDALProgressFunc pfnProgress, void *pProgressArg ); 00315 00316 /************************************************************************/ 00317 /* Rasterizer API - geometries burned into GDAL raster. */ 00318 /************************************************************************/ 00319 00320 CPLErr CPL_DLL 00321 GDALRasterizeGeometries( GDALDatasetH hDS, 00322 int nBandCount, int *panBandList, 00323 int nGeomCount, OGRGeometryH *pahGeometries, 00324 GDALTransformerFunc pfnTransformer, 00325 void *pTransformArg, 00326 double *padfGeomBurnValue, 00327 char **papszOptions, 00328 GDALProgressFunc pfnProgress, 00329 void * pProgressArg ); 00330 CPLErr CPL_DLL 00331 GDALRasterizeLayers( GDALDatasetH hDS, 00332 int nBandCount, int *panBandList, 00333 int nLayerCount, OGRLayerH *pahLayers, 00334 GDALTransformerFunc pfnTransformer, 00335 void *pTransformArg, 00336 double *padfLayerBurnValues, 00337 char **papszOptions, 00338 GDALProgressFunc pfnProgress, 00339 void *pProgressArg ); 00340 00341 CPLErr CPL_DLL 00342 GDALRasterizeLayersBuf( void *pData, int nBufXSize, int nBufYSize, 00343 GDALDataType eBufType, int nPixelSpace, int nLineSpace, 00344 int nLayerCount, OGRLayerH *pahLayers, 00345 const char *pszDstProjection, 00346 double *padfDstGeoTransform, 00347 GDALTransformerFunc pfnTransformer, 00348 void *pTransformArg, double dfBurnValue, 00349 char **papszOptions, GDALProgressFunc pfnProgress, 00350 void *pProgressArg ); 00351 00352 00353 /************************************************************************/ 00354 /* Gridding interface. */ 00355 /************************************************************************/ 00356 00358 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, 00368 GGA_MetricAverageDistancePts = 9 00369 } GDALGridAlgorithm; 00370 00372 typedef struct 00373 { 00375 double dfPower; 00377 double dfSmoothing; 00379 double dfAnisotropyRatio; 00381 double dfAnisotropyAngle; 00383 double dfRadius1; 00385 double dfRadius2; 00390 double dfAngle; 00397 GUInt32 nMaxPoints; 00403 GUInt32 nMinPoints; 00405 double dfNoDataValue; 00406 } GDALGridInverseDistanceToAPowerOptions; 00407 00409 typedef struct 00410 { 00412 double dfRadius1; 00414 double dfRadius2; 00419 double dfAngle; 00425 GUInt32 nMinPoints; 00427 double dfNoDataValue; 00428 } GDALGridMovingAverageOptions; 00429 00431 typedef struct 00432 { 00434 double dfRadius1; 00436 double dfRadius2; 00441 double dfAngle; 00443 double dfNoDataValue; 00444 } GDALGridNearestNeighborOptions; 00445 00447 typedef struct 00448 { 00450 double dfRadius1; 00452 double dfRadius2; 00457 double dfAngle; 00463 GUInt32 nMinPoints; 00465 double dfNoDataValue; 00466 } GDALGridDataMetricsOptions; 00467 00468 CPLErr CPL_DLL 00469 GDALGridCreate( GDALGridAlgorithm, const void *, GUInt32, 00470 const double *, const double *, const double *, 00471 double, double, double, double, 00472 GUInt32, GUInt32, GDALDataType, void *, 00473 GDALProgressFunc, void *); 00474 00475 GDAL_GCP CPL_DLL * 00476 GDALComputeMatchingPoints( GDALDatasetH hFirstImage, 00477 GDALDatasetH hSecondImage, 00478 char **papszOptions, 00479 int *pnGCPCount ); 00480 CPL_C_END 00481 00482 #endif /* ndef GDAL_ALG_H_INCLUDED */