itom 1.4.0
|
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 FuncName<ito::Rgba32> \ 00047 }; 00048 00050 #define MAKEHELPERFUNCLIST_CMPLX_TO_REAL(FuncName) static t##FuncName fList##FuncName[] = \ 00051 { \ 00052 FuncName<ito::complex64,float32>, \ 00053 FuncName<ito::complex128,float64> \ 00054 }; 00055 00056 namespace ito 00057 { 00058 namespace dObjHelper 00059 { 00060 enum CmplxSelectionFlags 00061 { 00062 CMPLX_ABS_VALUE = 0, 00063 CMPLX_IMAGINARY_VALUE = 1, 00064 CMPLX_REAL_VALUE = 2, 00065 CMPLX_ARGUMENT_VALUE = 3 00066 }; 00067 00068 // Invert the unitString 00069 inline std::string invertUnit(const std::string &oldUnit) 00070 { 00071 if(oldUnit.empty()) 00072 return oldUnit; 00073 00074 int found = (int)oldUnit.find('/'); 00075 00076 if(found!=std::string::npos) 00077 { 00078 if(found == 0) 00079 { 00080 return oldUnit.substr(1, oldUnit.length() - 1); 00081 } 00082 else if(oldUnit[0] == '1' && found == 1) 00083 { 00084 return oldUnit.substr(2, oldUnit.length() - 2); 00085 } 00086 else 00087 { 00088 std::string newString; 00089 newString.reserve(oldUnit.length()); 00090 newString.append(oldUnit.substr(found + 1, oldUnit.length()- (found + 1))); 00091 newString.append("/"); 00092 newString.append(oldUnit.substr(0, found)); 00093 } 00094 } 00095 else 00096 { 00097 std::string newString; 00098 newString.reserve(oldUnit.length()+2); 00099 newString.append("1/"); 00100 newString.append(oldUnit); 00101 return newString; 00102 } 00103 return ""; 00104 } 00105 00106 //---------------------------------------------------------------------------------------------------------------------------------- 00113 inline int itomType2cvType(const int type) 00114 { 00115 switch(type) 00116 { 00117 case ito::tUInt8: 00118 return CV_8U; 00119 case ito::tUInt16: 00120 return CV_16U; 00121 case ito::tInt8: 00122 return CV_8S; 00123 case ito::tInt16: 00124 return CV_16S; 00125 case ito::tInt32: 00126 return CV_32S; 00127 case ito::tFloat32: 00128 return CV_32F; 00129 case ito::tFloat64: 00130 return CV_64F; 00131 default: //ito::tUInt32 and complextype 00132 return -1; 00133 } 00134 } 00135 //---------------------------------------------------------------------------------------------------------------------------------- 00142 inline int cvType2itomType(const int type) 00143 { 00144 switch(type) 00145 { 00146 case CV_8U: 00147 return ito::tUInt8; 00148 case CV_16U: 00149 return ito::tUInt16; 00150 case CV_8S: 00151 return ito::tInt8; 00152 case CV_16S: 00153 return ito::tInt16; 00154 case CV_32S: 00155 return ito::tInt32; 00156 case CV_32F: 00157 return ito::tFloat32; 00158 case CV_64F: 00159 return ito::tFloat64; 00160 default: 00161 return -1; 00162 } 00163 } 00164 00166 template<typename _Tp> void GetHLineL(const cv::Mat *srcPlane, const int x0, const int y, const int length, int32 * pData); 00167 00169 template<typename _Tp> void GetHLineD(const cv::Mat *srcPlane, const int x0, const int y, const int length, float64 * pData); 00170 00172 template<typename _Tp> void GetHLineC(const cv::Mat *srcPlane, const int x0, const int y, const int length, complex128 * pData); 00173 00175 template<typename _Tp> void SetHLineL(cv::Mat *destPlane, const int x0, const int y, const int length, const int32 * pData); 00176 00178 template<typename _Tp> void SetHLineD(cv::Mat *destPlane, const int x0, const int y, const int length, const float64 * pData); 00179 00180 //----------------------------------------------------------------------------------------------- 00192 template<typename _Tp> inline void GetHLineL(const cv::Mat *srcPlane, const int x0, const int y, const int length, int32 * pData) 00193 { 00194 _Tp* resRowPtr; 00195 resRowPtr = (_Tp*)(srcPlane->ptr(y)); 00196 00197 int x = x0; 00198 for(int i = 0; i < length; i++, x++) 00199 { 00200 pData[i] = (int32)(resRowPtr[x]); 00201 } 00202 } 00203 00204 //----------------------------------------------------------------------------------------------- 00215 template<> inline void GetHLineL<int32>(const cv::Mat *srcPlane, const int x0, const int y, const int length, int32 * pData) 00216 { 00217 int32* resRowPtr; 00218 resRowPtr = (int32*)(srcPlane->ptr(y)); 00219 memcpy(pData, &resRowPtr[x0], length *sizeof(int32)); 00220 } 00221 00222 //----------------------------------------------------------------------------------------------- 00234 template<typename _Tp> inline void GetHLineD(const cv::Mat *srcPlane, const int x0, const int y, const int length, float64 * pData) 00235 { 00236 _Tp* resRowPtr; 00237 resRowPtr = (_Tp*)(srcPlane->ptr(y)); 00238 00239 int x = x0; 00240 for(int i = 0; i < length; i++, x++) 00241 { 00242 pData[i] = cv::saturate_cast<ito::float64>(resRowPtr[x]); 00243 } 00244 } 00245 00246 //----------------------------------------------------------------------------------------------- 00257 template<> inline void GetHLineD<ito::float64>(const cv::Mat *srcPlane, const int x0, const int y, const int length, float64 * pData) 00258 { 00259 float64* resRowPtr; 00260 resRowPtr = (float64*)(srcPlane->ptr(y)); 00261 memcpy(pData, &resRowPtr[x0], length *sizeof(float64)); 00262 } 00263 00264 //----------------------------------------------------------------------------------------------- 00276 template<typename _Tp> inline void GetHLineC(const cv::Mat *srcPlane, const int x0, const int y, const int length, complex128 * pData) 00277 { 00278 const _Tp* resRowPtr = srcPlane->ptr<_Tp>(y); 00279 00280 int x = x0; 00281 for(int i = 0; i < length; i++, x++) 00282 { 00283 pData[i] = complex128(cv::saturate_cast<ito::float64>(resRowPtr[x]), 0.0); 00284 } 00285 } 00286 00287 //----------------------------------------------------------------------------------------------- 00298 template<> inline void GetHLineC<complex64>(const cv::Mat *srcPlane, const int x0, const int y, const int length, complex128 * pData) 00299 { 00300 const complex64* resRowPtr = srcPlane->ptr<complex64>(y); 00301 00302 int x = x0; 00303 for(int i = 0; i < length; i++, x++) 00304 { 00305 pData[i] = complex128(resRowPtr[x].real(), resRowPtr[x].imag()); 00306 } 00307 } 00308 00309 //----------------------------------------------------------------------------------------------- 00320 template<> inline void GetHLineC<complex128>(const cv::Mat *srcPlane, const int x0, const int y, const int length, complex128 * pData) 00321 { 00322 const complex128* resRowPtr = srcPlane->ptr<complex128>(y); 00323 memcpy(pData, &resRowPtr[x0], length *sizeof(complex128)); 00324 } 00325 00326 //----------------------------------------------------------------------------------------------- 00338 template<typename _Tp> inline void SetHLineL(cv::Mat *destPlane, const int x0, const int y, const int length, const int32 * pData) 00339 { 00340 _Tp* resRowPtr; 00341 resRowPtr = (_Tp*)(destPlane->ptr(y)); 00342 00343 int x = x0; 00344 for(int i = 0; i < length; i++, x++) 00345 { 00346 resRowPtr[x] = (_Tp)(pData[i]); 00347 } 00348 } 00349 00350 //----------------------------------------------------------------------------------------------- 00362 template<> inline void SetHLineL<int32>(cv::Mat *destPlane, const int x0, const int y, const int length, const int32 * pData) 00363 { 00364 int32* resRowPtr; 00365 resRowPtr = (int32*)(destPlane->ptr(y)); 00366 memcpy(&resRowPtr[x0], pData, length *sizeof(int32)); 00367 } 00368 00369 //----------------------------------------------------------------------------------------------- 00381 template<typename _Tp> inline void SetHLineD(cv::Mat *destPlane, const int x0, const int y, const int length, const float64 * pData) 00382 { 00383 _Tp* resRowPtr; 00384 resRowPtr = (_Tp*)destPlane->ptr(y); 00385 00386 int x = x0; 00387 for(int i = 0; i < length; i++, x++) 00388 { 00389 resRowPtr[x] = cv::saturate_cast<_Tp>(pData[i]); 00390 } 00391 } 00392 00393 //----------------------------------------------------------------------------------------------- 00405 template<> inline void SetHLineD<ito::float64>(cv::Mat *destPlane, const int x0, const int y, const int length, const float64 * pData) 00406 { 00407 float64* resRowPtr; 00408 resRowPtr = (float64*)(destPlane->ptr(y)); 00409 memcpy(&resRowPtr[x0], pData, length *sizeof(float64)); 00410 } 00411 00413 template<typename _Tp> inline bool isNotZero(_Tp value) 00414 { 00415 if(value == 0) 00416 return false; 00417 else 00418 return true; 00419 } 00420 00422 template<> inline bool isNotZero<float32>(float32 value) 00423 { 00424 float32 lowVal = std::numeric_limits<float32>::epsilon(); 00425 if(fabs(value) < lowVal) 00426 return false; 00427 else 00428 return true; 00429 } 00430 00432 template<> inline bool isNotZero<float64>(float64 value) 00433 { 00434 float64 lowVal = std::numeric_limits<float64>::epsilon(); 00435 if(fabs(value) < lowVal) 00436 return false; 00437 else 00438 return true; 00439 } 00440 00442 template<typename _Tp> inline bool isFinite(_Tp /*value*/) 00443 { 00444 return true; 00445 } 00446 00448 template<> inline bool isFinite<float32>(float32 value) 00449 { 00450 uchar *ch = (uchar *)&value; 00451 return (ch[3] & 0x7f) != 0x7f || (ch[2] & 0x80) != 0x80; 00452 } 00453 00455 template<> inline bool isFinite<float64>(float64 value) 00456 { 00457 uchar *ch = (uchar *)&value; 00458 return (ch[7] & 0x7f) != 0x7f || (ch[6] & 0xf0) != 0xf0; 00459 } 00460 00462 template<> inline bool isFinite<complex64>(complex64 value) 00463 { 00464 float32 realVal = value.real(); 00465 float32 imagVal = value.real(); 00466 uchar *chreal = (uchar *)&realVal; 00467 uchar *chimag = (uchar *)&imagVal; 00468 return ((chreal[3] & 0x7f) != 0x7f || (chreal[2] & 0x80) != 0x80) && ((chimag[3] & 0x7f) != 0x7f || (chimag[2] & 0x80) != 0x80); 00469 } 00470 00472 template<> inline bool isFinite<complex128>(complex128 value) 00473 { 00474 float64 realVal = value.real(); 00475 float64 imagVal = value.real(); 00476 uchar *chreal = (uchar *)&realVal; 00477 uchar *chimag = (uchar *)&imagVal; 00478 return ((chreal[7] & 0x7f) != 0x7f || (chreal[6] & 0xf0) != 0xf0) && ((chimag[7] & 0x7f) != 0x7f || (chimag[6] & 0xf0) != 0xf0); 00479 } 00480 00482 template<typename _Tp> inline bool isNaN(_Tp value) 00483 { 00484 return false; 00485 } 00486 00488 template<> inline bool isNaN<float32>(float32 value) 00489 { 00490 uchar *ch = (uchar *)&value; 00491 return (ch[3] & 0x7f) == 0x7f && ch[2] > 0x80; 00492 } 00494 template<> inline bool isNaN<float64>(float64 value) 00495 { 00496 uchar *ch = (uchar *)&value; 00497 return (ch[7] & 0x7f) == 0x7f && ch[6] > 0xf0; 00498 } 00499 00501 template<> inline bool isNaN<complex64>(complex64 value) 00502 { 00503 float32 realVal = value.real(); 00504 float32 imagVal = value.real(); 00505 uchar *chreal = (uchar *)&realVal; 00506 uchar *chimag = (uchar *)&imagVal; 00507 return ((chreal[3] & 0x7f) == 0x7f && chreal[2] > 0x80) || ((chimag[3] & 0x7f) == 0x7f && chimag[2] > 0x80); 00508 } 00509 00511 template<> inline bool isNaN<complex128>(complex128 value) 00512 { 00513 float64 realVal = value.real(); 00514 float64 imagVal = value.real(); 00515 uchar *chreal = (uchar *)&realVal; 00516 uchar *chimag = (uchar *)&imagVal; 00517 return ((chreal[7] & 0x7f) == 0x7f && chreal[6] > 0xf0) || ((chimag[7] & 0x7f) == 0x7f && chimag[6] > 0xf0); 00518 } 00519 00521 template<typename _Tp> inline bool isInf(_Tp /*value*/) 00522 { 00523 return false; 00524 } 00525 00527 template<> inline bool isInf<float32>(float32 value) 00528 { 00529 uchar *ch = (uchar *)&value; 00530 return (ch[3] & 0x7f) == 0x7f && ch[2] == 0x80; 00531 } 00532 00534 template<> inline bool isInf<float64>(float64 value) 00535 { 00536 uchar *ch = (uchar *)&value; 00537 return (ch[7] & 0x7f) == 0x7f && ch[6] == 0xf0; 00538 } 00539 00541 template<> inline bool isInf<complex64>(complex64 value) 00542 { 00543 float32 realVal = value.real(); 00544 float32 imagVal = value.real(); 00545 uchar *chreal = (uchar *)&realVal; 00546 uchar *chimag = (uchar *)&imagVal; 00547 return ((chreal[3] & 0x7f) == 0x7f && chreal[2] == 0x80) || ((chimag[3] & 0x7f) == 0x7f && chimag[2] == 0x80); 00548 } 00549 00551 template<> inline bool isInf<complex128>(complex128 value) 00552 { 00553 float64 realVal = value.real(); 00554 float64 imagVal = value.real(); 00555 uchar *chreal = (uchar *)&realVal; 00556 uchar *chimag = (uchar *)&imagVal; 00557 return ((chreal[7] & 0x7f) == 0x7f && chreal[6] == 0xf0) || ((chimag[7] & 0x7f) == 0x7f && chimag[6] == 0xf0); 00558 } 00559 00561 template<typename _Tp> RetVal minValueFunc(const DataObject *dObj, float64 &minValue, uint32 *firstLocation, bool ignoreInf = true); 00562 00564 RetVal DATAOBJ_EXPORT minValue(const DataObject *dObj, float64 &minValue, uint32 *firstLocation, bool ignoreInf = true); 00565 00567 template<typename _Tp> RetVal maxValueFunc(const DataObject *dObj, float64 &maxValue, uint32 *firstLocation, bool ignoreInf = true); 00568 00570 RetVal DATAOBJ_EXPORT maxValue(const DataObject *dObj, float64 &maxValue, uint32 *firstLocation, bool ignoreInf = true); 00571 00573 template<typename _Tp> RetVal minMaxValueFunc(const DataObject *dObj, float64 &minValue, uint32 *firstMinLocation, float64 &maxValue, uint32 *firstMaxLocation, bool ignoreInf = true, const int specialDataTypeFlags = CMPLX_ABS_VALUE); 00574 00576 RetVal DATAOBJ_EXPORT minMaxValue(const DataObject *dObj, float64 &minValue, uint32 *firstMinLocation, float64 &maxValue, uint32 *firstMaxLocation, bool ignoreInf = true, const int specialDataTypeFlags = CMPLX_ABS_VALUE); 00577 00578 template<typename _Tp, typename _BufTp> RetVal meanValueFunc(const DataObject *dObj, float64 &meanResult, bool ignoreNaN = true); 00579 RetVal DATAOBJ_EXPORT meanValue(const DataObject *dObj, float64 &meanResult, bool ignoreNaN = true); 00580 00581 template<typename _Tp, typename _BufTp> RetVal devValueFunc(const ito::DataObject *dObj, const int devTypFlag, float64 &meanResult, float64 &devResult, bool ignoreNaN = true); 00582 RetVal DATAOBJ_EXPORT devValue(const DataObject *dObj, const int devTypFlag, float64 &meanResult, float64 &devResult, bool ignoreNaN = true); 00583 00584 RetVal DATAOBJ_EXPORT calcCVDFT(DataObject *dObjIO, const bool inverse, const bool inverseAsReal, const bool lineWise); 00585 00587 ito::RetVal DATAOBJ_EXPORT verifyDataObjectType(const ito::DataObject* dObj, const char* name, uint8 numberOfAllowedTypes, ...); //append allowed data types, e.g. ito::tUint8, ito::tInt8... (order does not care) 00588 00590 ito::RetVal DATAOBJ_EXPORT 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) 00591 00593 //ito::RetVal DATAOBJ_EXPORT verify1PlaneDObject(const ito::DataObject* dObj, const char* name, int &yIdx, int sizeYMin, int sizeYMax, int &xIdx, int sizeXMin, int sizeXMax, uint8 numberOfAllowedTypes, ...); //append allowed data types, e.g. ito::tUint8, ito::tInt8... (order does not care) 00594 00596 ito::RetVal DATAOBJ_EXPORT 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) 00597 00598 ito::RetVal DATAOBJ_EXPORT verifySize(int size, int minSize, int maxSize, const char *axisName, const char* dObjName); 00599 00601 ito::DataObject DATAOBJ_EXPORT squeezeConvertCheck2DDataObject(const ito::DataObject *dObj, const char* name, const ito::Range &sizeY, const ito::Range &sizeX, ito::RetVal &retval, int convertToType, uint8 numberOfAllowedTypes, ...); 00602 00603 //----------------------------------------------------------------------------------------------- 00616 template<typename _Tp> ito::RetVal freeRowPointer(_Tp *** &pointer) 00617 { 00618 if(pointer == NULL) 00619 { 00620 return ito::RetVal::format(ito::retError, 0, "Delete rowpointer failed, pointer was not allocated freeRowPointer(...)"); 00621 } 00622 00623 int i = 0; 00624 00625 while(pointer[i] != 0) 00626 { 00627 free(pointer[i]); 00628 i++; 00629 // end of pointer is marked by a NULL-Pointer 00630 } 00631 00632 free(pointer); 00633 pointer = NULL; 00634 00635 return ito::retOk; 00636 } 00637 00653 template<typename _Tp> ito::RetVal getRowPointer(ito::DataObject* dObj, _Tp *** &pointer) 00654 { 00655 00656 if(!dObj) 00657 { 00658 return ito::RetVal::format(ito::retError, 0, "DataObject was a NULL pointer in function getRowPointer(...)"); 00659 } 00660 00661 if(dObj->getType() != ito::getDataType2<_Tp*>()) 00662 { 00663 return ito::RetVal::format(ito::retError, 0, "DataObject and template Type differed in function getRowPointer(...)"); 00664 } 00665 00666 if(dObj->getDims() < 2) 00667 { 00668 return ito::RetVal::format(ito::retError, 0, "DataObject was not initialized in function getRowPointer(...)"); 00669 } 00670 00671 pointer = (_Tp***)calloc(dObj->calcNumMats() + 1, sizeof(_Tp**)); 00672 00673 if(pointer == NULL) 00674 { 00675 return ito::RetVal::format(ito::retError, 0, "Allocate plane-pointer failed in function getRowPointer(...)"); 00676 } 00677 00678 ito::RetVal retVal(ito::retOk); 00679 int sizeY = dObj->getSize(dObj->getDims() - 2); 00680 00681 uchar** mdata = dObj->get_mdata(); 00682 for(int i = 0; i < dObj->calcNumMats(); i++) 00683 { 00684 pointer[i] = (_Tp**)calloc(sizeY, sizeof(_Tp*)); 00685 if(pointer[i]) 00686 { 00687 for(int y = 0; y < sizeY; y++) 00688 { 00689 pointer[i][y] = ((cv::Mat*)(mdata[dObj->seekMat(i)]))->ptr<_Tp>(y); 00690 } 00691 } 00692 else 00693 { 00694 retVal += ito::RetVal::format(ito::retError, 0, "Allocate row-pointer failed in function getRowPointer(...)"); 00695 break; 00696 } 00697 } 00698 00699 if(retVal.containsError()) 00700 { 00701 freeRowPointer(pointer); 00702 } 00703 return retVal; 00704 } 00705 00706 //----------------------------------------------------------------------------------------------- 00715 inline bool isIntType(const int type, int *size) 00716 { 00717 if((type == ito::tInt8)||(type == ito::tUInt8)) 00718 { 00719 *size = 1; 00720 return true; 00721 } 00722 else if((type == ito::tInt16)||(type == ito::tUInt16)) 00723 { 00724 *size = 2; 00725 return true; 00726 } 00727 else if((type == ito::tInt32)||(type == ito::tUInt32)) 00728 { 00729 *size = 4; 00730 return true; 00731 } 00732 else 00733 { 00734 *size = -1; 00735 return false; 00736 } 00737 } 00738 00739 //----------------------------------------------------------------------------------------------- 00748 inline bool isFPType(const int type, int *size) 00749 { 00750 if((type == ito::tFloat32)) 00751 { 00752 *size = 4; 00753 return true; 00754 } 00755 else if((type == ito::tFloat64)) 00756 { 00757 *size = 8; 00758 return true; 00759 } 00760 else 00761 { 00762 *size = -1; 00763 return false; 00764 } 00765 } 00766 00767 //----------------------------------------------------------------------------------------------- 00776 inline bool isCplxType(const int type, int *size) 00777 { 00778 if((type == ito::tComplex64)) 00779 { 00780 *size = 8; 00781 return true; 00782 } 00783 else if((type == ito::tComplex128)) 00784 { 00785 *size = 16; 00786 return true; 00787 } 00788 else 00789 { 00790 *size = -1; 00791 return false; 00792 } 00793 } 00794 00795 //----------------------------------------------------------------------------------------------- 00808 inline bool dObjareEqualDetail(ito::DataObject *dObj1, ito::DataObject *dObj2, bool &typeFlag, bool &dimsFlag, bool &last2DimsFlag) 00809 { 00810 bool retVal = true; 00811 typeFlag = true; 00812 dimsFlag = true; 00813 last2DimsFlag = true; 00814 //transFlag = true; 00815 00816 if(dObj1->getType() != dObj2->getType()) 00817 { 00818 retVal = false; 00819 typeFlag = false; 00820 } 00821 /*if(dObj1->isT() != dObj2->isT()) 00822 { 00823 retVal = false; 00824 transFlag = false; 00825 }*/ 00826 00827 if(dObj1->getDims() != dObj2->getDims()) 00828 { 00829 retVal = false; 00830 dimsFlag = false; 00831 if(dObj1->getSize(dObj1->getDims() - 2) != dObj2->getSize(dObj2->getDims() - 2)) 00832 { 00833 last2DimsFlag = false; 00834 } 00835 if(dObj1->getSize(dObj1->getDims() - 1) != dObj2->getSize(dObj2->getDims() - 1)) 00836 { 00837 last2DimsFlag = false; 00838 } 00839 } 00840 else 00841 { 00842 for(int i = 0; i < dObj1->getDims()-2; i++) 00843 { 00844 if(dObj1->getSize(i) != dObj2->getSize(i)) 00845 { 00846 retVal = false; 00847 } 00848 } 00849 if(dObj1->getSize(dObj1->getDims() - 2) != dObj2->getSize(dObj2->getDims() - 2)) 00850 { 00851 last2DimsFlag = false; 00852 retVal = false; 00853 } 00854 if(dObj1->getSize(dObj1->getDims() - 1) != dObj2->getSize(dObj2->getDims() - 1)) 00855 { 00856 last2DimsFlag = false; 00857 retVal = false; 00858 } 00859 } 00860 return retVal; 00861 } 00862 00863 //----------------------------------------------------------------------------------------------- 00873 inline bool dObjareEqualShort(ito::DataObject *obj1, ito::DataObject *obj2) 00874 { 00875 if(obj1->getDims() == obj2->getDims() && obj1->getType() == obj2->getType() /*&& obj1->isT() == obj2->isT()*/) 00876 { 00877 for(int i = 0; i < obj1->getDims(); i++) 00878 { 00879 if(obj1->getSize(i) != obj2->getSize(i)) 00880 { 00881 return false; 00882 } 00883 } 00884 return true; 00885 } 00886 else 00887 return false; 00888 } 00889 00891 ito::RetVal DATAOBJ_EXPORT dObjCopyLastNAxisTags(const ito::DataObject &DataObjectIn, ito::DataObject &DataObjectOut, const int copyLastNDims, const bool includeValueTags = true, const bool includeRotationMatrix = true); 00892 00893 ito::RetVal DATAOBJ_EXPORT dObjSetScaleRectangle(ito::DataObject &DataObjectInOut, const double &x0, const double &x1, const double &y0, const double &y1); 00894 } //end namespace dObjHelper 00895 } //end namespace ito 00896 00897 #endif