GDAL

gdalalg_raster_fill_nodata.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: "gdal raster fill-nodata" standalone command
5 * Author: Alessandro Pasotti <elpaso at itopen dot it>
6 *
7 ******************************************************************************
8 * Copyright (c) 2025, Alessandro Pasotti <elpaso at itopen dot it>
9 *
10 * SPDX-License-Identifier: MIT
11 ****************************************************************************/
12
13#ifndef GDALALG_RASTER_FILL_NODATA_INCLUDED
14#define GDALALG_RASTER_FILL_NODATA_INCLUDED
15
16#include "gdalalg_raster_pipeline.h"
17
19
20/************************************************************************/
21/* GDALRasterFillNodataAlgorithm */
22/************************************************************************/
23
24 class GDALRasterFillNodataAlgorithm /* non final */
25 : public GDALRasterPipelineNonNativelyStreamingAlgorithm
26{
27 public:
28 static constexpr const char *NAME = "fill-nodata";
29 static constexpr const char *DESCRIPTION =
30 "Fill nodata raster regions by interpolation from edges.";
31 static constexpr const char *HELP_URL =
32 "/programs/gdal_raster_fill_nodata.html";
33
34 explicit GDALRasterFillNodataAlgorithm(
35 bool standaloneStep = false) noexcept;
36
37 private:
38 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
39
40 // The maximum distance (in pixels) that the algorithm will search out for values to interpolate. The default is 100 pixels.
41 int m_maxDistance = 100;
42 // The number of 3x3 average filter smoothing iterations to run after the interpolation to dampen artifacts. The default is zero smoothing iterations.
43 int m_smoothingIterations = 0;
44 // The band to operate on, by default the first band is operated on.
45 int m_band = 1;
46 // Use the first band of the specified file as a validity mask (zero is invalid, non-zero is valid).
47 GDALArgDatasetValue m_maskDataset{};
48 // By default, pixels are interpolated using an inverse distance weighting (inv_dist). It is also possible to choose a nearest neighbour (nearest) strategy.
49 std::string m_strategy = "invdist";
50};
51
52/************************************************************************/
53/* GDALRasterFillNodataAlgorithmStandalone */
54/************************************************************************/
55
56 class GDALRasterFillNodataAlgorithmStandalone final
57 : public GDALRasterFillNodataAlgorithm
58{
59 public:
60 GDALRasterFillNodataAlgorithmStandalone()
61 : GDALRasterFillNodataAlgorithm(/* standaloneStep = */ true)
62 {
63 }
64
65 ~GDALRasterFillNodataAlgorithmStandalone() override;
66};
67
69
70#endif /* GDALALG_RASTER_FILLNODATA_INCLUDED */
GDALArgDatasetValue
Value for an argument that points to a GDALDataset.
Definition gdalalgorithm_cpp.h:149