LCOV - code coverage report
Current view: top level - apps - gdalalg_raster_neighbors.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 6 6 100.0 %
Date: 2025-10-01 17:07:58 Functions: 4 4 100.0 %

          Line data    Source code
       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        1748 :     static std::vector<std::string> GetAliasesStatic()
      36             :     {
      37        3496 :         return {"neighbours"};
      38             :     }
      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          80 : class GDALRasterNeighborsAlgorithmStandalone final
      56             :     : public GDALRasterNeighborsAlgorithm
      57             : {
      58             :   public:
      59          40 :     GDALRasterNeighborsAlgorithmStandalone()
      60          40 :         : GDALRasterNeighborsAlgorithm(/* standaloneStep = */ true)
      61             :     {
      62          40 :     }
      63             : 
      64             :     ~GDALRasterNeighborsAlgorithmStandalone() override;
      65             : };
      66             : 
      67             : //! @endcond
      68             : 
      69             : #endif /* GDALALG_RASTER_CALC_INCLUDED */

Generated by: LCOV version 1.14