7 #include "linearhostmemory.h"
8 #include "lineardevicememory.h"
9 #include "image_allocator_cpu.h"
10 #include "image_cpu.h"
11 #include "image_allocator_gpu.h"
12 #include "image_gpu.h"
13 #include "volume_allocator_cpu.h"
14 #include "volume_cpu.h"
15 #include "volume_allocator_gpu.h"
16 #include "volume_gpu.h"
18 #include "tensor_cpu.h"
19 #include "tensor_gpu.h"
37 typedef LinearHostMemory<unsigned char, 1> LinearHostMemory_8u_C1;
38 typedef LinearHostMemory<uchar2, 1> LinearHostMemory_8u_C2;
39 typedef LinearHostMemory<uchar3, 1> LinearHostMemory_8u_C3;
40 typedef LinearHostMemory<uchar4, 1> LinearHostMemory_8u_C4;
42 typedef LinearHostMemory<unsigned short, 1> LinearHostMemory_16u_C1;
43 typedef LinearHostMemory<ushort2, 1> LinearHostMemory_16u_C2;
44 typedef LinearHostMemory<ushort3, 1> LinearHostMemory_16u_C3;
45 typedef LinearHostMemory<ushort4, 1> LinearHostMemory_16u_C4;
48 typedef LinearHostMemory<float, 1> LinearHostMemory_32f_C1;
49 typedef LinearHostMemory<float2, 1> LinearHostMemory_32f_C2;
50 typedef LinearHostMemory<float3, 1> LinearHostMemory_32f_C3;
51 typedef LinearHostMemory<float4, 1> LinearHostMemory_32f_C4;
53 typedef LinearHostMemory<int, 1> LinearHostMemory_32s_C1;
54 typedef LinearHostMemory<int2, 1> LinearHostMemory_32s_C2;
55 typedef LinearHostMemory<int3, 1> LinearHostMemory_32s_C3;
56 typedef LinearHostMemory<int4, 1> LinearHostMemory_32s_C4;
58 typedef LinearHostMemory<unsigned int, 1> LinearHostMemory_32u_C1;
59 typedef LinearHostMemory<uint2, 1> LinearHostMemory_32u_C2;
60 typedef LinearHostMemory<uint4, 1> LinearHostMemory_32u_C4;
63 typedef LinearHostMemory<double,1> LinearHostMemory_64f_C1;
64 typedef LinearHostMemory<double2,1> LinearHostMemory_64f_C2;
65 typedef LinearHostMemory<double3,1> LinearHostMemory_64f_C3;
66 typedef LinearHostMemory<double4,1> LinearHostMemory_64f_C4;
73 typedef LinearDeviceMemory<unsigned char, 1> LinearDeviceMemory_8u_C1;
74 typedef LinearDeviceMemory<uchar2, 1> LinearDeviceMemory_8u_C2;
75 typedef LinearDeviceMemory<uchar3, 1> LinearDeviceMemory_8u_C3;
76 typedef LinearDeviceMemory<uchar4, 1> LinearDeviceMemory_8u_C4;
78 typedef LinearDeviceMemory<unsigned short, 1> LinearDeviceMemory_16u_C1;
79 typedef LinearDeviceMemory<ushort2, 1> LinearDeviceMemory_16u_C2;
80 typedef LinearDeviceMemory<ushort3, 1> LinearDeviceMemory_16u_C3;
81 typedef LinearDeviceMemory<ushort4, 1> LinearDeviceMemory_16u_C4;
84 typedef LinearDeviceMemory<float, 1> LinearDeviceMemory_32f_C1;
85 typedef LinearDeviceMemory<float2, 1> LinearDeviceMemory_32f_C2;
86 typedef LinearDeviceMemory<float3, 1> LinearDeviceMemory_32f_C3;
87 typedef LinearDeviceMemory<float4, 1> LinearDeviceMemory_32f_C4;
89 typedef LinearDeviceMemory<int, 1> LinearDeviceMemory_32s_C1;
90 typedef LinearDeviceMemory<int2, 1> LinearDeviceMemory_32s_C2;
91 typedef LinearDeviceMemory<int3, 1> LinearDeviceMemory_32s_C3;
92 typedef LinearDeviceMemory<int4, 1> LinearDeviceMemory_32s_C4;
94 typedef LinearDeviceMemory<unsigned int, 1> LinearDeviceMemory_32u_C1;
95 typedef LinearDeviceMemory<uint2, 1> LinearDeviceMemory_32u_C2;
96 typedef LinearDeviceMemory<uint4, 1> LinearDeviceMemory_32u_C4;
99 typedef LinearDeviceMemory<double,1> LinearDeviceMemory_64f_C1;
100 typedef LinearDeviceMemory<double2,1> LinearDeviceMemory_64f_C2;
101 typedef LinearDeviceMemory<double3,1> LinearDeviceMemory_64f_C3;
102 typedef LinearDeviceMemory<double4,1> LinearDeviceMemory_64f_C4;
112 typedef ImageCpu<unsigned char, iuprivate::ImageAllocatorCpu<unsigned char> > ImageCpu_8u_C1;
113 typedef ImageCpu<uchar2, iuprivate::ImageAllocatorCpu<uchar2> > ImageCpu_8u_C2;
114 typedef ImageCpu<uchar3, iuprivate::ImageAllocatorCpu<uchar3> > ImageCpu_8u_C3;
115 typedef ImageCpu<uchar4, iuprivate::ImageAllocatorCpu<uchar4> > ImageCpu_8u_C4;
118 typedef ImageCpu<unsigned short, iuprivate::ImageAllocatorCpu<unsigned short> > ImageCpu_16u_C1;
119 typedef ImageCpu<ushort2, iuprivate::ImageAllocatorCpu<ushort2> > ImageCpu_16u_C2;
120 typedef ImageCpu<ushort3, iuprivate::ImageAllocatorCpu<ushort3> > ImageCpu_16u_C3;
121 typedef ImageCpu<ushort4, iuprivate::ImageAllocatorCpu<ushort4> > ImageCpu_16u_C4;
124 typedef ImageCpu<int, iuprivate::ImageAllocatorCpu<int> > ImageCpu_32s_C1;
125 typedef ImageCpu<int2, iuprivate::ImageAllocatorCpu<int2> > ImageCpu_32s_C2;
126 typedef ImageCpu<int3, iuprivate::ImageAllocatorCpu<int3> > ImageCpu_32s_C3;
127 typedef ImageCpu<int4, iuprivate::ImageAllocatorCpu<int4> > ImageCpu_32s_C4;
130 typedef ImageCpu<unsigned int, iuprivate::ImageAllocatorCpu<unsigned int> > ImageCpu_32u_C1;
131 typedef ImageCpu<uint2, iuprivate::ImageAllocatorCpu<uint2> > ImageCpu_32u_C2;
132 typedef ImageCpu<uint4, iuprivate::ImageAllocatorCpu<uint4> > ImageCpu_32u_C4;
136 typedef ImageCpu<float, iuprivate::ImageAllocatorCpu<float> > ImageCpu_32f_C1;
137 typedef ImageCpu<float2, iuprivate::ImageAllocatorCpu<float2> > ImageCpu_32f_C2;
138 typedef ImageCpu<float3, iuprivate::ImageAllocatorCpu<float3> > ImageCpu_32f_C3;
139 typedef ImageCpu<float4, iuprivate::ImageAllocatorCpu<float4> > ImageCpu_32f_C4;
142 typedef ImageCpu<double, iuprivate::ImageAllocatorCpu<double> > ImageCpu_64f_C1;
143 typedef ImageCpu<double2, iuprivate::ImageAllocatorCpu<double2> > ImageCpu_64f_C2;
144 typedef ImageCpu<double3, iuprivate::ImageAllocatorCpu<double3> > ImageCpu_64f_C3;
145 typedef ImageCpu<double4, iuprivate::ImageAllocatorCpu<double4> > ImageCpu_64f_C4;
151 typedef ImageGpu<unsigned char, iuprivate::ImageAllocatorGpu<unsigned char> > ImageGpu_8u_C1;
152 typedef ImageGpu<uchar2, iuprivate::ImageAllocatorGpu<uchar2> > ImageGpu_8u_C2;
153 typedef ImageGpu<uchar3, iuprivate::ImageAllocatorGpu<uchar3> > ImageGpu_8u_C3;
154 typedef ImageGpu<uchar4, iuprivate::ImageAllocatorGpu<uchar4> > ImageGpu_8u_C4;
157 typedef ImageGpu<unsigned short, iuprivate::ImageAllocatorGpu<unsigned short> > ImageGpu_16u_C1;
158 typedef ImageGpu<ushort2, iuprivate::ImageAllocatorGpu<ushort2> > ImageGpu_16u_C2;
159 typedef ImageGpu<ushort3, iuprivate::ImageAllocatorGpu<ushort3> > ImageGpu_16u_C3;
160 typedef ImageGpu<ushort4, iuprivate::ImageAllocatorGpu<ushort4> > ImageGpu_16u_C4;
163 typedef ImageGpu<int, iuprivate::ImageAllocatorGpu<int> > ImageGpu_32s_C1;
164 typedef ImageGpu<int2, iuprivate::ImageAllocatorGpu<int2> > ImageGpu_32s_C2;
165 typedef ImageGpu<int3, iuprivate::ImageAllocatorGpu<int3> > ImageGpu_32s_C3;
166 typedef ImageGpu<int4, iuprivate::ImageAllocatorGpu<int4> > ImageGpu_32s_C4;
169 typedef ImageGpu<unsigned int, iuprivate::ImageAllocatorGpu<unsigned int> > ImageGpu_32u_C1;
170 typedef ImageGpu<uint2, iuprivate::ImageAllocatorGpu<uint2> > ImageGpu_32u_C2;
171 typedef ImageGpu<uint4, iuprivate::ImageAllocatorGpu<uint4> > ImageGpu_32u_C4;
174 typedef ImageGpu<float, iuprivate::ImageAllocatorGpu<float> > ImageGpu_32f_C1;
175 typedef ImageGpu<float2, iuprivate::ImageAllocatorGpu<float2> > ImageGpu_32f_C2;
176 typedef ImageGpu<float3, iuprivate::ImageAllocatorGpu<float3> > ImageGpu_32f_C3;
177 typedef ImageGpu<float4, iuprivate::ImageAllocatorGpu<float4> > ImageGpu_32f_C4;
180 typedef ImageGpu<double, iuprivate::ImageAllocatorGpu<double> > ImageGpu_64f_C1;
181 typedef ImageGpu<double2, iuprivate::ImageAllocatorGpu<double2> > ImageGpu_64f_C2;
182 typedef ImageGpu<double3, iuprivate::ImageAllocatorGpu<double3> > ImageGpu_64f_C3;
183 typedef ImageGpu<double4, iuprivate::ImageAllocatorGpu<double4> > ImageGpu_64f_C4;
194 typedef VolumeCpu<unsigned char, iuprivate::VolumeAllocatorCpu<unsigned char> > VolumeCpu_8u_C1;
195 typedef VolumeCpu<uchar2, iuprivate::VolumeAllocatorCpu<uchar2> > VolumeCpu_8u_C2;
196 typedef VolumeCpu<uchar3, iuprivate::VolumeAllocatorCpu<uchar3> > VolumeCpu_8u_C3;
197 typedef VolumeCpu<uchar4, iuprivate::VolumeAllocatorCpu<uchar4> > VolumeCpu_8u_C4;
200 typedef VolumeCpu<unsigned short, iuprivate::VolumeAllocatorCpu<unsigned short> > VolumeCpu_16u_C1;
203 typedef VolumeCpu<unsigned int, iuprivate::VolumeAllocatorCpu<unsigned int> > VolumeCpu_32u_C1;
204 typedef VolumeCpu<uint2, iuprivate::VolumeAllocatorCpu<uint2> > VolumeCpu_32u_C2;
205 typedef VolumeCpu<uint4, iuprivate::VolumeAllocatorCpu<uint4> > VolumeCpu_32u_C4;
208 typedef VolumeCpu<int, iuprivate::VolumeAllocatorCpu<int> > VolumeCpu_32s_C1;
209 typedef VolumeCpu<int2, iuprivate::VolumeAllocatorCpu<int2> > VolumeCpu_32s_C2;
210 typedef VolumeCpu<int4, iuprivate::VolumeAllocatorCpu<int4> > VolumeCpu_32s_C4;
213 typedef VolumeCpu<float, iuprivate::VolumeAllocatorCpu<float> > VolumeCpu_32f_C1;
214 typedef VolumeCpu<float2, iuprivate::VolumeAllocatorCpu<float2> > VolumeCpu_32f_C2;
215 typedef VolumeCpu<float3, iuprivate::VolumeAllocatorCpu<float3> > VolumeCpu_32f_C3;
216 typedef VolumeCpu<float4, iuprivate::VolumeAllocatorCpu<float4> > VolumeCpu_32f_C4;
219 typedef VolumeCpu<double, iuprivate::VolumeAllocatorCpu<double> > VolumeCpu_64f_C1;
220 typedef VolumeCpu<double2, iuprivate::VolumeAllocatorCpu<double2> > VolumeCpu_64f_C2;
221 typedef VolumeCpu<double3, iuprivate::VolumeAllocatorCpu<double3> > VolumeCpu_64f_C3;
222 typedef VolumeCpu<double4, iuprivate::VolumeAllocatorCpu<double4> > VolumeCpu_64f_C4;
229 typedef VolumeGpu<unsigned char, iuprivate::VolumeAllocatorGpu<unsigned char> > VolumeGpu_8u_C1;
230 typedef VolumeGpu<uchar2, iuprivate::VolumeAllocatorGpu<uchar2> > VolumeGpu_8u_C2;
231 typedef VolumeGpu<uchar3, iuprivate::VolumeAllocatorGpu<uchar3> > VolumeGpu_8u_C3;
232 typedef VolumeGpu<uchar4, iuprivate::VolumeAllocatorGpu<uchar4> > VolumeGpu_8u_C4;
235 typedef VolumeGpu<unsigned short, iuprivate::VolumeAllocatorGpu<unsigned short> > VolumeGpu_16u_C1;
238 typedef VolumeGpu<unsigned int, iuprivate::VolumeAllocatorGpu<unsigned int> > VolumeGpu_32u_C1;
239 typedef VolumeGpu<uint2, iuprivate::VolumeAllocatorGpu<uint2> > VolumeGpu_32u_C2;
240 typedef VolumeGpu<uint4, iuprivate::VolumeAllocatorGpu<uint4> > VolumeGpu_32u_C4;
243 typedef VolumeGpu<int, iuprivate::VolumeAllocatorGpu<int> > VolumeGpu_32s_C1;
244 typedef VolumeGpu<int2, iuprivate::VolumeAllocatorGpu<int2> > VolumeGpu_32s_C2;
245 typedef VolumeGpu<int4, iuprivate::VolumeAllocatorGpu<int4> > VolumeGpu_32s_C4;
248 typedef VolumeGpu<float, iuprivate::VolumeAllocatorGpu<float> > VolumeGpu_32f_C1;
249 typedef VolumeGpu<float2, iuprivate::VolumeAllocatorGpu<float2> > VolumeGpu_32f_C2;
250 typedef VolumeGpu<float3, iuprivate::VolumeAllocatorGpu<float3> > VolumeGpu_32f_C3;
251 typedef VolumeGpu<float4, iuprivate::VolumeAllocatorGpu<float4> > VolumeGpu_32f_C4;
254 typedef VolumeGpu<double, iuprivate::VolumeAllocatorGpu<double> > VolumeGpu_64f_C1;
255 typedef VolumeGpu<double2, iuprivate::VolumeAllocatorGpu<double2> > VolumeGpu_64f_C2;
256 typedef VolumeGpu<double3, iuprivate::VolumeAllocatorGpu<double3> > VolumeGpu_64f_C3;
257 typedef VolumeGpu<double4, iuprivate::VolumeAllocatorGpu<double4> > VolumeGpu_64f_C4;
267 typedef TensorCpu<unsigned char> TensorCpu_8u;
268 typedef TensorCpu<unsigned short> TensorCpu_16u;
269 typedef TensorCpu<float> TensorCpu_32f;
270 typedef TensorCpu<int> TensorCpu_32s;
271 typedef TensorCpu<double> TensorCpu_64f;
277 typedef TensorGpu<unsigned char> TensorGpu_8u;
278 typedef TensorGpu<unsigned short> TensorGpu_16u;
279 typedef TensorGpu<float> TensorGpu_32f;
280 typedef TensorGpu<unsigned int> TensorGpu_32u;
281 typedef TensorGpu<int> TensorGpu_32s;
282 typedef TensorGpu<double> TensorGpu_64f;
289 const char* file,
const char*
function,
const int line)
291 if (volume1->
size() != volume2->
size())
293 std::stringstream msg;
294 msg <<
"Size mismatch! Size of first Volume is " << volume1->
size() <<
". ";
295 msg <<
"Size of second Volume is " << volume2->
size();
296 throw IuException(msg.str(), file,
function, line);
301 const char* file,
const char*
function,
const int line)
303 if (image1->
size() != image2->
size())
305 std::stringstream msg;
306 msg <<
"Size mismatch! Size of first Image is " << image1->
size() <<
". ";
307 msg <<
"Size of second Image is " << image2->
size();
308 throw IuException(msg.str(), file,
function, line);
312 template<
unsigned int Ndim>
314 const char* file,
const char*
function,
const int line)
316 if (linmem1->
size() != linmem2->
size())
318 std::stringstream msg;
319 msg <<
"Size mismatch! size of first LinearMemory is " << linmem1->
size() <<
". ";
320 msg <<
"size of second LinearMemory is " << linmem2->
size();
321 throw IuException(msg.str(), file,
function, line);
325 template<
unsigned int Ndim>
327 const char* file,
const char*
function,
const int line)
331 std::stringstream msg;
332 msg <<
"Size mismatch! First size is " << size1 <<
". ";
333 msg <<
"Second size is " << size2;
334 throw IuException(msg.str(), file,
function, line);
339 const char* file,
const char*
function,
const int line)
343 std::stringstream msg;
344 msg <<
"Size mismatch! Number of elements in Image is " << image->
size().
width*image->
size().
height <<
". ";
345 msg <<
"size of LinearMemory is " << linmem->
size();
346 throw IuException(msg.str(), file,
function, line);
350 #define IU_SIZE_CHECK(variable1, variable2) checkSize(variable1, variable2, __FILE__, __FUNCTION__, __LINE__)
iu::Size< 2 > size() const
Definition: image.h:64
Base class for 2D images (pitched memory).
Definition: image.h:30
unsigned int & height
Definition: vector.h:531
unsigned int numel() const
Definition: linearmemory.h:105
Exceptions with additional error information.
Definition: coredefs.h:32
unsigned int & width
Definition: vector.h:529
Base class for linear memory classes.
Definition: linearmemory.h:61
Size< Ndim > size() const
Definition: linearmemory.h:121
Base class for 3D volumes (pitched memory).
Definition: volume.h:29
Main class for N-dimensional unsigned int vectors (size vectors).
Definition: vector.h:460
iu::Size< 3 > size() const
Definition: volume.h:73