OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / SGI / util / SGI / include / vtk / vtkImageSetGet.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkImageSetGet.h,v $
5   Language:  C++
6   Date:      $Date: 2002/02/01 06:30:41 $
7   Version:   $Revision: 1.1.1.1 $
8   Thanks:    Thanks to C. Charles Law who developed this file.
9
10 Copyright (c) 1993-1995 Ken Martin, Will Schroeder, Bill Lorensen.
11
12 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
13 The following terms apply to all files associated with the software unless
14 explicitly disclaimed in individual files. This copyright specifically does
15 not apply to the related textbook "The Visualization Toolkit" ISBN
16 013199837-4 published by Prentice Hall which is covered by its own copyright.
17
18 The authors hereby grant permission to use, copy, and distribute this
19 software and its documentation for any purpose, provided that existing
20 copyright notices are retained in all copies and that this notice is included
21 verbatim in any distributions. Additionally, the authors grant permission to
22 modify this software and its documentation for any purpose, provided that
23 such modifications are not distributed without the explicit consent of the
24 authors and that existing copyright notices are retained in all copies. Some
25 of the algorithms implemented by this software are patented, observe all
26 applicable patent law.
27
28 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
29 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
30 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
31 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
34 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
35 PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
36 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
37 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
38
39
40 =========================================================================*/
41 // ImageSetGet provides macros which expand the number of ways a method
42 // can be called.
43
44
45 #ifndef __vtkImageSetGet_h
46 #define __vtkImageSetGet_h
47
48
49
50 // These macro are for creating the many convenience functions used 
51 // for accessing instance variables.  They could simplify this class.
52 #define vtkImageSetAxesMacro(name,type) \
53 virtual void SetAxes##name (int *_axes, type _name0, type _name1, \
54                             type _name2, type _name3, type _name4)\
55 { \
56   type _tmp[5]; \
57   _tmp[0] = _name0; _tmp[1] = _name1; _tmp[2] = _name2; \
58   _tmp[3] = _name3; _tmp[4] = _name4; \
59   this->SetAxes##name (5,_axes,_tmp); \
60 } \
61 virtual void SetAxes##name (int *_axes, type _name0, type _name1, \
62                             type _name2, type _name3) \
63 { \
64   type _tmp[4]; \
65   _tmp[0] = _name0; _tmp[1] = _name1; \
66   _tmp[2] = _name2; _tmp[3] = _name3; \
67   this->SetAxes##name (4,_axes,_tmp); \
68 } \
69 virtual void SetAxes##name (int *_axes, type _name0,type _name1,type _name2) \
70 { \
71   type _tmp[3]; \
72   _tmp[0] = _name0; _tmp[1] = _name1; _tmp[2] = _name2; \
73   this->SetAxes##name (3,_axes,_tmp); \
74 } \
75 virtual void SetAxes##name (int *_axes, type _name0, type _name1) \
76 { \
77   type _tmp[2]; \
78   _tmp[0] = _name0; _tmp[1] = _name1; \
79   this->SetAxes##name (2,_axes,_tmp); \
80 } \
81 virtual void SetAxis##name (int _axis, type _name0) \
82 { \
83   this->SetAxes##name (1,&_axis,&_name0); \
84
85
86 #define vtkImageGetAxesMacro(name,type) \
87 virtual void GetAxes##name (int *_axes, type &_name0, type &_name1, \
88                             type &_name2, type &_name3, type &_name4) \
89 { \
90   type _tmp[5]; \
91   this->GetAxes##name (5,_axes,_tmp); \
92   _name0 = _tmp[0]; _name1 = _tmp[1]; _name2 = _tmp[2]; \
93   _name3 = _tmp[3]; _name4 = _tmp[4]; \
94 } \
95 virtual void GetAxes##name (int *_axes, type &_name0, type &_name1, \
96                             type &_name2, type &_name3) \
97 { \
98   type _tmp[4]; \
99   this->GetAxes##name (4,_axes,_tmp); \
100   _name0 = _tmp[0]; _name1 = _tmp[1]; _name2 = _tmp[2]; _name3 = _tmp[3]; \
101 } \
102 virtual void GetAxes##name (int *_axes, type &_name0, type &_name1, \
103                             type &_name2) \
104 { \
105   type _tmp[3]; \
106   this->GetAxes##name (3,_axes,_tmp); \
107   _name0 = _tmp[0]; _name1 = _tmp[1]; _name2 = _tmp[2]; \
108 } \
109 virtual void GetAxes##name (int *_axes, type &_name0, type &_name1) \
110 { \
111   type _tmp[2]; \
112   this->GetAxes##name (2,_axes,_tmp); \
113   _name0 = _tmp[0]; _name1 = _tmp[1]; \
114 } \
115 virtual void GetAxis##name (int _axis, type &_name0) \
116 { \
117   this->GetAxes##name (1,&_axis,&_name0); \
118
119
120
121
122 #define vtkImageSetExtentAxesMacro(name,type) \
123 virtual void SetAxes##name (int *_axes, type _min0,type _max0, \
124                             type _min1,type _max1, type _min2,type _max2, \
125                             type _min3,type _max3, type _min4,type _max4) \
126 { \
127   type _tmp[10]; \
128   _tmp[0] = _min0; _tmp[1] = _max0; \
129   _tmp[2] = _min1; _tmp[3] = _max1; \
130   _tmp[4] = _min2; _tmp[5] = _max2; \
131   _tmp[6] = _min3; _tmp[7] = _max3; \
132   _tmp[8] = _min4; _tmp[9] = _max4; \
133   this->SetAxes##name (5,_axes,_tmp); \
134 } \
135 virtual void SetAxes##name (int *_axes, type _min0,type _max0, \
136                             type _min1,type _max1, type _min2,type _max2, \
137                             type _min3,type _max3) \
138 { \
139   type _tmp[8]; \
140   _tmp[0] = _min0; _tmp[1] = _max0; \
141   _tmp[2] = _min1; _tmp[3] = _max1; \
142   _tmp[4] = _min2; _tmp[5] = _max2; \
143   _tmp[6] = _min3; _tmp[7] = _max3; \
144   this->SetAxes##name (4,_axes,_tmp); \
145 } \
146 virtual void SetAxes##name (int *_axes, type _min0,type _max0, \
147                             type _min1,type _max1, type _min2,type _max2) \
148 { \
149   type _tmp[6]; \
150   _tmp[0] = _min0; _tmp[1] = _max0; \
151   _tmp[2] = _min1; _tmp[3] = _max1; \
152   _tmp[4] = _min2; _tmp[5] = _max2; \
153   this->SetAxes##name (3,_axes,_tmp); \
154 } \
155 virtual void SetAxes##name (int *_axes, type _min0,type _max0, \
156                             type _min1,type _max1) \
157 { \
158   type _tmp[4]; \
159   _tmp[0] = _min0; _tmp[1] = _max0; \
160   _tmp[2] = _min1; _tmp[3] = _max1; \
161   this->SetAxes##name (2,_axes,_tmp); \
162 } \
163 virtual void SetAxis##name (int _axis, type _min0,type _max0) \
164 { \
165   type _tmp[2]; \
166   _tmp[0] = _min0; _tmp[1] = _max0; \
167   this->SetAxes##name (1,&_axis,_tmp); \
168
169
170 #define vtkImageGetExtentAxesMacro(name,type) \
171 virtual void GetAxes##name (int *_axes, type &_min0,type &_max0, \
172                             type &_min1,type &_max1, type &_min2,type &_max2, \
173                             type &_min3,type &_max3, type &_min4,type &_max4) \
174 { \
175   type _tmp[10]; \
176   this->GetAxes##name (5,_axes,_tmp); \
177   _min0 = _tmp[0]; _max0 = _tmp[1]; \
178   _min1 = _tmp[2]; _max1 = _tmp[3]; \
179   _min2 = _tmp[4]; _max2 = _tmp[5]; \
180   _min3 = _tmp[6]; _max3 = _tmp[7]; \
181   _min4 = _tmp[8]; _max4 = _tmp[9]; \
182 } \
183 virtual void GetAxes##name (int *_axes, type &_min0,type &_max0, \
184                             type &_min1,type &_max1, type &_min2,type &_max2, \
185                             type &_min3,type &_max3) \
186 { \
187   type _tmp[8]; \
188   this->GetAxes##name (4,_axes,_tmp); \
189   _min0 = _tmp[0]; _max0 = _tmp[1]; \
190   _min1 = _tmp[2]; _max1 = _tmp[3]; \
191   _min2 = _tmp[4]; _max2 = _tmp[5]; \
192   _min3 = _tmp[6]; _max3 = _tmp[7]; \
193 } \
194 virtual void GetAxes##name (int *_axes, type &_min0,type &_max0, \
195                             type &_min1,type &_max1, type &_min2,type &_max2) \
196 { \
197   type _tmp[6]; \
198   this->GetAxes##name (3,_axes,_tmp); \
199   _min0 = _tmp[0]; _max0 = _tmp[1]; \
200   _min1 = _tmp[2]; _max1 = _tmp[3]; \
201   _min2 = _tmp[4]; _max2 = _tmp[5]; \
202 } \
203 virtual void GetAxes##name (int *_axes, type &_min0,type &_max0, \
204                             type &_min1,type &_max1) \
205 { \
206   type _tmp[4]; \
207   this->GetAxes##name (2,_axes,_tmp); \
208   _min0 = _tmp[0]; _max0 = _tmp[1]; \
209   _min1 = _tmp[2]; _max1 = _tmp[3]; \
210 } \
211 virtual void GetAxis##name (int _axis,type &_min0,type &_max0) \
212 { \
213   type _tmp[2]; \
214   this->GetAxes##name (1,&_axis,_tmp); \
215   _min0 = _tmp[0]; _max0 = _tmp[1]; \
216
217
218
219 // These macro are for creating the many convenience functions used 
220 // for accessing instance variables.  They could simplify this class.
221 #define vtkImageSetMacro(name,type) \
222 virtual void Set##name (type *_tmp) { this->Set##name (5, _tmp);} \
223 virtual void Set##name (type _name0,type _name1,type _name2, type _name3, \
224                         type _name4)\
225 { \
226   type _tmp[5]; \
227   _tmp[0] = _name0; _tmp[1] = _name1; _tmp[2] = _name2; \
228   _tmp[3] = _name3; _tmp[4] = _name4; \
229   this->Set##name (5,_tmp); \
230 } \
231 virtual void Set##name (type _name0,type _name1,type _name2, type _name3) \
232 { \
233   type _tmp[4]; \
234   _tmp[0] = _name0; _tmp[1] = _name1; \
235   _tmp[2] = _name2; _tmp[3] = _name3; \
236   this->Set##name (4,_tmp); \
237 } \
238 virtual void Set##name (type _name0,type _name1,type _name2) \
239 { \
240   type _tmp[3]; \
241   _tmp[0] = _name0; _tmp[1] = _name1; _tmp[2] = _name2; \
242   this->Set##name (3,_tmp); \
243 } \
244 virtual void Set##name (type _name0,type _name1) \
245 { \
246   type _tmp[2]; \
247   _tmp[0] = _name0; _tmp[1] = _name1; \
248   this->Set##name (2,_tmp); \
249 } \
250 virtual void Set##name (type _name0) \
251 { \
252   type _tmp[1]; \
253   _tmp[0] = _name0; \
254   this->Set##name (1,_tmp); \
255
256
257 #define vtkImageGetMacro(name,type) \
258 virtual void Get##name (type _tmp[5]) { this->Get##name (5,_tmp);} \
259 virtual void Get##name (type &_name0,type &_name1,type &_name2,type &_name3, \
260                         type &_name4) \
261 { \
262   type _tmp[5]; \
263   this->Get##name (5,_tmp); \
264   _name0 = _tmp[0]; _name1 = _tmp[1]; _name2 = _tmp[2]; \
265   _name3 = _tmp[3]; _name4 = _tmp[4]; \
266 } \
267 virtual void Get##name (type &_name0,type &_name1,type &_name2,type &_name3) \
268 { \
269   type _tmp[4]; \
270   this->Get##name (4,_tmp); \
271   _name0 = _tmp[0]; _name1 = _tmp[1]; _name2 = _tmp[2]; _name3 = _tmp[3]; \
272 } \
273 virtual void Get##name (type &_name0,type &_name1,type &_name2) \
274 { \
275   type _tmp[3]; \
276   this->Get##name (3,_tmp); \
277   _name0 = _tmp[0]; _name1 = _tmp[1]; _name2 = _tmp[2]; \
278 } \
279 virtual void Get##name (type &_name0,type &_name1) \
280 { \
281   type _tmp[2]; \
282   this->Get##name (2,_tmp); \
283   _name0 = _tmp[0]; _name1 = _tmp[1]; \
284 } \
285 virtual void Get##name (type &_name0) \
286 { \
287   type _tmp[1]; \
288   this->Get##name (1,_tmp); \
289   _name0 = _tmp[0]; \
290
291
292
293
294 #define vtkImageSetExtentMacro(name) \
295 virtual void Set##name (int _tmp[10]) { this->Set##name (5,_tmp);} \
296 virtual void Set##name (int _min0,int _max0,int _min1,int _max1, \
297                 int _min2,int _max2,int _min3,int _max3, \
298                 int _min4,int _max4) \
299 { \
300   int _tmp[10]; \
301   _tmp[0] = _min0; _tmp[1] = _max0; \
302   _tmp[2] = _min1; _tmp[3] = _max1; \
303   _tmp[4] = _min2; _tmp[5] = _max2; \
304   _tmp[6] = _min3; _tmp[7] = _max3; \
305   _tmp[8] = _min4; _tmp[9] = _max4; \
306   this->Set##name (5,_tmp); \
307 } \
308 virtual void Set##name (int _min0,int _max0,int _min1,int _max1, \
309                 int _min2,int _max2,int _min3,int _max3) \
310 { \
311   int _tmp[8]; \
312   _tmp[0] = _min0; _tmp[1] = _max0; \
313   _tmp[2] = _min1; _tmp[3] = _max1; \
314   _tmp[4] = _min2; _tmp[5] = _max2; \
315   _tmp[6] = _min3; _tmp[7] = _max3; \
316   this->Set##name (4,_tmp); \
317 } \
318 virtual void Set##name (int _min0,int _max0,int _min1,int _max1, \
319                 int _min2,int _max2) \
320 { \
321   int _tmp[6]; \
322   _tmp[0] = _min0; _tmp[1] = _max0; \
323   _tmp[2] = _min1; _tmp[3] = _max1; \
324   _tmp[4] = _min2; _tmp[5] = _max2; \
325   this->Set##name (3,_tmp); \
326 } \
327 virtual void Set##name (int _min0,int _max0,int _min1,int _max1) \
328 { \
329   int _tmp[4]; \
330   _tmp[0] = _min0; _tmp[1] = _max0; \
331   _tmp[2] = _min1; _tmp[3] = _max1; \
332   this->Set##name (2,_tmp); \
333 } \
334 virtual void Set##name (int _min0,int _max0) \
335 { \
336   int _tmp[2]; \
337   _tmp[0] = _min0; _tmp[1] = _max0; \
338   this->Set##name (1,_tmp); \
339
340 #define vtkImageGetExtentMacro(name) \
341 int *Get##name () { return this->name ;}  \
342 virtual void Get##name (int _tmp[10]) { this->Get##name (5,_tmp);} \
343 virtual void Get##name (int &_min0,int &_max0,int &_min1,int &_max1, \
344                 int &_min2,int &_max2,int &_min3,int &_max3, \
345                 int &_min4,int &_max4) \
346 { \
347   int _tmp[10]; \
348   this->Get##name (5,_tmp); \
349   _min0 = _tmp[0]; _max0 = _tmp[1]; \
350   _min1 = _tmp[2]; _max1 = _tmp[3]; \
351   _min2 = _tmp[4]; _max2 = _tmp[5]; \
352   _min3 = _tmp[6]; _max3 = _tmp[7]; \
353   _min4 = _tmp[8]; _max4 = _tmp[9]; \
354 } \
355 virtual void Get##name (int &_min0,int &_max0,int &_min1,int &_max1, \
356                 int &_min2,int &_max2,int &_min3,int &_max3) \
357 { \
358   int _tmp[8]; \
359   this->Get##name (4,_tmp); \
360   _min0 = _tmp[0]; _max0 = _tmp[1]; \
361   _min1 = _tmp[2]; _max1 = _tmp[3]; \
362   _min2 = _tmp[4]; _max2 = _tmp[5]; \
363   _min3 = _tmp[6]; _max3 = _tmp[7]; \
364 } \
365 virtual void Get##name (int &_min0,int &_max0,int &_min1,int &_max1, \
366                 int &_min2,int &_max2) \
367 { \
368   int _tmp[6]; \
369   this->Get##name (3,_tmp); \
370   _min0 = _tmp[0]; _max0 = _tmp[1]; \
371   _min1 = _tmp[2]; _max1 = _tmp[3]; \
372   _min2 = _tmp[4]; _max2 = _tmp[5]; \
373 } \
374 virtual void Get##name (int &_min0,int &_max0,int &_min1,int &_max1) \
375 { \
376   int _tmp[4]; \
377   this->Get##name (2,_tmp); \
378   _min0 = _tmp[0]; _max0 = _tmp[1]; \
379   _min1 = _tmp[2]; _max1 = _tmp[3]; \
380 } \
381 virtual void Get##name (int &_min0,int &_max0) \
382 { \
383   int _tmp[2]; \
384   this->Get##name (1,_tmp); \
385   _min0 = _tmp[0]; _max0 = _tmp[1]; \
386
387
388
389 #define vtkImageGetPointerMacro(name,type) \
390 type *Get##name##Pointer(int coords[5]) \
391 { \
392   return this->Get##name##Pointer(5, coords); \
393 } \
394 type *Get##name##Pointer(int _c0, int _c1, int _c2, int _c3, int _c4) \
395 { \
396   int _tmp[5]; \
397   _tmp[0] = _c0; \
398   _tmp[1] = _c1; \
399   _tmp[2] = _c2; \
400   _tmp[3] = _c3; \
401   _tmp[4] = _c4; \
402   return this->Get##name##Pointer (5,_tmp); \
403 } \
404 type *Get##name##Pointer(int _c0, int _c1, int _c2, int _c3) \
405 { \
406   int _tmp[4]; \
407   _tmp[0] = _c0; \
408   _tmp[1] = _c1; \
409   _tmp[2] = _c2; \
410   _tmp[3] = _c3; \
411   return this->Get##name##Pointer (4,_tmp); \
412 } \
413 type *Get##name##Pointer(int _c0, int _c1, int _c2) \
414 { \
415   int _tmp[3]; \
416   _tmp[0] = _c0; \
417   _tmp[1] = _c1; \
418   _tmp[2] = _c2; \
419   return this->Get##name##Pointer (3,_tmp); \
420 } \
421 type *Get##name##Pointer(int _c0, int _c1) \
422 { \
423   int _tmp[2]; \
424   _tmp[0] = _c0; \
425   _tmp[1] = _c1; \
426   return this->Get##name##Pointer (2,_tmp); \
427 } \
428 type *Get##name##Pointer(int _c0) \
429 { \
430   int _tmp[1]; \
431   _tmp[0] = _c0; \
432   return this->Get##name##Pointer (1,_tmp); \
433 } \
434 type *Get##name##Pointer() \
435 { \
436   return this->Get##name##Pointer (0, (int *)(NULL)); \
437
438
439
440
441
442
443
444 #endif
445
446