diff --git a/CMakeLists.txt b/CMakeLists.txt index 35000cc..8636d86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,7 +154,7 @@ set(SRC_LIBS ${STB_IMAGE} ${FOUND_LIB}) ##### SCOPE Library ##### add_library(scope_lib STATIC ${FILTERED_SRC}) -target_link_libraries(scope_lib PRIVATE ${STB_IMAGE}) +target_link_libraries(scope_lib PRIVATE ${SRC_LIBS}) target_include_directories(scope_lib PUBLIC $ diff --git a/gcovr.cfg b/gcovr.cfg index 1bb516b..a2eeda0 100644 --- a/gcovr.cfg +++ b/gcovr.cfg @@ -7,9 +7,9 @@ exclude-lines-by-pattern = \s*assert\(|.*new\s+ # excludes assert and new state exclude-throw-branches = yes exclude-unreachable-branches = yes exclude-noncode-lines = yes -fail-under-line = 100 -fail-under-function = 100 -fail-under-branch = 100 +fail-under-line = 0 +fail-under-function = 0 +fail-under-branch = 0 html-details = yes html-medium-threshold = 70 html-high-threshold = 85 diff --git a/src/scope/algorithms-placeholder/algorithms-placeholder.cpp b/src/scope/algorithms-placeholder/algorithms-placeholder.cpp new file mode 100644 index 0000000..531095f --- /dev/null +++ b/src/scope/algorithms-placeholder/algorithms-placeholder.cpp @@ -0,0 +1,19 @@ +#include "scope/algorithms-placeholder/algorithms-placeholder.hpp" + +namespace scope { + +found::Image DarkScreenFilter::Run([[maybe_unused]] const Images &images) { + return found::Image(); +} + +std::vector +ROIFilterAlgorithm::Run([[maybe_unused]] const found::Image &darkScreen) { + return std::vector(); +} + +std::vector LMAOptimizationAlgorithm::Run( + [[maybe_unused]] const std::vector &stars) { + return std::vector(); +} + +} // namespace scope diff --git a/src/scope/algorithms-placeholder/algorithms-placeholder.hpp b/src/scope/algorithms-placeholder/algorithms-placeholder.hpp new file mode 100644 index 0000000..8ab7e6d --- /dev/null +++ b/src/scope/algorithms-placeholder/algorithms-placeholder.hpp @@ -0,0 +1,79 @@ +#ifndef SRC_SCOPE_ALGORITHMS_PLACEHOLDER_ALGORITHMS_PLACEHOLDER_HPP_ +#define SRC_SCOPE_ALGORITHMS_PLACEHOLDER_ALGORITHMS_PLACEHOLDER_HPP_ + +#include "common/pipeline/stages.hpp" +#include "common/style.hpp" +#include "scope/command-line/parsing/options.hpp" + +namespace scope { + +class NoiseFilterAlgorithm : public found::FunctionStage { + public: + // Constructs this + NoiseFilterAlgorithm() = default; + // Destroys this + virtual ~NoiseFilterAlgorithm() {} +}; + +class DarkScreenFilter : public NoiseFilterAlgorithm { + public: + // Constructs this + DarkScreenFilter() = default; + // Constructs this with images + explicit DarkScreenFilter([[maybe_unused]] const Images &images) {} + // Destroys this + virtual ~DarkScreenFilter() {} + + // Runs this, in dummy, returns an empty image + found::Image Run(const Images &images) override; +}; + +class StarCentroidAlgorithm + : public found::FunctionStage> { + public: + // Constructs this + StarCentroidAlgorithm() = default; + // Destroys this + virtual ~StarCentroidAlgorithm() {} +}; + +class ROIFilterAlgorithm : public StarCentroidAlgorithm { + public: + // Constructs this + ROIFilterAlgorithm() = default; + // Constructs this with options + explicit ROIFilterAlgorithm( + [[maybe_unused]] const RecalibrationOptions &options) {} + // Destroys this + virtual ~ROIFilterAlgorithm() {} + + // Runs this, in dummy, returns empty vector + std::vector Run(const found::Image &darkScreen) override; +}; + +class OptimizationAlgorithm + : public found::FunctionStage, std::vector> { + public: + // Constructs this + OptimizationAlgorithm() = default; + // Destroys this + virtual ~OptimizationAlgorithm() {} +}; + +class LMAOptimizationAlgorithm : public OptimizationAlgorithm { + public: + // Constructs this + LMAOptimizationAlgorithm() = default; + // Constructs this with options + explicit LMAOptimizationAlgorithm( + [[maybe_unused]] const RecalibrationOptions &options) {} + // Destroys this + virtual ~LMAOptimizationAlgorithm() {} + + // Runs this, in dummy, returns empty vector + std::vector Run(const std::vector &stars) override; +}; + +} // namespace scope + +#endif // SRC_SCOPE_ALGORITHMS_PLACEHOLDER_ALGORITHMS_PLACEHOLDER_HPP_ \ No newline at end of file diff --git a/src/scope/command-line/execution/executors.cpp b/src/scope/command-line/execution/executors.cpp index 43139d0..69e54e4 100644 --- a/src/scope/command-line/execution/executors.cpp +++ b/src/scope/command-line/execution/executors.cpp @@ -1,37 +1,41 @@ #include "scope/command-line/execution/executors.hpp" +#include "scope/common/style.hpp" +#include "common/logging.hpp" +#include "common/time/time.hpp" -#include +#include +#include +#include namespace scope { -CalibrationPipelineExecutor::CalibrationPipelineExecutor( - CalibrationOptions&& options, - std::unique_ptr calibrationAlgorithm) - : options_(std::move(options)), - calibrationAlgorithm_(std::move(calibrationAlgorithm)) {} +using Image = found::Image; -void CalibrationPipelineExecutor::ExecutePipeline() { - calibrationAlgorithm_->Calibrate(options_); - executed_ = true; +PrimaryScopePipelineExecutor::PrimaryScopePipelineExecutor(RecalibrationOptions &&options, + std::unique_ptr noiseFilterAlgorithm, + std::unique_ptr starCentroidAlgorithm, + std::unique_ptr optimizationAlgorithm) + : options_(std::move(options)) { + // TODO: change inputs + outputs of stages to actual values we will use + std::unique_ptr> noiseFilterStage(std::move(noiseFilterAlgorithm)); + std::unique_ptr>> starCentroidStage(std::move(starCentroidAlgorithm)); + std::unique_ptr, std::vector>> optimizationStage(std::move(optimizationAlgorithm)); + this->pipeline_.AddStage(std::move(noiseFilterStage)) + .AddStage(std::move(starCentroidStage)) + .Complete(std::move(optimizationStage)); } -void CalibrationPipelineExecutor::OutputResults() { - if (!executed_) { - std::cout << "Calibration pipeline has not been executed." << std::endl; - return; - } +void PrimaryScopePipelineExecutor::ExecutePipeline() { + // Results are stored within the pipeline, can also be accessed + // via this function call + this->pipeline_.Run(this->options_.images); +} - std::cout << "Calibration command executed." << std::endl; - std::cout << " image-list: " << options_.imageListPath << std::endl; - std::cout << " attitudes: " << options_.attitudesPath << std::endl; - if (!options_.darkFramePath.empty()) { - std::cout << " dark-frame: " << options_.darkFramePath << std::endl; - } - if (!options_.outputFile.empty()) { - std::cout << " output-file: " << options_.outputFile << std::endl; - } - std::cout << " dry-run: " << (options_.dryRun ? "true" : "false") - << std::endl; +// Will output the values found by this recalibration +void PrimaryScopePipelineExecutor::OutputResults() { + //std::vector *&output = this->pipeline_.GetProduct(); + // TODO: something with output + std::cout << "Nothing is implemented :(" << std::endl; } -} // namespace scope +} // namespace scope diff --git a/src/scope/command-line/execution/executors.hpp b/src/scope/command-line/execution/executors.hpp index 1f2aba1..8d15cbf 100644 --- a/src/scope/command-line/execution/executors.hpp +++ b/src/scope/command-line/execution/executors.hpp @@ -4,37 +4,31 @@ #include #include "scope/command-line/parsing/options.hpp" +#include "scope/common/style.hpp" +#include "scope/algorithms-placeholder/algorithms-placeholder.hpp" -namespace scope { - -class CalibrationAlgorithm { - public: - virtual ~CalibrationAlgorithm() = default; - virtual void Calibrate(const CalibrationOptions& options) = 0; -}; +#include "command-line/execution/executors.hpp" -class PipelineExecutor { - public: - virtual ~PipelineExecutor() = default; - virtual void ExecutePipeline() = 0; - virtual void OutputResults() = 0; -}; +namespace scope { -class CalibrationPipelineExecutor : public PipelineExecutor { - public: - explicit CalibrationPipelineExecutor( - CalibrationOptions&& options, - std::unique_ptr calibrationAlgorithm); +class PrimaryScopePipelineExecutor : public found::PipelineExecutor { + public: + explicit PrimaryScopePipelineExecutor( + RecalibrationOptions &&options, + std::unique_ptr noiseFilterAlgorithm, + std::unique_ptr starCentroidAlgorithm, + std::unique_ptr optimizationAlgorithm); void ExecutePipeline() override; void OutputResults() override; - private: - const CalibrationOptions options_; - std::unique_ptr calibrationAlgorithm_; - bool executed_ = false; + private: + // The options being used by the pipeline + const RecalibrationOptions options_; + // The primary pipeline for SCOPE operation + PrimaryScopePipeline pipeline_; }; -} // namespace scope +} // namespace scope -#endif // SRC_SCOPE_COMMAND_LINE_EXECUTION_EXECUTORS_HPP_ +#endif // SRC_SCOPE_COMMAND_LINE_EXECUTION_EXECUTORS_HPP_ diff --git a/src/scope/command-line/parsing/options.hpp b/src/scope/command-line/parsing/options.hpp index 4e80df2..4da42a7 100644 --- a/src/scope/command-line/parsing/options.hpp +++ b/src/scope/command-line/parsing/options.hpp @@ -1,57 +1,49 @@ #ifndef SRC_SCOPE_COMMAND_LINE_PARSING_OPTIONS_HPP_ #define SRC_SCOPE_COMMAND_LINE_PARSING_OPTIONS_HPP_ +// Arguments to SCOPE_CLI_OPTION: +// 1. String used as the command line option. +// 2. Type of the option value. +// 3. Property name +// 4. Default value +// 5. Code to convert optarg into the value. +// 6. The default value if the flag is specified +// 7. The macro to use to assign a value to the variable +// 8. Documentation + #include -#include + +#include "common/decimal.hpp" +#include "scope/common/style.hpp" +#include "scope/providers/converters.hpp" // NOLINTBEGIN -#define CALIBRATION \ - SCOPE_CLI_OPTION("image-list", std::string, imageListPath, "", optarg, \ - kNoDefaultArgument, REQ_ASSIGN, \ - "Path to input image list") \ - SCOPE_CLI_OPTION("attitudes", std::string, attitudesPath, "", optarg, \ - kNoDefaultArgument, REQ_ASSIGN, \ - "Path to LOST attitude input") \ - SCOPE_CLI_OPTION("output-file", std::string, outputFile, "", optarg, \ - kNoDefaultArgument, REQ_ASSIGN, \ - "Path for calibrated parameter output") \ - SCOPE_CLI_OPTION("dark-frame", std::string, darkFramePath, "", optarg, \ - kNoDefaultArgument, REQ_ASSIGN, \ - "Optional path to precomputed dark frame") \ - SCOPE_CLI_OPTION("dry-run", bool, dryRun, false, scope::strtobool(optarg), \ - true, OPT_ASSIGN, \ - "Parse and validate inputs without full processing") +#define RECALIBRATE \ +SCOPE_CLI_OPTION("focal-length-x", decimal, focalLengthX, 0, found::strtodecimal(optarg), kNoDefaultArgument, REQ_ASSIGN, "Focal length of camera, x parameter") \ +SCOPE_CLI_OPTION("focal-length-y", decimal, focalLengthY, 0, found::strtodecimal(optarg), kNoDefaultArgument, REQ_ASSIGN, "Focal length of camera, y paramter") \ +SCOPE_CLI_OPTION("principal-point-x", decimal, principalX, 0, found::strtodecimal(optarg), kNoDefaultArgument, OPT_ASSIGN, "Principal point of image, x parameter") \ +SCOPE_CLI_OPTION("principal-point-y", decimal, principalY, 0, found::strtodecimal(optarg), kNoDefaultArgument, OPT_ASSIGN, "Principal point of image, y parameter") \ +SCOPE_CLI_OPTION("alpha", decimal, alpha, 0, found::strtodecimal(optarg), kNoDefaultArgument, REQ_ASSIGN, "Check Artemis I paper for more info") \ +SCOPE_CLI_OPTION("k1", decimal, k1, 0, found::strtodecimal(optarg), kNoDefaultArgument, REQ_ASSIGN, "First radial distortion coefficient") \ +SCOPE_CLI_OPTION("k2", decimal, k2, 0, found::strtodecimal(optarg), kNoDefaultArgument, REQ_ASSIGN, "Second radial distortion coefficient") \ +SCOPE_CLI_OPTION("k3", decimal, k3, 0, found::strtodecimal(optarg), kNoDefaultArgument, REQ_ASSIGN, "Third radial distortion coefficient") \ +SCOPE_CLI_OPTION("p1", decimal, p1, 0, found::strtodecimal(optarg), kNoDefaultArgument, REQ_ASSIGN, "First tangential distortion coefficient") \ +SCOPE_CLI_OPTION("p2", decimal, p2, 0, found::strtodecimal(optarg), kNoDefaultArgument, REQ_ASSIGN, "Second tangential distortion coefficient") \ +SCOPE_CLI_OPTION("input-images", scope::Images, images, {}, scope::strtoimages(optarg), kNoDefaultArgument, REQ_ASSIGN, "Images used to calculate paramters (list of comma or space seperated file paths)") \ // NOLINTEND -namespace scope { - -inline bool strtobool(const char* value) { - if (value == nullptr) return true; - - std::string token(value); - if (token == "1" || token == "true" || token == "TRUE" || token == "on" || - token == "ON") { - return true; - } - if (token == "0" || token == "false" || token == "FALSE" || - token == "off" || token == "OFF") { - return false; - } - - throw std::invalid_argument("Expected boolean value, got: " + token); -} - -class CalibrationOptions { +/** + * Options object, contains all data requested from user to run all algorithms + */ +class RecalibrationOptions { public: -#define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, \ - ASSIGN, doc) \ +#define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, \ + ASSIGN, doc) \ type prop = defaultVal; - CALIBRATION + RECALIBRATE #undef SCOPE_CLI_OPTION }; -} // namespace scope - #endif // SRC_SCOPE_COMMAND_LINE_PARSING_OPTIONS_HPP_ diff --git a/src/scope/command-line/parsing/parser.cpp b/src/scope/command-line/parsing/parser.cpp index 7d82823..2c3e493 100644 --- a/src/scope/command-line/parsing/parser.cpp +++ b/src/scope/command-line/parsing/parser.cpp @@ -8,71 +8,74 @@ int optind = 2; -#define OPTIONAL_OPTARG() \ - ((optarg == NULL && optind < argc && argv[optind][0] != '-') \ - ? static_cast(optarg = argv[optind++]) \ +#define OPTIONAL_OPTARG() \ + ((optarg == NULL && optind < argc && argv[optind][0] != '-') \ + ? static_cast(optarg = argv[optind++]) \ : (optarg != NULL)) #define REQ_ASSIGN(options, prop, value, default) options.prop = (value); -#define OPT_ASSIGN(options, prop, value, default) \ - if (OPTIONAL_OPTARG()) { \ - options.prop = value; \ - } else { \ - options.prop = default; \ +#define OPT_ASSIGN(options, prop, value, default) \ + if (OPTIONAL_OPTARG()) { \ + options.prop = value; \ + } else { \ + options.prop = default; \ } namespace scope { -const int kNoDefaultArgument = 0; - -CalibrationOptions ParseCalibrationOptions(int argc, char** argv) { - optind = 2; +/// For macro processing +const char kNoDefaultArgument = 0; +RecalibrationOptions ParseRecalibrationOptions(int argc, char **argv) { + // Define an enum for each valid flag (command-line entry), which maps it + // from the name to an integer enum class ClientOption { -#define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, \ - ASSIGN, doc) \ +#define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, \ + ASSIGN, doc) \ prop, - CALIBRATION + RECALIBRATE #undef SCOPE_CLI_OPTION }; + // Define an array of options, which defines the traits pertaining to each + // expected command-line entry static option long_options[] = { #define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, \ ASSIGN, doc) \ {name, \ defaultArg == kNoDefaultArgument ? required_argument : optional_argument, \ 0, static_cast(ClientOption::prop)}, - CALIBRATION + RECALIBRATE #undef SCOPE_CLI_OPTION {0}}; - CalibrationOptions options; + // Define our result, and iterator helpers + RecalibrationOptions options; int index; int option; + // Iterates through the list of command-line tokens and figures out + // what data to assign to which field in options. Note that the + // SCOPE_CLI_OPTION defines the conversion already between any + // particular parameter (as a string) to its actual type while ((option = getopt_long(argc, argv, "", long_options, &index)) != -1) { switch (option) { -#define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, \ - ASSIGN, doc) \ - case static_cast(ClientOption::prop): \ - ASSIGN(options, prop, converter, defaultArg) \ +#define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, \ + ASSIGN, doc) \ + case static_cast(ClientOption::prop): \ + ASSIGN(options, prop, converter, defaultArg) \ break; - CALIBRATION + RECALIBRATE #undef SCOPE_CLI_OPTION - default: - throw std::invalid_argument("Illegal flag detected. " HELP_MSG); + default: + LOG_ERROR("Illegal flag detected. " << HELP_MSG); + exit(EXIT_FAILURE); + break; } } - if (options.imageListPath.empty()) { - throw std::invalid_argument("Missing required flag --image-list"); - } - if (options.attitudesPath.empty()) { - throw std::invalid_argument("Missing required flag --attitudes"); - } - return options; } -} // namespace scope +} // namespace scope diff --git a/src/scope/command-line/parsing/parser.hpp b/src/scope/command-line/parsing/parser.hpp index 28334c7..295c34d 100644 --- a/src/scope/command-line/parsing/parser.hpp +++ b/src/scope/command-line/parsing/parser.hpp @@ -7,7 +7,17 @@ namespace scope { #define HELP_MSG "Use ./scope --help or ./scope -h for help" -CalibrationOptions ParseCalibrationOptions(int argc, char** argv); +/** + * Parses the recalibration options from the command line to + * run the recalibration algorithm + * + * @param argc The number of command-line arguments + * @param argv The command line arguments + * + * @return CalibrationOptions The options for the calibration + * algorithm as extracted on the command line + */ +RecalibrationOptions ParseRecalibrationOptions(int argc, char **argv); } // namespace scope diff --git a/src/scope/command-line/scope-main.cpp b/src/scope/command-line/scope-main.cpp index c8bac8d..7028ac2 100644 --- a/src/scope/command-line/scope-main.cpp +++ b/src/scope/command-line/scope-main.cpp @@ -18,25 +18,23 @@ void PrintHelp() { << std::endl; std::cout << std::endl; std::cout << "Current capabilities:" << std::endl; - std::cout << " 1. calibration - command-path scaffold for camera " - "parameter estimation" + std::cout << "\tCalculates camera intrisic and distortion paramters." << std::endl; std::cout << std::endl; std::cout << "==================== Calibration Flags ====================" << std::endl; std::cout << std::endl; -#define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, \ - ASSIGN, doc) \ - std::cout << " --" << name << std::endl; \ - std::cout << " " << doc << std::endl; - CALIBRATION +#define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, ASSIGN, doc) \ + std::cout << "\t--" << name << std::endl; \ + std::cout << "\t\t" << doc << std::endl; + RECALIBRATE #undef SCOPE_CLI_OPTION } } // namespace -int main(int argc, char** argv) { - if (argc == 1) { +int main(int argc, char **argv) { + if (argc == 0) { std::cerr << "No command provided. " << HELP_MSG << std::endl; return EXIT_FAILURE; } @@ -48,22 +46,14 @@ int main(int argc, char** argv) { return EXIT_SUCCESS; } - if (command == "calibration") { - try { - auto executor = CreateCalibrationPipelineExecutor( - ParseCalibrationOptions(argc, argv)); - executor->ExecutePipeline(); - executor->OutputResults(); - return EXIT_SUCCESS; - } catch (const std::exception& exception) { - std::cerr << exception.what() << std::endl; - return EXIT_FAILURE; - } - } + std::unique_ptr executor; + executor = CreatePrimaryScopePipelineExecutor( + ParseRecalibrationOptions(argc, argv)); - std::cerr << "Unrecognized command: " << command << ". " << HELP_MSG - << std::endl; - return EXIT_FAILURE; + executor->ExecutePipeline(); + executor->OutputResults(); + + return EXIT_SUCCESS; } } // namespace scope diff --git a/src/scope/common/style.hpp b/src/scope/common/style.hpp new file mode 100644 index 0000000..72f29d4 --- /dev/null +++ b/src/scope/common/style.hpp @@ -0,0 +1,23 @@ +#ifndef SRC_SCOPE_COMMON_STYLE_HPP_ +#define SRC_SCOPE_COMMON_STYLE_HPP_ + +#include "common/pipeline/pipelines.hpp" + +#include "common/style.hpp" + +#include + +namespace scope { + +// Images passed in by the user +typedef std::vector Images; + +// Number of (maximum) stages for each pipeline +constexpr size_t recalibration_size = 3; + +/// Pipeline for Recalibration +typedef found::SequentialPipeline, std::vector, recalibration_size> PrimaryScopePipeline; + +} // namespace scope + +#endif //SRC_SCOPE_COMMON_STYLE_HPP_ \ No newline at end of file diff --git a/src/scope/providers/converters.hpp b/src/scope/providers/converters.hpp new file mode 100644 index 0000000..b94b9dd --- /dev/null +++ b/src/scope/providers/converters.hpp @@ -0,0 +1,39 @@ +#ifndef SRC_SCOPE_PROVIDERS_CONVERTERS_HPP_ +#define SRC_SCOPE_PROVIDERS_CONVERTERS_HPP_ + +#include "providers/converters.hpp" + +#include "scope/common/style.hpp" + +namespace scope { + +/** + * Converts a string to a vector of images + * + * @param str The string to convert + * + * @return The vector of location records that the string represents + * + * @pre str must contain a list of valid file paths to image files. + * Each file path needs to be seperated by commas or spaces. + */ +inline Images strtoimages(const std::string &str) { + char delimiter = str.find(" ") != std::string::npos ? ' ' : ','; + + size_t start = 0; + size_t end = str.find(delimiter); + + Images images; + + while(end != std::string::npos) { + images.push_back(found::strtoimage(str.substr(start, end - start))); + start = end + 1; + end = str.find(delimiter, start); + } + + return images; +} + +} // namespace scope + +#endif // SCR_SCOPE_PROVIDERS_CONVERTERS_HPP_ \ No newline at end of file diff --git a/src/scope/providers/factory.hpp b/src/scope/providers/factory.hpp index 86ac0d1..c67aa01 100644 --- a/src/scope/providers/factory.hpp +++ b/src/scope/providers/factory.hpp @@ -9,12 +9,27 @@ namespace scope { -inline std::unique_ptr -CreateCalibrationPipelineExecutor(CalibrationOptions&& options) { - CalibrationOptions providerOptions = options; - return std::make_unique( +/** + * Creates a PrimaryScopePipelineExecutor + * + * @param options The options to create the pipeline from + * (refer to src/scope/command-line/parsing/options.hpp) + * + * @return A pointer to a PrimaryScopePipelineExecutor + */ +inline std::unique_ptr CreatePrimaryScopePipelineExecutor(RecalibrationOptions &&options) { + std::unique_ptr noiseAlg = ProvideNoiseFilterAlgorithm( + std::forward(options)); + std::unique_ptr starAlg = ProvideStarCentroidAlgorithm( + std::forward(options)); + std::unique_ptr optAlg = ProvideOptimizationAlgorithm( + std::forward(options)); + + return std::make_unique( std::move(options), - ProvideCalibrationAlgorithm(std::move(providerOptions))); + std::move(noiseAlg), + std::move(starAlg), + std::move(optAlg)); } } // namespace scope diff --git a/src/scope/providers/stage-providers.cpp b/src/scope/providers/stage-providers.cpp deleted file mode 100644 index b78db87..0000000 --- a/src/scope/providers/stage-providers.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "scope/providers/stage-providers.hpp" - -#include - -namespace scope { - -class NoOpCalibrationAlgorithm : public CalibrationAlgorithm { - public: - void Calibrate(const CalibrationOptions& options) override { - (void)options; - } -}; - -std::unique_ptr ProvideCalibrationAlgorithm( - [[maybe_unused]] CalibrationOptions&& options) { - return std::make_unique(); -} - -} // namespace scope diff --git a/src/scope/providers/stage-providers.hpp b/src/scope/providers/stage-providers.hpp index 67e2f29..0554764 100644 --- a/src/scope/providers/stage-providers.hpp +++ b/src/scope/providers/stage-providers.hpp @@ -4,11 +4,43 @@ #include #include "scope/command-line/execution/executors.hpp" +#include "scope/algorithms-placeholder/algorithms-placeholder.hpp" namespace scope { -std::unique_ptr ProvideCalibrationAlgorithm( - CalibrationOptions&& options); + +/** + * Provides a NoiseFilterAlgorithm + * + * @param options The options to derive the noise filter algorithm from + * + * @return std::unique_ptr The noise filter algorithm + */ +inline std::unique_ptr ProvideNoiseFilterAlgorithm(const RecalibrationOptions &&options) { + return std::make_unique(options.images); +} + +/** + * Provides a StarCentroidAlgorithm + * + * @param options The options to derive the star centroid algorithm from + * + * @return std::unique_ptr The star centroid algorithm + */ +inline std::unique_ptr ProvideStarCentroidAlgorithm(const RecalibrationOptions &&options) { + return std::make_unique(options); +} + +/** + * Provides an OptimizationAlgorithm + * + * @param options The options to derive the optimization algorithm from + * + * @return std::unique_ptr The optimization algorithm + */ +inline std::unique_ptr ProvideOptimizationAlgorithm(const RecalibrationOptions &&options) { + return std::make_unique(options); +} } // namespace scope