CVB++ 15.0
arithmetic.hpp
1#pragma once
2
3#include <memory>
4
5#include "../global.hpp"
6#include "../_cexports/c_img.h"
7#include "cube.hpp"
8
9namespace Cvb
10{
11 CVB_BEGIN_INLINE_NS
12
13 namespace Spectral
14 {
15
17
27 std::unique_ptr<Cube> Addition(const Cube &cube1, const Cube &cube2,
28 PixelOverflow overflowHandling = PixelOverflow::Unhandled)
29 {
30 bool clipResults = (overflowHandling == PixelOverflow::Truncate) ? true : false;
31 return Internal::DoResCallObjectOut<Cube>(
32 [&](void *&obj) { return CVB_CALL_CAPI(CVSCubeAddition(cube1.Handle(), cube2.Handle(), clipResults, obj)); });
33 }
34
36
47 std::unique_ptr<Cube> Subtraction(const Cube &minuend, const Cube &subtrahend,
48 PixelOverflow overflowHandling = PixelOverflow::Unhandled)
49 {
50 bool clipResults = (overflowHandling == PixelOverflow::Truncate) ? true : false;
51 return Internal::DoResCallObjectOut<Cube>([&](void *&obj) {
52 return CVB_CALL_CAPI(CVSCubeSubtraction(minuend.Handle(), subtrahend.Handle(), clipResults, obj));
53 });
54 }
55
57
67 std::unique_ptr<Cube> Multiplication(const Cube &cube1, const Cube &cube2,
68 PixelOverflow overflowHandling = PixelOverflow::Unhandled)
69 {
70 bool clipResults = (overflowHandling == PixelOverflow::Truncate) ? true : false;
71 return Internal::DoResCallObjectOut<Cube>([&](void *&obj) {
72 return CVB_CALL_CAPI(CVSCubeMultiplication(cube1.Handle(), cube2.Handle(), clipResults, obj));
73 });
74 }
75
77
85 std::unique_ptr<Cube> Division(const Cube &dividend, const Cube &divisor)
86 {
87 return Internal::DoResCallObjectOut<Cube>(
88 [&](void *&obj) { return CVB_CALL_CAPI(CVSCubeDivision(dividend.Handle(), divisor.Handle(), obj)); });
89 }
90
92
110 std::unique_ptr<Cube> Normalization(const Cube &cubeIn, const Cube &whiteReference, const Cube &blackReference,
111 NormalizationMethod normalizationMethod)
112 {
113 return Internal::DoResCallObjectOut<Cube>([&](void *&obj) {
114 return CVB_CALL_CAPI(CVSCubeNormalize(cubeIn.Handle(), whiteReference.Handle(), blackReference.Handle(),
115 static_cast<CExports::CVSNormalizationMethod>(normalizationMethod), obj));
116 });
117 }
118
119 } // namespace Spectral
120
121 CVB_END_INLINE_NS
122} // namespace Cvb
Spectral Cube object.
Definition cube.hpp:59
void * Handle() const noexcept
Returns C-API style handle to the Cube.
Definition cube.hpp:316
Namespace for the Spectral package.
Definition arithmetic.hpp:14
std::unique_ptr< Cube > Multiplication(const Cube &cube1, const Cube &cube2, PixelOverflow overflowHandling=PixelOverflow::Unhandled)
Element-wise multiplication of two cubes.
Definition arithmetic.hpp:67
PixelOverflow
Defines how arithmetic overflows and underflows are handled.
Definition spectral.hpp:292
@ Unhandled
No operation is done on the resulting pixel values.
Definition spectral.hpp:294
@ Truncate
Resulting pixel values are truncated at the data type's min and max values.
Definition spectral.hpp:296
NormalizationMethod
Defines the method used for normalizing the spectral cube with a white and a black reference.
Definition spectral.hpp:247
std::unique_ptr< Cube > Division(const Cube &dividend, const Cube &divisor)
Element-wise division of two Cubes.
Definition arithmetic.hpp:85
std::unique_ptr< Cube > Subtraction(const Cube &minuend, const Cube &subtrahend, PixelOverflow overflowHandling=PixelOverflow::Unhandled)
Element-wise subtraction of two cubes.
Definition arithmetic.hpp:47
std::unique_ptr< Cube > Normalization(const Cube &cubeIn, const Cube &whiteReference, const Cube &blackReference, NormalizationMethod normalizationMethod)
Normalizes a cube.
Definition arithmetic.hpp:110
std::unique_ptr< Cube > Addition(const Cube &cube1, const Cube &cube2, PixelOverflow overflowHandling=PixelOverflow::Unhandled)
Element-wise addition of two cubes.
Definition arithmetic.hpp:27
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17