Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "pansharpen" 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_PANSHARPEN_INCLUDED 14 : #define GDALALG_RASTER_PANSHARPEN_INCLUDED 15 : 16 : #include "gdalalg_raster_pipeline.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALRasterPansharpenAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALRasterPansharpenAlgorithm /* non final */ 25 : : public GDALRasterPipelineStepAlgorithm 26 : { 27 : public: 28 : static constexpr const char *NAME = "pansharpen"; 29 : static constexpr const char *DESCRIPTION = 30 : "Perform a pansharpen operation."; 31 : static constexpr const char *HELP_URL = 32 : "/programs/gdal_raster_pansharpen.html"; 33 : 34 : explicit GDALRasterPansharpenAlgorithm(bool standaloneStep = false); 35 : 36 : private: 37 : static ConstructorOptions GetConstructorOptions(bool standaloneStep); 38 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 39 : 40 : std::vector<GDALArgDatasetValue> m_spectralDatasets{}; 41 : std::string m_resampling = "cubic"; 42 : std::vector<double> m_weights{}; 43 : double m_nodata = 0; 44 : std::string m_spatialExtentAdjustment = "union"; 45 : int m_bitDepth = 0; 46 : int m_numThreads = 0; 47 : 48 : // Work variables 49 : std::string m_numThreadsStr{"ALL_CPUS"}; 50 : }; 51 : 52 : /************************************************************************/ 53 : /* GDALRasterPansharpenAlgorithmStandalone */ 54 : /************************************************************************/ 55 : 56 26 : class GDALRasterPansharpenAlgorithmStandalone final 57 : : public GDALRasterPansharpenAlgorithm 58 : { 59 : public: 60 13 : GDALRasterPansharpenAlgorithmStandalone() 61 13 : : GDALRasterPansharpenAlgorithm(/* standaloneStep = */ true) 62 : { 63 13 : } 64 : 65 : ~GDALRasterPansharpenAlgorithmStandalone() override; 66 : }; 67 : 68 : //! @endcond 69 : 70 : #endif /* GDALALG_RASTER_PANSHARPEN_INCLUDED */