itom 1.0.14
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2013, Institut für Technische Optik (ITO), 00005 Universität Stuttgart, Germany 00006 00007 This file is part of itom and its software development toolkit (SDK). 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 In addition, as a special exception, the Institut für Technische 00015 Optik (ITO) gives you certain additional rights. 00016 These rights are described in the ITO LGPL Exception version 1.0, 00017 which can be found in the file LGPL_EXCEPTION.txt in this package. 00018 00019 itom is distributed in the hope that it will be useful, but 00020 WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00022 General Public Licence for more details. 00023 00024 You should have received a copy of the GNU Library General Public License 00025 along with itom. If not, see <http://www.gnu.org/licenses/>. 00026 *********************************************************************** */ 00027 00028 #ifndef __DATAOBJFUNCH 00029 #define __DATAOBJFUNCH 00030 00031 #include "dataobj.h" 00032 00034 #define MAKEHELPERFUNCLIST(FuncName) static t##FuncName fList##FuncName[] = \ 00035 { \ 00036 FuncName<int8>, \ 00037 FuncName<uint8>, \ 00038 FuncName<int16>, \ 00039 FuncName<uint16>, \ 00040 FuncName<int32>, \ 00041 FuncName<uint32>, \ 00042 FuncName<ito::float32>, \ 00043 FuncName<ito::float64>, \ 00044 FuncName<ito::complex64>, \ 00045 FuncName<ito::complex128> \ 00046 }; 00047 00049 #define MAKEHELPERFUNCLIST_CMPLX_TO_REAL(FuncName) static t##FuncName fList##FuncName[] = \ 00050 { \ 00051 FuncName<ito::complex64,float32>, \ 00052 FuncName<ito::complex128,float64> \ 00053 }; 00054 00055 namespace ito 00056 { 00057 namespace dObjHelper 00058 { 00059 // Invert the unitString 00060 inline std::string invertUnit(const std::string oldUnit) 00061 { 00062 if(oldUnit.empty()) 00063 return oldUnit; 00064 00065 size_t found = oldUnit.find('/'); 00066 00067 if(found!=std::string::npos) 00068 { 00069 if(found == 0) 00070 { 00071 return oldUnit.substr(1, oldUnit.length() - 1); 00072 } 00073 else if(oldUnit[0] == '1' && found == 1) 00074 { 00075 return oldUnit.substr(2, oldUnit.length() - 2); 00076 } 00077 else 00078 { 00079 std::string newString; 00080 newString.reserve(oldUnit.length()); 00081 newString.append(oldUnit.substr(found + 1, oldUnit.length()- (found + 1))); 00082 newString.append("/"); 00083 newString.append(oldUnit.substr(0, found)); 00084 } 00085 } 00086 else 00087 { 00088 std::string newString; 00089 newString.reserve(oldUnit.length()+2); 00090 newString.append(oldUnit); 00091 return newString; 00092 } 00093 return ""; 00094 } 00095 00096 //---------------------------------------------------------------------------------------------------------------------------------- 00103 inline int itomType2cvType(const int type) 00104 { 00105 switch(type) 00106 { 00107 case ito::tUInt8: 00108 return CV_8U; 00109 case ito::tUInt16: 00110 return CV_16U; 00111 case ito::tInt8: 00112 return CV_8S; 00113 case ito::tInt16: 00114 return CV_16S; 00115 case ito::tInt32: 00116 return CV_32S; 00117 case ito::tFloat32: 00118 return CV_32F; 00119 case ito::tFloat64: 00120 return CV_64F; 00121 default: //ito::tUInt32 and complextype 00122 return -1; 00123 } 00124 } 00125 //---------------------------------------------------------------------------------------------------------------------------------- 00132 inline int cvType2itomType(const int type) 00133 { 00134 switch(type) 00135 { 00136 case CV_8U: 00137 return ito::tUInt8; 00138 case CV_16U: 00139 return ito::tUInt16; 00140 case CV_8S: 00141 return ito::tInt8; 00142 case CV_16S: 00143 return ito::tInt16; 00144 case CV_32S: 00145 return ito::tInt32; 00146 case CV_32F: 00147 return ito::tFloat32; 00148 case CV_64F: 00149 return ito::tFloat64; 00150 default: 00151 return -1; 00152 } 00153 } 00154 00156 template<typename _Tp> void GetHLineL(const cv::Mat *srcPlane, const int x0, const int y, const int length, int32 * pData); 00157 00159 template<typename _Tp> void GetHLineD(const cv::Mat *srcPlane, const int x0, const int y, const int length, float64 * pData); 00160 00162 template<typename _Tp> void SetHLineL(cv::Mat *destPlane, const int x0, const int y, const int length, const int32 * pData); 00163 00165 template<typename _Tp> void SetHLineD(cv::Mat *destPlane, const int x0, const int y, const int length, const float64 * pData); 00166 00167 //----------------------------------------------------------------------------------------------- 00179 template<typename _Tp> inline void GetHLineL(const cv::Mat *srcPlane, const int x0, const int y, const int length, int32 * pData) 00180 { 00181 _Tp* resRowPtr; 00182 resRowPtr = (_Tp*)(srcPlane->ptr(y)); 00183 00184 int x = x0; 00185 for(int i = 0; i < length; i++, x++) 00186 { 00187 pData[i] = (int32)(resRowPtr[x]); 00188 } 00189 } 00190 00191 //----------------------------------------------------------------------------------------------- 00202 template<> inline void GetHLineL<int32>(const cv::Mat *srcPlane, const int x0, const int y, const int length, int32 * pData) 00203 { 00204 int32* resRowPtr; 00205 resRowPtr = (int32*)(srcPlane->ptr(y)); 00206 memcpy(pData, &resRowPtr[x0], length *sizeof(int32)); 00207 } 00208 00209 //----------------------------------------------------------------------------------------------- 00221 template<typename _Tp> inline void GetHLineD(const cv::Mat *srcPlane, const int x0, const int y, const int length, float64 * pData) 00222 { 00223 _Tp* resRowPtr; 00224 resRowPtr = (_Tp*)(srcPlane->ptr(y)); 00225 00226 int x = x0; 00227 for(int i = 0; i < length; i++, x++) 00228 { 00229 pData[i] = cv::saturate_cast<ito::float64>(resRowPtr[x]); 00230 } 00231 } 00232 00233 //----------------------------------------------------------------------------------------------- 00244 template<> inline void GetHLineD<ito::float64>(const cv::Mat *srcPlane, const int x0, const int y, const int length, float64 * pData) 00245 { 00246 float64* resRowPtr; 00247 resRowPtr = (float64*)(srcPlane->ptr(y)); 00248 memcpy(pData, &resRowPtr[x0], length *sizeof(float64)); 00249 } 00250 00251 //----------------------------------------------------------------------------------------------- 00263 template<typename _Tp> inline void SetHLineL(cv::Mat *destPlane, const int x0, const int y, const int length, const int32 * pData) 00264 { 00265 _Tp* resRowPtr; 00266 resRowPtr = (_Tp*)(destPlane->ptr(y)); 00267 00268 int x = x0; 00269 for(int i = 0; i < length; i++, x++) 00270 { 00271 resRowPtr[x] = (_Tp)(pData[i]); 00272 } 00273 } 00274 00275 //----------------------------------------------------------------------------------------------- 00287 template<> inline void SetHLineL<int32>(cv::Mat *destPlane, const int x0, const int y, const int length, const int32 * pData) 00288 { 00289 int32* resRowPtr; 00290 resRowPtr = (int32*)(destPlane->ptr(y)); 00291 memcpy(&resRowPtr[x0], pData, length *sizeof(int32)); 00292 } 00293 00294 //----------------------------------------------------------------------------------------------- 00306 template<typename _Tp> inline void SetHLineD(cv::Mat *destPlane, const int x0, const int y, const int length, const float64 * pData) 00307 { 00308 _Tp* resRowPtr; 00309 resRowPtr = (_Tp*)destPlane->ptr(y); 00310 00311 int x = x0; 00312 for(int i = 0; i < length; i++, x++) 00313 { 00314 resRowPtr[x] = cv::saturate_cast<_Tp>(pData[i]); 00315 } 00316 } 00317 00318 //----------------------------------------------------------------------------------------------- 00330 template<> inline void SetHLineD<ito::float64>(cv::Mat *destPlane, const int x0, const int y, const int length, const float64 * pData) 00331 { 00332 float64* resRowPtr; 00333 resRowPtr = (float64*)(destPlane->ptr(y)); 00334 memcpy(&resRowPtr[x0], pData, length *sizeof(float64)); 00335 } 00336 00338 template<typename _Tp> inline bool isNotZero(_Tp value) 00339 { 00340 if(value == 0) 00341 return false; 00342 else 00343 return true; 00344 } 00345 00347 template<> inline bool isNotZero<float32>(float32 value) 00348 { 00349 float32 lowVal = std::numeric_limits<float32>::epsilon(); 00350 if(fabs(value) < lowVal) 00351 return false; 00352 else 00353 return true; 00354 } 00355 00357 template<> inline bool isNotZero<float64>(float64 value) 00358 { 00359 float64 lowVal = std::numeric_limits<float64>::epsilon(); 00360 if(fabs(value) < lowVal) 00361 return false; 00362 else 00363 return true; 00364 } 00365 00367 template<typename _Tp> inline bool isFinite(_Tp /*value*/) 00368 { 00369 return true; 00370 } 00371 00373 template<> inline bool isFinite<float32>(float32 value) 00374 { 00375 uchar *ch = (uchar *)&value; 00376 return (ch[3] & 0x7f) != 0x7f || (ch[2] & 0x80) != 0x80; 00377 } 00378 00380 template<> inline bool isFinite<float64>(float64 value) 00381 { 00382 uchar *ch = (uchar *)&value; 00383 return (ch[7] & 0x7f) != 0x7f || (ch[6] & 0xf0) != 0xf0; 00384 } 00385 00387 template<> inline bool isFinite<complex64>(complex64 value) 00388 { 00389 float32 realVal = value.real(); 00390 float32 imagVal = value.real(); 00391 uchar *chreal = (uchar *)&realVal; 00392 uchar *chimag = (uchar *)&imagVal; 00393 return ((chreal[3] & 0x7f) != 0x7f || (chreal[2] & 0x80) != 0x80) && ((chimag[3] & 0x7f) != 0x7f || (chimag[2] & 0x80) != 0x80); 00394 } 00395 00397 template<> inline bool isFinite<complex128>(complex128 value) 00398 { 00399 float64 realVal = value.real(); 00400 float64 imagVal = value.real(); 00401 uchar *chreal = (uchar *)&realVal; 00402 uchar *chimag = (uchar *)&imagVal; 00403 return ((chreal[7] & 0x7f) != 0x7f || (chreal[6] & 0xf0) != 0xf0) && ((chimag[7] & 0x7f) != 0x7f || (chimag[6] & 0xf0) != 0xf0); 00404 } 00405 00407 template<typename _Tp> inline bool isNaN(_Tp value) 00408 { 00409 return false; 00410 } 00411 00413 template<> inline bool isNaN<float32>(float32 value) 00414 { 00415 uchar *ch = (uchar *)&value; 00416 return (ch[3] & 0x7f) == 0x7f && ch[2] > 0x80; 00417 } 00419 template<> inline bool isNaN<float64>(float64 value) 00420 { 00421 uchar *ch = (uchar *)&value; 00422 return (ch[7] & 0x7f) == 0x7f && ch[6] > 0xf0; 00423 } 00424 00426 template<> inline bool isNaN<complex64>(complex64 value) 00427 { 00428 float32 realVal = value.real(); 00429 float32 imagVal = value.real(); 00430 uchar *chreal = (uchar *)&realVal; 00431 uchar *chimag = (uchar *)&imagVal; 00432 return ((chreal[3] & 0x7f) == 0x7f && chreal[2] > 0x80) || ((chimag[3] & 0x7f) == 0x7f && chimag[2] > 0x80); 00433 } 00434 00436 template<> inline bool isNaN<complex128>(complex128 value) 00437 { 00438 float64 realVal = value.real(); 00439 float64 imagVal = value.real(); 00440 uchar *chreal = (uchar *)&realVal; 00441 uchar *chimag = (uchar *)&imagVal; 00442 return ((chreal[7] & 0x7f) == 0x7f && chreal[6] > 0xf0) || ((chimag[7] & 0x7f) == 0x7f && chimag[6] > 0xf0); 00443 } 00444 00446 template<typename _Tp> inline bool isInf(_Tp /*value*/) 00447 { 00448 return false; 00449 } 00450 00452 template<> inline bool isInf<float32>(float32 value) 00453 { 00454 uchar *ch = (uchar *)&value; 00455 return (ch[3] & 0x7f) == 0x7f && ch[2] == 0x80; 00456 } 00457 00459 template<> inline bool isInf<float64>(float64 value) 00460 { 00461 uchar *ch = (uchar *)&value; 00462 return (ch[7] & 0x7f) == 0x7f && ch[6] == 0xf0; 00463 } 00464 00466 template<> inline bool isInf<complex64>(complex64 value) 00467 { 00468 float32 realVal = value.real(); 00469 float32 imagVal = value.real(); 00470 uchar *chreal = (uchar *)&realVal; 00471 uchar *chimag = (uchar *)&imagVal; 00472 return ((chreal[3] & 0x7f) == 0x7f && chreal[2] == 0x80) || ((chimag[3] & 0x7f) == 0x7f && chimag[2] == 0x80); 00473 } 00474 00476 template<> inline bool isInf<complex128>(complex128 value) 00477 { 00478 float64 realVal = value.real(); 00479 float64 imagVal = value.real(); 00480 uchar *chreal = (uchar *)&realVal; 00481 uchar *chimag = (uchar *)&imagVal; 00482 return ((chreal[7] & 0x7f) == 0x7f && chreal[6] == 0xf0) || ((chimag[7] & 0x7f) == 0x7f && chimag[6] == 0xf0); 00483 } 00484 00486 template<typename _Tp> RetVal minValueFunc(const DataObject *dObj, float64 &minValue, uint32 *firstLocation, bool ignoreInf = true); 00487 00489 RetVal minValue(const DataObject *dObj, float64 &minValue, uint32 *firstLocation, bool ignoreInf = true); 00490 00492 template<typename _Tp> RetVal maxValueFunc(const DataObject *dObj, float64 &maxValue, uint32 *firstLocation, bool ignoreInf = true); 00493 00495 RetVal maxValue(const DataObject *dObj, float64 &maxValue, uint32 *firstLocation, bool ignoreInf = true); 00496 00498 template<typename _Tp> RetVal minMaxValueFunc(const DataObject *dObj, float64 &minValue, uint32 *firstMinLocation, float64 &maxValue, uint32 *firstMaxLocation, bool ignoreInf = true, const int cmplxSel = 0); 00499 00501 RetVal minMaxValue(const DataObject *dObj, float64 &minValue, uint32 *firstMinLocation, float64 &maxValue, uint32 *firstMaxLocation, bool ignoreInf = true, const int cmplxSel = 0); 00502 00503 template<typename _Tp, typename _BufTp> RetVal meanValueFunc(const DataObject *dObj, float64 &meanResult, bool ignoreNaN = true); 00504 RetVal meanValue(const DataObject *dObj, float64 &meanResult, bool ignoreNaN = true); 00505 00506 template<typename _Tp, typename _BufTp> RetVal devValueFunc(const ito::DataObject *dObj, const int devTypFlag, float64 &meanResult, float64 &devResult, bool ignoreNaN = true); 00507 RetVal devValue(const DataObject *dObj, const int devTypFlag, float64 &meanResult, float64 &devResult, bool ignoreNaN = true); 00508 00509 RetVal calcCVDFT(DataObject *dObjIO, const bool inverse, const bool inverseAsReal, const bool lineWise); 00510 00511 ito::RetVal verifyDataObjectType(const ito::DataObject* dObj, const char* name, uint8 numberOfAllowedTypes, ...); //append allowed data types, e.g. ito::tUint8, ito::tInt8... (order does not care) 00512 ito::RetVal verify2DDataObject(const ito::DataObject* dObj, const char* name, int sizeYMin, int sizeYMax, int sizeXMin, int sizeXMax, uint8 numberOfAllowedTypes, ...); //append allowed data types, e.g. ito::tUint8, ito::tInt8... (order does not care) 00513 ito::RetVal verify3DDataObject(const ito::DataObject* dObj, const char* name, int sizeZMin, int sizeZMax, int sizeYMin, int sizeYMax, int sizeXMin, int sizeXMax, uint8 numberOfAllowedTypes, ...); //append allowed data types, e.g. ito::tUint8, ito::tInt8... (order does not care) 00514 ito::RetVal verifySize(size_t size, int minSize, int maxSize, const char *axisName, const char* dObjName); 00515 00516 //----------------------------------------------------------------------------------------------- 00529 template<typename _Tp> ito::RetVal freeRowPointer(_Tp *** &pointer) 00530 { 00531 if(pointer == NULL) 00532 { 00533 return ito::RetVal::format(ito::retError, 0, "Delete rowpointer failed, pointer was not allocated freeRowPointer(...)"); 00534 } 00535 00536 int i = 0; 00537 00538 while(pointer[i] != 0) 00539 { 00540 delete[] pointer[i]; 00541 i++; 00542 // end of pointer is marked by a NULL-Pointer 00543 } 00544 00545 delete[] pointer; 00546 pointer = NULL; 00547 00548 return ito::retOk; 00549 } 00550 00566 template<typename _Tp> ito::RetVal getRowPointer(ito::DataObject* dObj, _Tp *** &pointer) 00567 { 00568 00569 if(!dObj) 00570 { 00571 return ito::RetVal::format(ito::retError, 0, "DataObject was a NULL pointer in function getRowPointer(...)"); 00572 } 00573 00574 if(dObj->getType() != ito::getDataType2<_Tp*>()) 00575 { 00576 return ito::RetVal::format(ito::retError, 0, "DataObject and template Type differed in function getRowPointer(...)"); 00577 } 00578 00579 if(dObj->getDims() < 2) 00580 { 00581 return ito::RetVal::format(ito::retError, 0, "DataObject was not initialized in function getRowPointer(...)"); 00582 } 00583 00584 pointer = new _Tp** [dObj->calcNumMats() + 1]; 00585 00586 if(pointer == NULL) 00587 { 00588 return ito::RetVal::format(ito::retError, 0, "Allocate plane-pointer failed in function getRowPointer(...)"); 00589 } 00590 00591 ito::RetVal retVal(ito::retOk); 00592 memset(pointer, 0, (dObj->calcNumMats() + 1) * sizeof(size_t)); 00593 int sizeY = dObj->getSize(dObj->getDims() - 2); 00594 00595 int** mdata = dObj->get_mdata(); 00596 00597 for(int i = 0; i < dObj->calcNumMats(); i++) 00598 { 00599 pointer[i] = new _Tp*[sizeY]; 00600 if(pointer[i]) 00601 { 00602 for(int y = 0; y < sizeY; y++) 00603 { 00604 pointer[i][y] = ((cv::Mat*)(mdata[dObj->seekMat(i)]))->ptr<_Tp>(y); 00605 } 00606 } 00607 else 00608 { 00609 retVal += ito::RetVal::format(ito::retError, 0, "Allocate row-pointer failed in function getRowPointer(...)"); 00610 break; 00611 } 00612 } 00613 00614 if(retVal.containsError()) 00615 { 00616 freeRowPointer(pointer); 00617 } 00618 return retVal; 00619 } 00620 00621 //template<typename _Tp> void minMaxValueHelper(ito::DataObject *dObj, float64 *min, float64 *max, int matNumber); 00622 00623 //----------------------------------------------------------------------------------------------- 00641 /* 00642 inline ito::RetVal checkITOMType(ito::DataObject *dObj, bool allow_int8, bool allow_uint8, bool allow_int16, bool allow_uint16, bool allow_int32, bool allow_uint32, bool allow_float32, bool allow_float64, bool allow_complex64, bool allow_complex128) 00643 { 00644 int type = dObj->getType(); 00645 switch(type) 00646 { 00647 case ito::tUInt8: 00648 if(allow_uint8) 00649 return ito::retOk; 00650 else return ito::RetVal(ito::retError, 0, "UInt8 not allowed"); 00651 case ito::tUInt16: 00652 if(allow_uint16) 00653 return ito::retOk; 00654 else return ito::RetVal(ito::retError, 0, "UInt16 not allowed"); 00655 case ito::tUInt32: 00656 if(allow_uint32) 00657 return ito::retOk; 00658 else return ito::RetVal(ito::retError, 0, "UInt32 not allowed"); 00659 case ito::tInt8: 00660 if(allow_int8) 00661 return ito::retOk; 00662 else return ito::RetVal(ito::retError, 0, "Int8 not allowed"); 00663 case ito::tInt16: 00664 if(allow_int16) 00665 return ito::retOk; 00666 else return ito::RetVal(ito::retError, 0, "Int16 not allowed"); 00667 case ito::tInt32: 00668 if(allow_int32) 00669 return ito::retOk; 00670 else return ito::RetVal(ito::retError, 0, "Int32 not allowed"); 00671 case ito::tFloat32: 00672 if(allow_float32) 00673 return ito::retOk; 00674 else return ito::RetVal(ito::retError, 0, "Float32 not allowed"); 00675 case ito::tFloat64: 00676 if(allow_float64) 00677 return 0; 00678 else return ito::RetVal(ito::retError, 0, "Float64 not allowed"); 00679 case ito::tComplex64: 00680 if(allow_complex64) 00681 return ito::retOk; 00682 else return ito::RetVal(ito::retError, 0, "Complex64 not allowed"); 00683 case ito::tComplex128: 00684 if(allow_complex128) 00685 return 0; 00686 else return ito::RetVal(ito::retError, 0, "Complex128 not allowed"); 00687 default: 00688 return ito::RetVal(ito::retError, 0, "Unknown type or type not implemented"); 00689 } 00690 } 00691 */ 00692 00693 //----------------------------------------------------------------------------------------------- 00702 inline bool isIntType(const int type, int *size) 00703 { 00704 if((type == ito::tInt8)||(type == ito::tUInt8)) 00705 { 00706 *size = 1; 00707 return true; 00708 } 00709 else if((type == ito::tInt16)||(type == ito::tUInt16)) 00710 { 00711 *size = 2; 00712 return true; 00713 } 00714 else if((type == ito::tInt32)||(type == ito::tUInt32)) 00715 { 00716 *size = 4; 00717 return true; 00718 } 00719 else 00720 { 00721 *size = -1; 00722 return false; 00723 } 00724 } 00725 00726 //----------------------------------------------------------------------------------------------- 00735 inline bool isFPType(const int type, int *size) 00736 { 00737 if((type == ito::tFloat32)) 00738 { 00739 *size = 4; 00740 return true; 00741 } 00742 else if((type == ito::tFloat64)) 00743 { 00744 *size = 8; 00745 return true; 00746 } 00747 else 00748 { 00749 *size = -1; 00750 return false; 00751 } 00752 } 00753 00754 //----------------------------------------------------------------------------------------------- 00763 inline bool isCplxType(const int type, int *size) 00764 { 00765 if((type == ito::tComplex64)) 00766 { 00767 *size = 8; 00768 return true; 00769 } 00770 else if((type == ito::tComplex128)) 00771 { 00772 *size = 16; 00773 return true; 00774 } 00775 else 00776 { 00777 *size = -1; 00778 return false; 00779 } 00780 } 00781 00782 //----------------------------------------------------------------------------------------------- 00795 inline bool dObjareEqualDetail(ito::DataObject *dObj1, ito::DataObject *dObj2, bool &typeFlag, bool &dimsFlag, bool &last2DimsFlag) 00796 { 00797 bool retVal = true; 00798 typeFlag = true; 00799 dimsFlag = true; 00800 last2DimsFlag = true; 00801 //transFlag = true; 00802 00803 if(dObj1->getType() != dObj2->getType()) 00804 { 00805 retVal = false; 00806 typeFlag = false; 00807 } 00808 /*if(dObj1->isT() != dObj2->isT()) 00809 { 00810 retVal = false; 00811 transFlag = false; 00812 }*/ 00813 00814 if(dObj1->getDims() != dObj2->getDims()) 00815 { 00816 retVal = false; 00817 dimsFlag = false; 00818 if(dObj1->getSize(dObj1->getDims() - 2) != dObj2->getSize(dObj2->getDims() - 2)) 00819 { 00820 last2DimsFlag = false; 00821 } 00822 if(dObj1->getSize(dObj1->getDims() - 1) != dObj2->getSize(dObj2->getDims() - 1)) 00823 { 00824 last2DimsFlag = false; 00825 } 00826 } 00827 else 00828 { 00829 for(int i = 0; i < dObj1->getDims()-2; i++) 00830 { 00831 if(dObj1->getSize(i) != dObj2->getSize(i)) 00832 { 00833 retVal = false; 00834 } 00835 } 00836 if(dObj1->getSize(dObj1->getDims() - 2) != dObj2->getSize(dObj2->getDims() - 2)) 00837 { 00838 last2DimsFlag = false; 00839 retVal = false; 00840 } 00841 if(dObj1->getSize(dObj1->getDims() - 1) != dObj2->getSize(dObj2->getDims() - 1)) 00842 { 00843 last2DimsFlag = false; 00844 retVal = false; 00845 } 00846 } 00847 return retVal; 00848 } 00849 00850 //----------------------------------------------------------------------------------------------- 00860 inline bool dObjareEqualShort(ito::DataObject *obj1, ito::DataObject *obj2) 00861 { 00862 if(obj1->getDims() == obj2->getDims() && obj1->getType() == obj2->getType() /*&& obj1->isT() == obj2->isT()*/) 00863 { 00864 for(int i = 0; i < obj1->getDims(); i++) 00865 { 00866 if(obj1->getSize(i) != obj2->getSize(i)) 00867 { 00868 return false; 00869 } 00870 } 00871 return true; 00872 } 00873 else 00874 return false; 00875 } 00876 00878 ito::RetVal dObjCopyLastNAxisTags(const ito::DataObject &DataObjectIn, ito::DataObject &DataObjectOut, const int copyLastNDims, const bool includeValueTags = true, const bool includeRotationMatrix = true); 00879 } 00880 } 00881 00882 #endif