Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlMessageDebugFunction.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: The OpenIGTLink Library
4 Language: C++
5 Web page: http://openigtlink.org/
6
7 Copyright (c) Insight Software Consortium. All rights reserved.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notices for more information.
12
13=========================================================================*/
14
15#ifndef __igltMessageDebugFunction_h
16#define __igltMessageDebugFunction_h
17
18#define ABS_ERROR 1e-6
19
20void TestDebugCharArrayCmp(void* inputPointer, unsigned char* inputArray, int size)
21{
22 for (int i = 0 ; i< size;++i)
23 {
24 std::cerr<<i<<" "<<+((igtlUint8*)inputPointer)[i]<<" "<<+inputArray[i]<<" "<<((igtlUint8*)inputPointer)[i]<<" "<<inputArray[i];
25 if (((igtlUint8*)inputPointer)[i] != inputArray[i])
26 {
27 std::cerr<<" "<<+((igtlUint8*)inputPointer)[i]<<" "<<+inputArray[i];
28 }
29 std::cerr<<std::endl;
30 }
31}
32
33bool MatrixComparison(float outMatrix[4][4], float inMatrix[4][4], float tol )
34{
35 bool equal = true;
36 tol = tol > +0.0f ? tol:-tol;
37 for(int i=0;i < 4; i++)
38 {
39 for(int j=0;j < 4; j++)
40 {
41 if((outMatrix[i][j] - inMatrix[i][j]) > tol ||
42 (outMatrix[i][j] - inMatrix[i][j]) < -tol)
43 {
44 equal = false;
45 }
46 }
47 }
48 return equal;
49}
50
51bool ArrayFloatComparison(float returnArray[], float inArray[], int size, float tol)
52{
53 bool equal = true;
54 tol = tol > +0.0f ? tol:-tol;
55 for(int j=0;j < size; j++)
56 {
57 if((returnArray[j] - inArray[j]) > tol ||
58 (returnArray[j] - inArray[j]) < -tol)
59 {
60 equal = false;
61 }
62 }
63 return equal;
64}
65#endif // __igltOSUtil_h
66
67
void TestDebugCharArrayCmp(void *inputPointer, unsigned char *inputArray, int size)
bool MatrixComparison(float outMatrix[4][4], float inMatrix[4][4], float tol)
bool ArrayFloatComparison(float returnArray[], float inArray[], int size, float tol)

Generated for OpenIGTLink by Doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2012