Skip to content

Commit 6280b81

Browse files
committed
improve commenting formatting
1 parent 45c7857 commit 6280b81

14 files changed

Lines changed: 132 additions & 94 deletions

File tree

src/scope/command-line/execution/executors.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,9 @@ PrimaryScopePipelineExecutor::PrimaryScopePipelineExecutor(
3030
}
3131

3232
void PrimaryScopePipelineExecutor::ExecutePipeline() {
33-
// Results are stored within the pipeline, can also be accessed
34-
// via this function call
3533
this->pipeline_.Run(this->options_.images);
3634
}
3735

38-
// Will output the values found by this recalibration
3936
void PrimaryScopePipelineExecutor::OutputResults() {
4037
// std::vector<float> *&output = this->pipeline_.GetProduct();
4138
// TODO: something with output

src/scope/command-line/execution/executors.hpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* @file executors.hpp
3+
* @brief Pipeline executor for the primary SCOPE calibration chain.
4+
*/
5+
16
#ifndef SRC_SCOPE_COMMAND_LINE_EXECUTION_EXECUTORS_HPP_
27
#define SRC_SCOPE_COMMAND_LINE_EXECUTION_EXECUTORS_HPP_
38

@@ -13,20 +18,34 @@
1318

1419
namespace scope {
1520

21+
/**
22+
* Owns and runs the primary SCOPE calibration pipeline
23+
* (noise filter -> star centroid -> optimization).
24+
*/
1625
class PrimaryScopePipelineExecutor : public found::PipelineExecutor {
1726
public:
27+
/**
28+
* Constructs a PrimaryScopePipelineExecutor and assembles its pipeline.
29+
*
30+
* @param options Parsed recalibration options consumed by the run.
31+
* @param noiseFilterAlgorithm Stage that reduces raw frames to one image.
32+
* @param starCentroidAlgorithm Stage that extracts star centroids.
33+
* @param optimizationAlgorithm Stage that fits camera parameters.
34+
*/
1835
explicit PrimaryScopePipelineExecutor(RecalibrationOptions &&options,
1936
std::unique_ptr<NoiseFilterAlgorithm> noiseFilterAlgorithm,
2037
std::unique_ptr<StarCentroidAlgorithm> starCentroidAlgorithm,
2138
std::unique_ptr<OptimizationAlgorithm> optimizationAlgorithm);
2239

40+
/// Runs the assembled pipeline end-to-end.
2341
void ExecutePipeline() override;
42+
/// Prints the calibrated parameters produced by the pipeline.
2443
void OutputResults() override;
2544

2645
private:
27-
// The options being used by the pipeline
46+
/// The options driving this pipeline run.
2847
const RecalibrationOptions options_;
29-
// The primary pipeline for SCOPE operation
48+
/// The pipeline assembled for SCOPE operation.
3049
PrimaryScopePipeline pipeline_;
3150
};
3251

src/scope/command-line/parsing/options.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ SCOPE_CLI_OPTION("input-images", scope::Images, images, {}, scope::strtoimages(o
3434

3535
// NOLINTEND
3636

37-
/**
38-
* Options object, contains all data requested from user to run all algorithms
39-
*/
37+
/** Parsed CLI options driving a recalibration run. */
4038
class RecalibrationOptions {
4139
public:
4240
#define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, \

src/scope/command-line/parsing/parser.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ int optind = 2;
2424

2525
namespace scope {
2626

27-
/// For macro processing
27+
/// Sentinel for options with no default value.
2828
const char kNoDefaultArgument = 0;
2929

3030
RecalibrationOptions ParseRecalibrationOptions(int argc, char **argv) {
31-
// Define an enum for each valid flag (command-line entry), which maps it
32-
// from the name to an integer
31+
// Each block below re-expands RECALIBRATE to derive a piece of getopt
32+
// wiring from the option table in options.hpp.
3333
enum class ClientOption {
3434
#define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, \
3535
ASSIGN, doc) \
@@ -38,8 +38,6 @@ RecalibrationOptions ParseRecalibrationOptions(int argc, char **argv) {
3838
#undef SCOPE_CLI_OPTION
3939
};
4040

41-
// Define an array of options, which defines the traits pertaining to each
42-
// expected command-line entry
4341
static option long_options[] = {
4442
#define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, \
4543
ASSIGN, doc) \
@@ -50,15 +48,10 @@ RecalibrationOptions ParseRecalibrationOptions(int argc, char **argv) {
5048
#undef SCOPE_CLI_OPTION
5149
{0}};
5250

53-
// Define our result, and iterator helpers
5451
RecalibrationOptions options;
5552
int index;
5653
int option;
5754

58-
// Iterates through the list of command-line tokens and figures out
59-
// what data to assign to which field in options. Note that the
60-
// SCOPE_CLI_OPTION defines the conversion already between any
61-
// particular parameter (as a string) to its actual type
6255
while ((option = getopt_long(argc, argv, "", long_options, &index)) != -1) {
6356
switch (option) {
6457
#define SCOPE_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg, \

src/scope/command-line/parsing/parser.hpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ namespace scope {
88
#define HELP_MSG "Use ./scope --help or ./scope -h for help"
99

1010
/**
11-
* Parses the recalibration options from the command line to
12-
* run the recalibration algorithm
13-
*
14-
* @param argc The number of command-line arguments
15-
* @param argv The command line arguments
16-
*
17-
* @return CalibrationOptions The options for the calibration
18-
* algorithm as extracted on the command line
11+
* Parses recalibration flags from the command line.
12+
*
13+
* @param argc The number of command-line arguments.
14+
* @param argv The command-line arguments.
15+
*
16+
* @return The recalibration options extracted from the command line.
1917
*/
2018
RecalibrationOptions ParseRecalibrationOptions(int argc, char **argv);
2119

src/scope/command-line/scope-main.hpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@
44
namespace scope {
55

66
/**
7-
* This is where the program starts.
7+
* Program entry point. Parses command-line options and runs the
8+
* recalibration pipeline.
89
*
9-
* @param argc The number of arguments passed into the command line
10-
* @param argv The arguments passed into the command line
10+
* @param argc The number of command-line arguments.
11+
* @param argv The command-line arguments.
1112
*
12-
* @return An integer indicating success (0) iff the program executes
13-
* successfully
14-
*
15-
* @note The method itself uses command line arguments to generate
16-
* an Options object that represents all the algorithms we want to run
17-
* and their parameters
13+
* @return 0 on success, non-zero on failure.
1814
*/
1915
int main(int argc, char** argv);
2016

src/scope/common/style.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99

1010
namespace scope {
1111

12-
// Single image from FOUND
12+
/** Single image from FOUND. */
1313
typedef found::Image Image;
1414

15-
// Images passed in by the user
15+
/** Images passed in by the user. */
1616
typedef std::vector<found::Image> Images;
1717

18-
// Number of (maximum) stages for each pipeline
18+
/** Number of (maximum) stages for each pipeline. */
1919
constexpr size_t recalibration_size = 3;
2020

21-
/// Pipeline for Recalibration
21+
/** Pipeline for Recalibration. */
2222
typedef found::SequentialPipeline<std::vector<found::Image>, std::vector<float>, recalibration_size>
2323
PrimaryScopePipeline;
2424

src/scope/noise-filter/noise-filter.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace {
1414
///
1515
/// @param images Input images to validate.
1616
/// @throws std::invalid_argument if the image collection is empty.
17-
/// @throws std::runtime_error if any image is null, invalid, or mismatched.
17+
/// @throws std::runtime_error if any image is null or has mismatched dimensions.
1818
void ValidateInput(const Images& images) {
1919
if (images.empty()) {
2020
throw std::invalid_argument(
@@ -47,8 +47,6 @@ void ValidateInput(const Images& images) {
4747

4848
} // namespace
4949

50-
///// DarkScreenFilter /////
51-
5250
Image DarkScreenFilter::Run(const Images& images) {
5351
ValidateInput(images);
5452

src/scope/noise-filter/noise-filter.hpp

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/// @file noise-filter.hpp
2-
/// @brief Noise filtering algorithms for SCOPE calibration.
3-
///
4-
/// This header defines the noise-filter pipeline stage: its abstract
5-
/// base and concrete implementations.
1+
/**
2+
* @file noise-filter.hpp
3+
* @brief Noise filtering algorithms for SCOPE calibration.
4+
*/
65

76
#ifndef SRC_SCOPE_NOISE_FILTER_NOISE_FILTER_HPP_
87
#define SRC_SCOPE_NOISE_FILTER_NOISE_FILTER_HPP_
@@ -13,25 +12,34 @@
1312

1413
namespace scope {
1514

16-
/// Pipeline stage that reduces a collection of input frames to a single
17-
/// representative image (e.g. dark frame / fixed-pattern noise estimate).
15+
/**
16+
* Reduces a set of input frames to a single representative image
17+
* (e.g. a dark frame / fixed-pattern noise estimate).
18+
*/
1819
class NoiseFilterAlgorithm : public found::FunctionStage<Images, Image> {
1920
public:
2021
NoiseFilterAlgorithm() = default;
2122
virtual ~NoiseFilterAlgorithm() {}
2223
};
2324

24-
/// Computes a per-pixel median filter to estimate fixed-pattern noise.
25+
/**
26+
* Computes a per-pixel median across frames to estimate fixed-pattern noise.
27+
*/
2528
class DarkScreenFilter : public NoiseFilterAlgorithm {
2629
public:
2730
DarkScreenFilter() = default;
2831
~DarkScreenFilter() override = default;
2932

30-
/// @param images Raw frames with identical dimensions and channel counts.
31-
/// @return The median image with newly allocated pixel storage.
32-
/// The caller must free the image buffer.
33-
/// @throws std::invalid_argument if images collection is empty.
34-
/// @throws std::runtime_error if images have mismatched dimensions.
33+
/**
34+
* Computes the per-pixel median of the input frames.
35+
*
36+
* @param images Frames with identical dimensions and channel counts.
37+
*
38+
* @return The median image; the caller owns the pixel buffer.
39+
*
40+
* @throws std::invalid_argument if images is empty.
41+
* @throws std::runtime_error if any image is null or has mismatched dimensions.
42+
*/
3543
Image Run(const Images &images) override;
3644
};
3745

src/scope/optimization/optimization.hpp

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/// @file optimization.hpp
2-
/// @brief Parameter-fit optimization algorithms for SCOPE calibration.
3-
///
4-
/// This header defines the optimization pipeline stage: its abstract
5-
/// base and concrete implementations.
1+
/**
2+
* @file optimization.hpp
3+
* @brief Parameter-fit optimization algorithms for SCOPE calibration.
4+
*/
65

76
#ifndef SRC_SCOPE_OPTIMIZATION_OPTIMIZATION_HPP_
87
#define SRC_SCOPE_OPTIMIZATION_OPTIMIZATION_HPP_
@@ -15,21 +14,38 @@
1514

1615
namespace scope {
1716

18-
/// Pipeline stage that produces updated camera parameters from centroids.
17+
/**
18+
* Produces updated camera intrinsic + distortion parameters from star centroids.
19+
*/
1920
class OptimizationAlgorithm : public found::FunctionStage<std::vector<float>, std::vector<float>> {
2021
public:
2122
OptimizationAlgorithm() = default;
2223
virtual ~OptimizationAlgorithm() {}
2324
};
2425

25-
/// Levenberg-Marquardt parameter optimizer. Stub implementation pending
26-
/// the real algorithm.
26+
/**
27+
* Levenberg-Marquardt parameter optimizer. Stub pending the real algorithm.
28+
*/
2729
class LMAOptimizationAlgorithm : public OptimizationAlgorithm {
2830
public:
2931
LMAOptimizationAlgorithm() = default;
32+
33+
/**
34+
* Constructs a new LMAOptimizationAlgorithm.
35+
*
36+
* @param options Parsed recalibration options (currently unused).
37+
*/
3038
explicit LMAOptimizationAlgorithm([[maybe_unused]] const RecalibrationOptions &options) {}
39+
3140
~LMAOptimizationAlgorithm() override = default;
3241

42+
/**
43+
* Fits camera parameters to the given star centroids.
44+
*
45+
* @param stars Flattened centroid coordinates from the previous stage.
46+
*
47+
* @return The updated camera parameter vector. The stub returns an empty vector.
48+
*/
3349
std::vector<float> Run(const std::vector<float> &stars) override;
3450
};
3551

0 commit comments

Comments
 (0)