FAST  3.2.0
Framework for Heterogeneous Medical Image Computing and Visualization
DataTypes.hpp
Go to the documentation of this file.
1 #ifndef DATA_TYPES_HPP
2 #define DATA_TYPES_HPP
3 
4 #define NOMINMAX // Removes windows min and max macros
5 #define _USE_MATH_DEFINES
6 #include <cmath>
7 #include "FAST/Exception.hpp"
8 #include "CL/OpenCL.hpp"
10 #include <iostream>
11 #include <Eigen/Dense>
12 
13 // These have to be outside of fast namespace or it will not compile with Qt on Windows. Why?
14 typedef unsigned char uchar;
15 typedef unsigned short ushort;
16 typedef unsigned int uint;
17 
18 namespace fast {
19 
20 using Eigen::MatrixXf;
21 using Eigen::Matrix2f;
22 using Eigen::Matrix3f;
23 using Eigen::Matrix4f;
24 using Eigen::VectorXf;
25 using Eigen::VectorXi;
26 using Eigen::Vector4f;
27 using Eigen::Vector3f;
28 using Eigen::Vector2f;
29 using Eigen::Vector4i;
30 using Eigen::Vector3i;
31 using Eigen::Vector2i;
32 using Eigen::Affine3f;
33 typedef Eigen::Matrix<uint, Eigen::Dynamic, 1> VectorXui;
34 typedef Eigen::Matrix<uint, 4, 1> Vector4ui;
35 typedef Eigen::Matrix<uint, 3, 1> Vector3ui;
36 typedef Eigen::Matrix<uint, 2, 1> Vector2ui;
37 
38 enum DataType {
44  TYPE_UNORM_INT16, // Unsigned normalized 16 bit integer. A 16 bit int interpreted as a float between 0 and 1.
45  TYPE_SNORM_INT16 // Signed normalized 16 bit integer. A 16 bit int interpreted as a float between -1 and 1.
46 };
47 
49 
50 // Returns the C type for a DataType as a string
51 FAST_EXPORT std::string getCTypeAsString(DataType type);
52 
53 #define fastCaseTypeMacro(fastType, cType, call) case fastType: {typedef cType FAST_TYPE; call;} break;
54 
55 #define fastSwitchTypeMacro(call) \
56  fastCaseTypeMacro(TYPE_FLOAT, float, call) \
57  fastCaseTypeMacro(TYPE_INT8, char, call) \
58  fastCaseTypeMacro(TYPE_UINT8, uchar, call) \
59  fastCaseTypeMacro(TYPE_INT16, short, call) \
60  fastCaseTypeMacro(TYPE_UINT16, ushort, call) \
61  fastCaseTypeMacro(TYPE_SNORM_INT16, short, call) \
62  fastCaseTypeMacro(TYPE_UNORM_INT16, ushort, call) \
63 
64 FAST_EXPORT cl::ImageFormat getOpenCLImageFormat(OpenCLDevice::pointer, cl_mem_object_type imageType, DataType type, unsigned int channels);
65 
66 FAST_EXPORT size_t getSizeOfDataType(DataType type, unsigned int nrOfChannels);
67 
68 FAST_EXPORT float getDefaultIntensityLevel(DataType type);
69 FAST_EXPORT float getDefaultIntensityWindow(DataType type);
70 
71 FAST_EXPORT void deleteArray(void * data, DataType type);
72 
73 } // end namespace
74 #endif
fast::PlaneType
PlaneType
Definition: DataTypes.hpp:48
fast::ExecutionDevice::pointer
std::shared_ptr< ExecutionDevice > pointer
Definition: ExecutionDevice.hpp:11
fast::Vector4ui
Eigen::Matrix< uint, 4, 1 > Vector4ui
Definition: DataTypes.hpp:34
fast::DataType
DataType
Definition: DataTypes.hpp:38
fast::TYPE_UINT8
@ TYPE_UINT8
Definition: DataTypes.hpp:40
fast::deleteArray
FAST_EXPORT void deleteArray(void *data, DataType type)
fast
Definition: AffineTransformation.hpp:7
fast::getDefaultIntensityLevel
FAST_EXPORT float getDefaultIntensityLevel(DataType type)
fast::VectorXui
Eigen::Matrix< uint, Eigen::Dynamic, 1 > VectorXui
Definition: DataTypes.hpp:33
ExecutionDevice.hpp
fast::Vector2ui
Eigen::Matrix< uint, 2, 1 > Vector2ui
Definition: DataTypes.hpp:36
fast::TYPE_FLOAT
@ TYPE_FLOAT
Definition: DataTypes.hpp:39
fast::PLANE_Z
@ PLANE_Z
Definition: DataTypes.hpp:48
fast::TYPE_SNORM_INT16
@ TYPE_SNORM_INT16
Definition: DataTypes.hpp:45
fast::TYPE_INT8
@ TYPE_INT8
Definition: DataTypes.hpp:41
fast::TYPE_UNORM_INT16
@ TYPE_UNORM_INT16
Definition: DataTypes.hpp:44
fast::getCTypeAsString
FAST_EXPORT std::string getCTypeAsString(DataType type)
fast::PLANE_Y
@ PLANE_Y
Definition: DataTypes.hpp:48
fast::PLANE_X
@ PLANE_X
Definition: DataTypes.hpp:48
fast::TYPE_INT16
@ TYPE_INT16
Definition: DataTypes.hpp:43
Exception.hpp
ushort
unsigned short ushort
Definition: DataTypes.hpp:15
uint
unsigned int uint
Definition: DataTypes.hpp:16
uchar
unsigned char uchar
Definition: DataTypes.hpp:14
fast::getDefaultIntensityWindow
FAST_EXPORT float getDefaultIntensityWindow(DataType type)
fast::getSizeOfDataType
FAST_EXPORT size_t getSizeOfDataType(DataType type, unsigned int nrOfChannels)
fast::getOpenCLImageFormat
FAST_EXPORT cl::ImageFormat getOpenCLImageFormat(OpenCLDevice::pointer, cl_mem_object_type imageType, DataType type, unsigned int channels)
fast::TYPE_UINT16
@ TYPE_UINT16
Definition: DataTypes.hpp:42
fast::Vector3ui
Eigen::Matrix< uint, 3, 1 > Vector3ui
Definition: DataTypes.hpp:35