/src/gdal/apps/gdalalg_raster_neighbors.h
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: GDAL |
4 | | * Purpose: "neighbors" step of "raster pipeline" |
5 | | * Author: Even Rouault <even dot rouault at spatialys.com> |
6 | | * |
7 | | ****************************************************************************** |
8 | | * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com> |
9 | | * |
10 | | * SPDX-License-Identifier: MIT |
11 | | ****************************************************************************/ |
12 | | |
13 | | #ifndef GDALALG_RASTER_NEIGHBORS_INCLUDED |
14 | | #define GDALALG_RASTER_NEIGHBORS_INCLUDED |
15 | | |
16 | | #include "gdalalg_raster_pipeline.h" |
17 | | |
18 | | //! @cond Doxygen_Suppress |
19 | | |
20 | | /************************************************************************/ |
21 | | /* GDALRasterNeighborsAlgorithm */ |
22 | | /************************************************************************/ |
23 | | |
24 | | class GDALRasterNeighborsAlgorithm : public GDALRasterPipelineStepAlgorithm |
25 | | { |
26 | | public: |
27 | | explicit GDALRasterNeighborsAlgorithm(bool standaloneStep = false) noexcept; |
28 | | |
29 | | static constexpr const char *NAME = "neighbors"; |
30 | | static constexpr const char *DESCRIPTION = |
31 | | "Compute the value of each pixel from its neighbors (focal statistics)"; |
32 | | static constexpr const char *HELP_URL = |
33 | | "/programs/gdal_raster_neighbors.html"; |
34 | | |
35 | | static std::vector<std::string> GetAliasesStatic() |
36 | 0 | { |
37 | 0 | return {"neighbours"}; |
38 | 0 | } |
39 | | |
40 | | private: |
41 | | bool RunStep(GDALPipelineStepRunContext &ctxt) override; |
42 | | |
43 | | int m_band = 0; |
44 | | std::vector<std::string> m_method{}; |
45 | | int m_size = 0; |
46 | | std::vector<std::string> m_kernel{}; |
47 | | std::string m_type{}; |
48 | | std::string m_nodata{}; |
49 | | }; |
50 | | |
51 | | /************************************************************************/ |
52 | | /* GDALRasterNeighborsAlgorithmStandalone */ |
53 | | /************************************************************************/ |
54 | | |
55 | | class GDALRasterNeighborsAlgorithmStandalone final |
56 | | : public GDALRasterNeighborsAlgorithm |
57 | | { |
58 | | public: |
59 | | GDALRasterNeighborsAlgorithmStandalone() |
60 | 0 | : GDALRasterNeighborsAlgorithm(/* standaloneStep = */ true) |
61 | 0 | { |
62 | 0 | } |
63 | | |
64 | | ~GDALRasterNeighborsAlgorithmStandalone() override; |
65 | | }; |
66 | | |
67 | | //! @endcond |
68 | | |
69 | | #endif /* GDALALG_RASTER_CALC_INCLUDED */ |