100 lines
2.2 KiB
C++
100 lines
2.2 KiB
C++
#ifndef ITKDRTHELPERS_H
|
|
#define ITKDRTHELPERS_H
|
|
|
|
#include "itkMath.h"
|
|
#include <cstddef>
|
|
#include <cstring>
|
|
#include <iterator>
|
|
|
|
#ifdef __GNUC__
|
|
#define VARIABLE_IS_NOT_USED __attribute__ ((unused))
|
|
#else
|
|
#define VARIABLE_IS_NOT_USED
|
|
#endif
|
|
|
|
//Function to get method and class name for logging purposes.
|
|
template <size_t FL, size_t PFL>
|
|
const char* computeMethodName(const char (&function)[FL], const char (&prettyFunction)[PFL])
|
|
{
|
|
using reverse_ptr = std::reverse_iterator<const char*>;
|
|
thread_local static char result[PFL];
|
|
const char* locFuncName = std::search(prettyFunction, prettyFunction + PFL - 1, function, function + FL - 1);
|
|
const char* locClassName = std::find(reverse_ptr(locFuncName), reverse_ptr(prettyFunction), ' ').base();
|
|
const char* endFuncName = std::find(locFuncName, prettyFunction + PFL - 1, '(');
|
|
result[0] = '\0';
|
|
std::strncat(result, locClassName, endFuncName - locClassName + 1);
|
|
std::strcat(result, ")");
|
|
return result;
|
|
}
|
|
#define __COMPACT_PRETTY_FUNCTION__ computeMethodName(__FUNCTION__, __PRETTY_FUNCTION__)
|
|
|
|
namespace itk {
|
|
/* reference string required for comparison with tag values */
|
|
static const char VARIABLE_IS_NOT_USED *ImageOrientationStrings[] = {
|
|
"NotDefined",
|
|
"HFS",
|
|
"FFS",
|
|
"HFP",
|
|
"FFP",
|
|
};
|
|
|
|
// constant for converting degrees into radians
|
|
const float dtr = itk::Math::pi_over_180;
|
|
|
|
static const bool verbose = false;
|
|
|
|
/* this is in the end a IEC to HFS...
|
|
* but we keep this for ourselves...
|
|
*/
|
|
static double VARIABLE_IS_NOT_USED Standard_DRT2LPS[9] = {
|
|
1, 0, 0,
|
|
0, 0, -1,
|
|
0, 1, 0
|
|
};
|
|
|
|
static double VARIABLE_IS_NOT_USED PAElementsIEC[9] = {
|
|
1, 0, 0,
|
|
0, -1, 0,
|
|
0, 0, -1
|
|
};
|
|
|
|
static double VARIABLE_IS_NOT_USED LATElementsIEC[9] = {
|
|
0, 0, -1,
|
|
0, -1, 0,
|
|
-1, 0, 0
|
|
};
|
|
|
|
static double VARIABLE_IS_NOT_USED HFS2IEC[9] = {
|
|
1, 0, 0,
|
|
0, 0, 1,
|
|
0, -1, 0
|
|
};
|
|
|
|
static double VARIABLE_IS_NOT_USED FFS2IEC[9] = {
|
|
-1, 0, 0,
|
|
0, 0, -1,
|
|
0, -1, 0
|
|
};
|
|
|
|
static double VARIABLE_IS_NOT_USED HFP2IEC[9] = {
|
|
-1, 0, 0,
|
|
0, 0, 1,
|
|
0, 1, 0
|
|
};
|
|
|
|
static double VARIABLE_IS_NOT_USED FFP2IEC[9] = {
|
|
1, 0, 0,
|
|
0, 0, -1,
|
|
0, 1, 0
|
|
};
|
|
|
|
static double VARIABLE_IS_NOT_USED PAT2IEC[9] = {
|
|
1, 0, 0,
|
|
0, 0, 1,
|
|
0, -1, 0
|
|
};
|
|
|
|
}
|
|
|
|
#endif // ITKDRTHELPERS_H
|