Debian Codegraph @

src/imageclasses/jloperators_lib.h

raw symbols SCIP
1 /**********************************************************************
2 jloperators.h: operators for Jim
3 Author(s): [email protected]
4 Copyright (C) 2016-2020 European Union (Joint Research Centre)
5
6 This file is part of jiplib.
7
8 jiplib is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 jiplib is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with jiplib. If not, see <https://www.gnu.org/licenses/>.
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 // _JLOPERATORS_LIB_H_