20 #ifndef MIRTK_TernaryVoxelFunction_H 21 #define MIRTK_TernaryVoxelFunction_H 23 #include "mirtk/VoxelFunction.h" 45 namespace TernaryVoxelFunction {
54 template <
class T1,
class T2,
class T3>
55 void operator ()(
const T1 *in1,
const T2 *in2, T3 *out)
57 *out =
static_cast<T3
>(
static_cast<double>(*in1) +
static_cast<double>(*in2));
60 template <
class TImage,
class T1,
class T2,
class T3>
61 void operator ()(
const TImage&,
int,
const T1 *in1,
const T2 *in2, T3 *out)
63 this->operator ()(in1, in2, out);
66 template <
class T1,
class T2,
class T3>
67 void operator ()(
int,
int,
int,
int,
const T1 *in1,
const T2 *in2, T3 *out)
69 this->operator ()(in1, in2, out);
79 template <
class T1,
class T2,
class T3>
80 void operator ()(
const T1 *in1,
const T2 *in2, T3 *out)
82 *out =
static_cast<T3
>(
static_cast<double>(*in1) -
static_cast<double>(*in2));
85 template <
class TImage,
class T1,
class T2,
class T3>
86 void operator ()(
const TImage&,
int,
const T1 *in1,
const T2 *in2, T3 *out)
88 this->operator ()(in1, in2, out);
91 template <
class T1,
class T2,
class T3>
92 void operator ()(
int,
int,
int,
int,
const T1 *in1,
const T2 *in2, T3 *out)
94 this->operator ()(in1, in2, out);
104 template <
class T1,
class T2,
class T3>
105 void operator ()(
const T1 *in1,
const T2 *in2, T3 *out)
107 *out =
static_cast<T3
>(
static_cast<double>(*in1) *
static_cast<double>(*in2));
110 template <
class TImage,
class T1,
class T2,
class T3>
111 void operator ()(
const TImage&,
int,
const T1 *in1,
const T2 *in2, T3 *out)
113 this->operator ()(in1, in2, out);
116 template <
class T1,
class T2,
class T3>
117 void operator ()(
int,
int,
int,
int,
const T1 *in1,
const T2 *in2, T3 *out)
119 this->operator ()(in1, in2, out);
132 template <
class T1,
class T2,
class T3>
133 void operator ()(
const T1 *in1,
const T2 *in2, T3 *out)
135 double divisor =
static_cast<double>(*in2);
137 *out =
static_cast<T3
>(0);
139 *out =
static_cast<T3
>(
static_cast<double>(*in1) / divisor);
143 template <
class TImage,
class T1,
class T2,
class T3>
144 void operator ()(
const TImage&,
int,
const T1 *in1,
const T2 *in2, T3 *out)
146 this->operator ()(in1, in2, out);
149 template <
class T1,
class T2,
class T3>
150 void operator ()(
int,
int,
int,
int,
const T1 *in1,
const T2 *in2, T3 *out)
152 this->operator ()(in1, in2, out);
159 #endif // MIRTK_TernaryVoxelFunction_H
Mul Prod
Alternative name for Mul voxel function.