| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef _JLOPERATORS_LIB_H_ |
| 22 |
#define _JLOPERATORS_LIB_H_ |
| 23 |
|
| 24 |
#include "Jim.h" |
| 25 |
|
| 26 |
template<typename T> void Jim::lt_t(Jim& other, Jim& imgWriter){ |
| 27 |
#if JIPLIB_PROCESS_IN_PARALLEL == 1 |
| 28 |
#pragma omp parallel for |
| 29 |
#else |
| 30 |
#endif |
| 31 |
for(size_t iband=0;iband<nrOfBand();++iband){ |
| 32 |
T* p1=static_cast<T*>(getDataPointer(iband)); |
| 33 |
T* p2=static_cast<T*>(other.getDataPointer(iband)); |
| 34 |
unsigned char* pout=static_cast<unsigned char*>(imgWriter.getDataPointer(static_cast<int>(iband))); |
| 35 |
for(size_t index=0;index<nrOfCol()*nrOfRow()*nrOfPlane();++index){ |
| 36 |
if(*p1<*p2) |
| 37 |
*pout=1; |
| 38 |
else |
| 39 |
*pout=0; |
| 40 |
++p1; |
| 41 |
++p2; |
| 42 |
++pout; |
| 43 |
} |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
template<typename T> void Jim::lt_t(double value, Jim& imgWriter){ |
| 48 |
#if JIPLIB_PROCESS_IN_PARALLEL == 1 |
| 49 |
#pragma omp parallel for |
| 50 |
#else |
| 51 |
#endif |
| 52 |
for(size_t iband=0;iband<nrOfBand();++iband){ |
| 53 |
T* p1=static_cast<T*>(getDataPointer(iband)); |
| 54 |
unsigned char* pout=static_cast<unsigned char*>(imgWriter.getDataPointer(static_cast<int>(iband))); |
| 55 |
for(size_t index=0;index<nrOfCol()*nrOfRow()*nrOfPlane();++index){ |
| 56 |
if(*p1<value) |
| 57 |
*pout=1; |
| 58 |
else |
| 59 |
*pout=0; |
| 60 |
++p1; |
| 61 |
++pout; |
| 62 |
} |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
#endif |