Coverage Report

Created: 2026-07-25 06:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/apps/gdalalg_raster_clean_collar.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  GDAL
4
 * Purpose:  gdal "raster clean-collar" subcommand
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_CLEAN_COLLAR_INCLUDED
14
#define GDALALG_RASTER_CLEAN_COLLAR_INCLUDED
15
16
#include "gdalrasterpipelinenonnativelystreamingalgorithm.h"
17
18
//! @cond Doxygen_Suppress
19
20
/************************************************************************/
21
/*                    GDALRasterCleanCollarAlgorithm                    */
22
/************************************************************************/
23
24
class GDALRasterCleanCollarAlgorithm /* non final */
25
    : public GDALRasterPipelineNonNativelyStreamingAlgorithm
26
{
27
  public:
28
    static constexpr const char *NAME = "clean-collar";
29
    static constexpr const char *DESCRIPTION =
30
        "Clean the collar of a raster dataset, removing noise.";
31
    static constexpr const char *HELP_URL =
32
        "/programs/gdal_raster_clean_collar.html";
33
34
    explicit GDALRasterCleanCollarAlgorithm(bool standaloneStep = false);
35
36
  private:
37
    bool RunStep(GDALPipelineStepRunContext &ctxt) override;
38
    bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
39
40
    std::vector<std::string> m_color{};
41
    int m_colorThreshold = 15;
42
    int m_pixelDistance = 2;
43
    bool m_addAlpha = false;
44
    bool m_addMask = false;
45
    std::string m_algorithm = "floodfill";
46
};
47
48
/************************************************************************/
49
/*               GDALRasterCleanCollarAlgorithmStandalone               */
50
/************************************************************************/
51
52
class GDALRasterCleanCollarAlgorithmStandalone final
53
    : public GDALRasterCleanCollarAlgorithm
54
{
55
  public:
56
    GDALRasterCleanCollarAlgorithmStandalone()
57
0
        : GDALRasterCleanCollarAlgorithm(/* standaloneStep = */ true)
58
0
    {
59
0
    }
60
61
    ~GDALRasterCleanCollarAlgorithmStandalone() override;
62
};
63
64
//! @endcond
65
66
#endif