-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplugin_math.cpp
More file actions
47 lines (39 loc) · 1.76 KB
/
Copy pathplugin_math.cpp
File metadata and controls
47 lines (39 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* Developed by Jimmy Hu */
/* Isolated Compilation Unit for Mathematical Operations */
#include "plugin_api.h"
extern "C" TINYDIP_PLUGIN_EXPORT void register_plugin_commands(CommandRegistry& registry)
{
// Define human-readable pipeline schema routing constants locally
constexpr auto TransformerSchema = IOSchema{0, 1};
constexpr auto CombinerSchema = IOSchema{0, 2};
registry.register_command("abs", "Calculate the absolute value of an image or container.", TransformerSchema,
[](Workspace& workspace, std::span<const std::string_view> args, std::ostream& os)
{
handlers::abs(workspace, args, os);
}
);
registry.register_command("max", "Calculate the maximum value of an image or container.", TransformerSchema,
[](Workspace& workspace, std::span<const std::string_view> args, std::ostream& os)
{
handlers::max(workspace, args, os);
}
);
registry.register_command("min", "Calculate the minimum value of an image or container.", TransformerSchema,
[](Workspace& workspace, std::span<const std::string_view> args, std::ostream& os)
{
handlers::min(workspace, args, os);
}
);
registry.register_command("subtract", "Subtract two images or containers pixel-wise.", CombinerSchema,
[](Workspace& workspace, std::span<const std::string_view> args, std::ostream& os)
{
handlers::subtract(workspace, args, os);
}
);
registry.register_command("sum", "Calculate the sum of all elements in an image or container.", TransformerSchema,
[](Workspace& workspace, std::span<const std::string_view> args, std::ostream& os)
{
handlers::sum(workspace, args, os);
}
);
}