00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __itkPixelTraits_h
00021 #define __itkPixelTraits_h
00022
00023 namespace itk
00024 {
00025
00034 template<class TPixelType>
00035 class PixelTraits
00036 {
00037 public:
00039 itkStaticConstMacro(Dimension, unsigned int, TPixelType::Length);
00040
00042 typedef typename TPixelType::ValueType ValueType;
00043 };
00044
00046 template <>
00047 class PixelTraits<bool>
00048 {
00049 public:
00050 itkStaticConstMacro(Dimension, unsigned int, 1);
00051 typedef bool ValueType;
00052 };
00053
00054 template <>
00055 class PixelTraits<char>
00056 {
00057 public:
00058 itkStaticConstMacro(Dimension, unsigned int, 1);
00059 typedef char ValueType;
00060 };
00061
00062 template <>
00063 class PixelTraits<unsigned char>
00064 {
00065 public:
00066 itkStaticConstMacro(Dimension, unsigned int, 1);
00067 typedef unsigned char ValueType;
00068 };
00069
00070 template <>
00071 class PixelTraits<short>
00072 {
00073 public:
00074 itkStaticConstMacro(Dimension, unsigned int, 1);
00075 typedef short ValueType;
00076 };
00077
00078 template <>
00079 class PixelTraits<unsigned short>
00080 {
00081 public:
00082 itkStaticConstMacro(Dimension, unsigned int, 1);
00083 typedef unsigned short ValueType;
00084 };
00085
00086 template <>
00087 class PixelTraits<int>
00088 {
00089 public:
00090 itkStaticConstMacro(Dimension, unsigned int, 1);
00091 typedef int ValueType;
00092 };
00093
00094 template <>
00095 class PixelTraits<unsigned int>
00096 {
00097 public:
00098 itkStaticConstMacro(Dimension, unsigned int, 1);
00099 typedef unsigned int ValueType;
00100 };
00101
00102 template <>
00103 class PixelTraits<long>
00104 {
00105 public:
00106 itkStaticConstMacro(Dimension, unsigned int, 1);
00107 typedef long ValueType;
00108 };
00109
00110 template <>
00111 class PixelTraits<unsigned long>
00112 {
00113 public:
00114 itkStaticConstMacro(Dimension, unsigned int, 1);
00115 typedef unsigned long ValueType;
00116 };
00117
00118 template <>
00119 class PixelTraits<float>
00120 {
00121 public:
00122 itkStaticConstMacro(Dimension, unsigned int, 1);
00123 typedef float ValueType;
00124 };
00125
00126 template <>
00127 class PixelTraits<double>
00128 {
00129 public:
00130 itkStaticConstMacro(Dimension, unsigned int, 1);
00131 typedef double ValueType;
00132 };
00133
00151 template <class TValueType1, class TValueType2>
00152 class JoinTraits
00153 {
00154 public:
00155 typedef TValueType1 ValueType;
00156 };
00157
00159 template<>
00160 class JoinTraits<bool, bool>
00161 {
00162 public:
00163 typedef bool ValueType;
00164 };
00165
00166 template<>
00167 class JoinTraits<bool, char>
00168 {
00169 public:
00170 typedef char ValueType;
00171 };
00172
00173 template<>
00174 class JoinTraits<bool, unsigned char>
00175 {
00176 public:
00177 typedef unsigned char ValueType;
00178 };
00179
00180 template<>
00181 class JoinTraits<bool, short>
00182 {
00183 public:
00184 typedef short ValueType;
00185 };
00186
00187 template<>
00188 class JoinTraits<bool, unsigned short>
00189 {
00190 public:
00191 typedef unsigned short ValueType;
00192 };
00193
00194 template<>
00195 class JoinTraits<bool, int>
00196 {
00197 public:
00198 typedef int ValueType;
00199 };
00200
00201 template<>
00202 class JoinTraits<bool, unsigned int>
00203 {
00204 public:
00205 typedef unsigned int ValueType;
00206 };
00207
00208 template<>
00209 class JoinTraits<bool, long>
00210 {
00211 public:
00212 typedef long ValueType;
00213 };
00214
00215 template<>
00216 class JoinTraits<bool, unsigned long>
00217 {
00218 public:
00219 typedef unsigned long ValueType;
00220 };
00221
00222 template<>
00223 class JoinTraits<bool, float>
00224 {
00225 public:
00226 typedef float ValueType;
00227 };
00228
00229 template<>
00230 class JoinTraits<bool, double>
00231 {
00232 public:
00233 typedef double ValueType;
00234 };
00235
00237 template<>
00238 class JoinTraits<char, bool>
00239 {
00240 public:
00241 typedef char ValueType;
00242 };
00243
00244 template<>
00245 class JoinTraits<char, char>
00246 {
00247 public:
00248 typedef char ValueType;
00249 };
00250
00251 template<>
00252 class JoinTraits<char, unsigned char>
00253 {
00254 public:
00255 typedef short ValueType;
00256 };
00257
00258 template<>
00259 class JoinTraits<char, short>
00260 {
00261 public:
00262 typedef short ValueType;
00263 };
00264
00265 template<>
00266 class JoinTraits<char, unsigned short>
00267 {
00268 public:
00269 typedef int ValueType;
00270 };
00271
00272 template<>
00273 class JoinTraits<char, int>
00274 {
00275 public:
00276 typedef int ValueType;
00277 };
00278
00279 template<>
00280 class JoinTraits<char, unsigned int>
00281 {
00282 public:
00283
00284 typedef float ValueType;
00285 };
00286
00287 template<>
00288 class JoinTraits<char, long>
00289 {
00290 public:
00291 typedef long ValueType;
00292 };
00293
00294 template<>
00295 class JoinTraits<char, unsigned long>
00296 {
00297 public:
00298 typedef float ValueType;
00299 };
00300
00301 template<>
00302 class JoinTraits<char, float>
00303 {
00304 public:
00305 typedef float ValueType;
00306 };
00307
00308 template<>
00309 class JoinTraits<char, double>
00310 {
00311 public:
00312 typedef double ValueType;
00313 };
00314
00316 template<>
00317 class JoinTraits<unsigned char, bool>
00318 {
00319 public:
00320 typedef unsigned char ValueType;
00321 };
00322
00323 template<>
00324 class JoinTraits<unsigned char, char>
00325 {
00326 public:
00327 typedef short ValueType;
00328 };
00329
00330 template<>
00331 class JoinTraits<unsigned char, unsigned char>
00332 {
00333 public:
00334 typedef unsigned char ValueType;
00335 };
00336
00337 template<>
00338 class JoinTraits<unsigned char, short>
00339 {
00340 public:
00341 typedef short ValueType;
00342 };
00343
00344 template<>
00345 class JoinTraits<unsigned char, unsigned short>
00346 {
00347 public:
00348 typedef unsigned short ValueType;
00349 };
00350
00351 template<>
00352 class JoinTraits<unsigned char, int>
00353 {
00354 public:
00355 typedef int ValueType;
00356 };
00357
00358 template<>
00359 class JoinTraits<unsigned char, unsigned int>
00360 {
00361 public:
00362 typedef unsigned int ValueType;
00363 };
00364
00365 template<>
00366 class JoinTraits<unsigned char, long>
00367 {
00368 public:
00369 typedef long ValueType;
00370 };
00371
00372 template<>
00373 class JoinTraits<unsigned char, unsigned long>
00374 {
00375 public:
00376 typedef unsigned long ValueType;
00377 };
00378
00379 template<>
00380 class JoinTraits<unsigned char, float>
00381 {
00382 public:
00383 typedef float ValueType;
00384 };
00385
00386 template<>
00387 class JoinTraits<unsigned char, double>
00388 {
00389 public:
00390 typedef double ValueType;
00391 };
00392
00394 template<>
00395 class JoinTraits<short, bool>
00396 {
00397 public:
00398 typedef short ValueType;
00399 };
00400
00401 template<>
00402 class JoinTraits<short, char>
00403 {
00404 public:
00405 typedef short ValueType;
00406 };
00407
00408 template<>
00409 class JoinTraits<short, unsigned char>
00410 {
00411 public:
00412 typedef short ValueType;
00413 };
00414
00415 template<>
00416 class JoinTraits<short, short>
00417 {
00418 public:
00419 typedef short ValueType;
00420 };
00421
00422 template<>
00423 class JoinTraits<short, unsigned short>
00424 {
00425 public:
00426 typedef int ValueType;
00427 };
00428
00429 template<>
00430 class JoinTraits<short, int>
00431 {
00432 public:
00433 typedef int ValueType;
00434 };
00435
00436 template<>
00437 class JoinTraits<short, unsigned int>
00438 {
00439 public:
00440
00441 typedef float ValueType;
00442 };
00443
00444 template<>
00445 class JoinTraits<short, long>
00446 {
00447 public:
00448 typedef long ValueType;
00449 };
00450
00451 template<>
00452 class JoinTraits<short, unsigned long>
00453 {
00454 public:
00455 typedef float ValueType;
00456 };
00457
00458 template<>
00459 class JoinTraits<short, float>
00460 {
00461 public:
00462 typedef float ValueType;
00463 };
00464
00465 template<>
00466 class JoinTraits<short, double>
00467 {
00468 public:
00469 typedef double ValueType;
00470 };
00471
00473 template<>
00474 class JoinTraits<unsigned short, bool>
00475 {
00476 public:
00477 typedef unsigned short ValueType;
00478 };
00479
00480 template<>
00481 class JoinTraits<unsigned short, char>
00482 {
00483 public:
00484 typedef int ValueType;
00485 };
00486
00487 template<>
00488 class JoinTraits<unsigned short, unsigned char>
00489 {
00490 public:
00491 typedef unsigned short ValueType;
00492 };
00493
00494 template<>
00495 class JoinTraits<unsigned short, short>
00496 {
00497 public:
00498 typedef int ValueType;
00499 };
00500
00501 template<>
00502 class JoinTraits<unsigned short, unsigned short>
00503 {
00504 public:
00505 typedef unsigned short ValueType;
00506 };
00507
00508 template<>
00509 class JoinTraits<unsigned short, int>
00510 {
00511 public:
00512 typedef int ValueType;
00513 };
00514
00515 template<>
00516 class JoinTraits<unsigned short, unsigned int>
00517 {
00518 public:
00519 typedef unsigned int ValueType;
00520 };
00521
00522 template<>
00523 class JoinTraits<unsigned short, long>
00524 {
00525 public:
00526 typedef long ValueType;
00527 };
00528
00529 template<>
00530 class JoinTraits<unsigned short, unsigned long>
00531 {
00532 public:
00533 typedef unsigned long ValueType;
00534 };
00535
00536 template<>
00537 class JoinTraits<unsigned short, float>
00538 {
00539 public:
00540 typedef float ValueType;
00541 };
00542
00543 template<>
00544 class JoinTraits<unsigned short, double>
00545 {
00546 public:
00547 typedef double ValueType;
00548 };
00549
00551 template<>
00552 class JoinTraits<int, bool>
00553 {
00554 public:
00555 typedef int ValueType;
00556 };
00557
00558 template<>
00559 class JoinTraits<int, char>
00560 {
00561 public:
00562 typedef int ValueType;
00563 };
00564
00565 template<>
00566 class JoinTraits<int, unsigned char>
00567 {
00568 public:
00569 typedef int ValueType;
00570 };
00571
00572 template<>
00573 class JoinTraits<int, short>
00574 {
00575 public:
00576 typedef int ValueType;
00577 };
00578
00579 template<>
00580 class JoinTraits<int, unsigned short>
00581 {
00582 public:
00583 typedef int ValueType;
00584 };
00585
00586 template<>
00587 class JoinTraits<int, int>
00588 {
00589 public:
00590 typedef int ValueType;
00591 };
00592
00593 template<>
00594 class JoinTraits<int, unsigned int>
00595 {
00596 public:
00597
00598 typedef float ValueType;
00599 };
00600
00601 template<>
00602 class JoinTraits<int, long>
00603 {
00604 public:
00605 typedef long ValueType;
00606 };
00607
00608 template<>
00609 class JoinTraits<int, unsigned long>
00610 {
00611 public:
00612 typedef float ValueType;
00613 };
00614
00615 template<>
00616 class JoinTraits<int, float>
00617 {
00618 public:
00619 typedef float ValueType;
00620 };
00621
00622 template<>
00623 class JoinTraits<int, double>
00624 {
00625 public:
00626 typedef double ValueType;
00627 };
00628
00630 template<>
00631 class JoinTraits<unsigned int, bool>
00632 {
00633 public:
00634 typedef unsigned int ValueType;
00635 };
00636
00637 template<>
00638 class JoinTraits<unsigned int, char>
00639 {
00640 public:
00641
00642 typedef float ValueType;
00643 };
00644
00645 template<>
00646 class JoinTraits<unsigned int, unsigned char>
00647 {
00648 public:
00649 typedef unsigned int ValueType;
00650 };
00651
00652 template<>
00653 class JoinTraits<unsigned int, short>
00654 {
00655 public:
00656
00657 typedef float ValueType;
00658 };
00659
00660 template<>
00661 class JoinTraits<unsigned int, unsigned short>
00662 {
00663 public:
00664 typedef unsigned int ValueType;
00665 };
00666
00667 template<>
00668 class JoinTraits<unsigned int, int>
00669 {
00670 public:
00671
00672 typedef float ValueType;
00673 };
00674
00675 template<>
00676 class JoinTraits<unsigned int, unsigned int>
00677 {
00678 public:
00679 typedef unsigned int ValueType;
00680 };
00681
00682 template<>
00683 class JoinTraits<unsigned int, long>
00684 {
00685 public:
00686 typedef float ValueType;
00687 };
00688
00689 template<>
00690 class JoinTraits<unsigned int, unsigned long>
00691 {
00692 public:
00693 typedef unsigned long ValueType;
00694 };
00695
00696 template<>
00697 class JoinTraits<unsigned int, float>
00698 {
00699 public:
00700 typedef float ValueType;
00701 };
00702
00703 template<>
00704 class JoinTraits<unsigned int, double>
00705 {
00706 public:
00707 typedef double ValueType;
00708 };
00709
00711 template<>
00712 class JoinTraits<long, bool>
00713 {
00714 public:
00715 typedef long ValueType;
00716 };
00717
00718 template<>
00719 class JoinTraits<long, char>
00720 {
00721 public:
00722 typedef long ValueType;
00723 };
00724
00725 template<>
00726 class JoinTraits<long, unsigned char>
00727 {
00728 public:
00729 typedef long ValueType;
00730 };
00731
00732 template<>
00733 class JoinTraits<long, short>
00734 {
00735 public:
00736 typedef long ValueType;
00737 };
00738
00739 template<>
00740 class JoinTraits<long, unsigned short>
00741 {
00742 public:
00743 typedef long ValueType;
00744 };
00745
00746 template<>
00747 class JoinTraits<long, int>
00748 {
00749 public:
00750 typedef long ValueType;
00751 };
00752
00753 template<>
00754 class JoinTraits<long, unsigned int>
00755 {
00756 public:
00757 typedef float ValueType;
00758 };
00759
00760 template<>
00761 class JoinTraits<long, long>
00762 {
00763 public:
00764 typedef long ValueType;
00765 };
00766
00767 template<>
00768 class JoinTraits<long, unsigned long>
00769 {
00770 public:
00771 typedef float ValueType;
00772 };
00773
00774 template<>
00775 class JoinTraits<long, float>
00776 {
00777 public:
00778 typedef float ValueType;
00779 };
00780
00781 template<>
00782 class JoinTraits<long, double>
00783 {
00784 public:
00785 typedef double ValueType;
00786 };
00787
00789 template<>
00790 class JoinTraits<unsigned long, bool>
00791 {
00792 public:
00793 typedef unsigned long ValueType;
00794 };
00795
00796 template<>
00797 class JoinTraits<unsigned long, char>
00798 {
00799 public:
00800 typedef float ValueType;
00801 };
00802
00803 template<>
00804 class JoinTraits<unsigned long, unsigned char>
00805 {
00806 public:
00807 typedef unsigned long ValueType;
00808 };
00809
00810 template<>
00811 class JoinTraits<unsigned long, short>
00812 {
00813 public:
00814 typedef float ValueType;
00815 };
00816
00817 template<>
00818 class JoinTraits<unsigned long, unsigned short>
00819 {
00820 public:
00821 typedef unsigned long ValueType;
00822 };
00823
00824 template<>
00825 class JoinTraits<unsigned long, int>
00826 {
00827 public:
00828 typedef float ValueType;
00829 };
00830
00831 template<>
00832 class JoinTraits<unsigned long, unsigned int>
00833 {
00834 public:
00835 typedef unsigned long ValueType;
00836 };
00837
00838 template<>
00839 class JoinTraits<unsigned long, long>
00840 {
00841 public:
00842 typedef float ValueType;
00843 };
00844
00845 template<>
00846 class JoinTraits<unsigned long, unsigned long>
00847 {
00848 public:
00849 typedef unsigned long ValueType;
00850 };
00851
00852 template<>
00853 class JoinTraits<unsigned long, float>
00854 {
00855 public:
00856 typedef float ValueType;
00857 };
00858
00859 template<>
00860 class JoinTraits<unsigned long, double>
00861 {
00862 public:
00863 typedef double ValueType;
00864 };
00865
00867 template<>
00868 class JoinTraits<float, bool>
00869 {
00870 public:
00871 typedef float ValueType;
00872 };
00873
00874 template<>
00875 class JoinTraits<float, char>
00876 {
00877 public:
00878 typedef float ValueType;
00879 };
00880
00881 template<>
00882 class JoinTraits<float, unsigned char>
00883 {
00884 public:
00885 typedef float ValueType;
00886 };
00887
00888 template<>
00889 class JoinTraits<float, short>
00890 {
00891 public:
00892 typedef float ValueType;
00893 };
00894
00895 template<>
00896 class JoinTraits<float, unsigned short>
00897 {
00898 public:
00899 typedef float ValueType;
00900 };
00901
00902 template<>
00903 class JoinTraits<float, int>
00904 {
00905 public:
00906 typedef float ValueType;
00907 };
00908
00909 template<>
00910 class JoinTraits<float, unsigned int>
00911 {
00912 public:
00913 typedef float ValueType;
00914 };
00915
00916 template<>
00917 class JoinTraits<float, long>
00918 {
00919 public:
00920 typedef float ValueType;
00921 };
00922
00923 template<>
00924 class JoinTraits<float, unsigned long>
00925 {
00926 public:
00927 typedef float ValueType;
00928 };
00929
00930 template<>
00931 class JoinTraits<float, float>
00932 {
00933 public:
00934 typedef float ValueType;
00935 };
00936
00937 template<>
00938 class JoinTraits<float, double>
00939 {
00940 public:
00941 typedef double ValueType;
00942 };
00943
00945 template<>
00946 class JoinTraits<double, bool>
00947 {
00948 public:
00949 typedef double ValueType;
00950 };
00951
00952 template<>
00953 class JoinTraits<double, char>
00954 {
00955 public:
00956 typedef double ValueType;
00957 };
00958
00959 template<>
00960 class JoinTraits<double, unsigned char>
00961 {
00962 public:
00963 typedef double ValueType;
00964 };
00965
00966 template<>
00967 class JoinTraits<double, short>
00968 {
00969 public:
00970 typedef double ValueType;
00971 };
00972
00973 template<>
00974 class JoinTraits<double, unsigned short>
00975 {
00976 public:
00977 typedef double ValueType;
00978 };
00979
00980 template<>
00981 class JoinTraits<double, int>
00982 {
00983 public:
00984 typedef double ValueType;
00985 };
00986
00987 template<>
00988 class JoinTraits<double, unsigned int>
00989 {
00990 public:
00991 typedef double ValueType;
00992 };
00993
00994 template<>
00995 class JoinTraits<double, long>
00996 {
00997 public:
00998 typedef double ValueType;
00999 };
01000
01001 template<>
01002 class JoinTraits<double, unsigned long>
01003 {
01004 public:
01005 typedef double ValueType;
01006 };
01007
01008 template<>
01009 class JoinTraits<double, float>
01010 {
01011 public:
01012 typedef double ValueType;
01013 };
01014
01015 template<>
01016 class JoinTraits<double, double>
01017 {
01018 public:
01019 typedef double ValueType;
01020 };
01021
01022 }
01023
01024 #endif // __itkPixelTraits_h