| 1 | /********************************************************************** |
| 2 | jlcrop_lib.h: perform raster data operations on image such as crop, extract and stack bands |
| 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 _JLCROP_LIB_H_ |
| 22 | #define _JLCROP_LIB_H_ |
| 23 | #include "imageclasses/Jim.h" |
| 24 | |
| 25 | template<typename T1, typename T2> void Jim::convertDataType_t(Jim& imgWriter){ |
| 26 | #if JIPLIB_PROCESS_IN_PARALLEL == 1 |
| 27 | #pragma omp parallel for |
| 28 | #else |
| 29 | #endif |
| 30 | for(size_t iband=0;iband<nrOfBand();++iband){ |
| 31 | T1* psrc=static_cast<T1*>(getDataPointer(iband)); |
| 32 | T2* ptrt=static_cast<T2*>(imgWriter.getDataPointer(iband)); |
| 33 | for(size_t index=0;index<nrOfCol()*nrOfRow()*nrOfPlane();++index){ |
| 34 | ptrt[index]=psrc[index]; |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | #endif // _JLCROP_LIB_H_ |