25 #include "ImageCalc.hh"
34 template<
class StorageType>
52 const unsigned int size = in1.
GetWidth()
57 for (
unsigned int i = 0; i < size; i++) {
58 outData[i] = in1Data[i] + in2Data[i];
62 template<
class StorageType>
79 const unsigned int size = in1.
GetWidth()
84 for (
unsigned int i = 0; i < size; i++) {
85 outData[i] = in1Data[i] - in2Data[i];
89 template<
class StorageType>
106 const unsigned int size = in1.
GetWidth()
111 for (
unsigned int i = 0; i < size; i++) {
112 outData[i] = in1Data[i] * in2Data[i];
116 template<
class StorageType>
133 const unsigned int size = in1.
GetWidth()
138 for (
unsigned int i = 0; i < size; i++) {
139 if (in2Data[i] != (StorageType)0) {
140 outData[i] = in1Data[i] / in2Data[i];
143 BIASWARN(
"prevented division by zero")
144 outData[i] = (StorageType)0;
149 template <
class StorageType>
167 const unsigned int size = in1.
GetWidth()
172 for (
unsigned int i = 0; i < size; i++) {
173 if (in1Data[i] != 0 && in2Data[i] != 0) {
182 template <
class StorageType>
200 const unsigned int size = in1.
GetWidth()
205 for (
unsigned int i = 0; i < size; i++) {
206 if (in1Data[i] == 0 || in2Data[i] == 0) {
215 template <
class StorageType>
233 const unsigned int size = in1.
GetWidth()
238 for (
unsigned int i = 0; i < size; i++) {
239 if (in1Data[i] != 0 || in2Data[i] != 0) {
248 template <
class StorageType>
266 const unsigned int size = in1.
GetWidth()
271 for (
unsigned int i = 0; i < size; i++) {
272 if (in1Data[i] == 0 && in2Data[i] == 0) {
281 template <
class StorageType>
299 const unsigned int size = in1.
GetWidth()
304 for (
unsigned int i = 0; i < size; i++) {
305 if ((in1Data[i] != 0 && in2Data[i] == 0)
307 (in1Data[i] == 0 && in2Data[i] != 0)) {
320 template <
class StorageType>
331 const unsigned int size = in.
GetWidth()
336 for (
unsigned int i = 0; i < size; i++) {
337 outData[i] = inData[i] + scalar;
341 template <
class StorageType>
352 const unsigned int size = in.
GetWidth()
357 for (
unsigned int i = 0; i < size; i++) {
358 outData[i] = inData[i] - scalar;
362 template <
class StorageType>
373 const unsigned int size = in.
GetWidth()
378 for (
unsigned int i = 0; i < size; i++) {
379 outData[i] = inData[i] * scalar;
383 template <
class StorageType>
387 BIASASSERT(scalar != (StorageType)0)
396 const unsigned int size = in.
GetWidth()
401 for (
unsigned int i = 0; i < size; i++) {
402 outData[i] = inData[i] / scalar;
410 template <
class StorageType>
420 const unsigned int size = in.
GetWidth()
425 for (
unsigned int i = 0; i < size; i++) {
426 outData[i] = StorageType(log(
double(inData[i])));
430 template <
class StorageType>
440 const unsigned int size = in.
GetWidth()
445 for (
unsigned int i = 0; i < size; i++) {
446 outData[i] = StorageType(log10(
double(inData[i])));
450 template <
class StorageType>
460 const unsigned int size = in.
GetWidth()
465 for (
unsigned int i = 0; i < size; i++) {
466 outData[i] = (StorageType)abs(inData[i]);
471 #define INSTANCE_ImageCalc(type)\
472 template class BIASImageUtilsBase_EXPORT ImageCalc<type>;
474 INSTANCE_ImageCalc(
unsigned char)
475 INSTANCE_ImageCalc(
float)
476 #ifdef BUILD_IMAGE_INT
477 INSTANCE_ImageCalc(
int)
479 #ifdef BUILD_IMAGE_CHAR
480 INSTANCE_ImageCalc(
char)
482 #ifdef BUILD_IMAGE_SHORT
483 INSTANCE_ImageCalc(
short)
485 #ifdef BUILD_IMAGE_USHORT
486 INSTANCE_ImageCalc(
unsigned short)
488 #ifdef BUILD_IMAGE_DOUBLE
489 INSTANCE_ImageCalc(
double)
491 #ifdef BUILD_IMAGE_UINT
492 INSTANCE_ImageCalc(
unsigned int)
unsigned int GetWidth() const
Performs pixelwise arithmetic and boolean operations on images.
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
unsigned int GetHeight() const
The image template class for specific storage types.
void Init(unsigned int Width, unsigned int Height, unsigned int channels=1, enum EStorageType storageType=ST_unsignedchar, const bool interleaved=true)
calls Init from ImageBase storageType is ignored, just dummy argument
const StorageType * GetImageData() const
overloaded GetImageData() from ImageBase
enum EStorageType GetStorageType() const