00001
00002 #ifndef vil_pixel_format_h_
00003 #define vil_pixel_format_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <vil/vil_rgb.h>
00016 #include <vil/vil_rgba.h>
00017 #include <vxl_config.h>
00018 #include <vcl_iosfwd.h>
00019 #include <vcl_complex.h>
00020
00021
00022 enum vil_pixel_format
00023 {
00024 VIL_PIXEL_FORMAT_UNKNOWN = 0,
00025
00026 #if VXL_HAS_INT_64
00027 VIL_PIXEL_FORMAT_UINT_64 = 1,
00028 VIL_PIXEL_FORMAT_INT_64 = 2,
00029 #endif
00030 VIL_PIXEL_FORMAT_UINT_32 = 3,
00031 VIL_PIXEL_FORMAT_INT_32 = 4,
00032 VIL_PIXEL_FORMAT_UINT_16 = 5,
00033 VIL_PIXEL_FORMAT_INT_16 = 6,
00034 VIL_PIXEL_FORMAT_BYTE = 7,
00035 VIL_PIXEL_FORMAT_SBYTE = 8,
00036 VIL_PIXEL_FORMAT_FLOAT = 9,
00037 VIL_PIXEL_FORMAT_DOUBLE = 10,
00038
00039 VIL_PIXEL_FORMAT_BOOL = 12,
00040
00041 #if VXL_HAS_INT_64
00042 VIL_PIXEL_FORMAT_RGB_UINT_64 = 13,
00043 VIL_PIXEL_FORMAT_RGB_INT_64 = 14,
00044 #endif
00045 VIL_PIXEL_FORMAT_RGB_UINT_32 = 15,
00046 VIL_PIXEL_FORMAT_RGB_INT_32 = 16,
00047 VIL_PIXEL_FORMAT_RGB_UINT_16 = 17,
00048 VIL_PIXEL_FORMAT_RGB_INT_16 = 18,
00049 VIL_PIXEL_FORMAT_RGB_BYTE = 19,
00050 VIL_PIXEL_FORMAT_RGB_SBYTE = 20,
00051 VIL_PIXEL_FORMAT_RGB_FLOAT = 21,
00052 VIL_PIXEL_FORMAT_RGB_DOUBLE = 22,
00053
00054
00055 #if VXL_HAS_INT_64
00056 VIL_PIXEL_FORMAT_RGBA_UINT_64 = 24,
00057 VIL_PIXEL_FORMAT_RGBA_INT_64 = 25,
00058 #endif
00059 VIL_PIXEL_FORMAT_RGBA_UINT_32 = 26,
00060 VIL_PIXEL_FORMAT_RGBA_INT_32 = 27,
00061 VIL_PIXEL_FORMAT_RGBA_UINT_16 = 28,
00062 VIL_PIXEL_FORMAT_RGBA_INT_16 = 29,
00063 VIL_PIXEL_FORMAT_RGBA_BYTE = 30,
00064 VIL_PIXEL_FORMAT_RGBA_SBYTE = 31,
00065 VIL_PIXEL_FORMAT_RGBA_FLOAT = 32,
00066 VIL_PIXEL_FORMAT_RGBA_DOUBLE = 33,
00067
00068
00069
00070 VIL_PIXEL_FORMAT_COMPLEX_FLOAT = 35,
00071
00072 VIL_PIXEL_FORMAT_COMPLEX_DOUBLE = 36,
00073
00074
00075
00076
00077 VIL_PIXEL_FORMAT_ENUM_END = 37
00078 };
00079
00080
00081
00082
00083 template <class T>
00084 inline vil_pixel_format vil_pixel_format_of(T){return VIL_PIXEL_FORMAT_UNKNOWN;}
00085
00086
00087
00088
00089
00090
00091 typedef void* vil_pixel_format_invalid_type;
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 template <vil_pixel_format pix_type>
00105 struct vil_pixel_format_type_of
00106 {
00107 typedef vil_pixel_format_invalid_type type;
00108 typedef vil_pixel_format_invalid_type component_type;
00109 };
00110
00111
00112
00113 #define vil_pixel_format_macro(T,C,V)\
00114 VCL_DEFINE_SPECIALIZATION inline vil_pixel_format vil_pixel_format_of(T ) { return V; }\
00115 VCL_DEFINE_SPECIALIZATION struct vil_pixel_format_type_of<V> { typedef T type; typedef C component_type; }
00116
00117 #if VXL_HAS_INT_64
00118 vil_pixel_format_macro(vxl_uint_64, vxl_uint_64, VIL_PIXEL_FORMAT_UINT_64);
00119 vil_pixel_format_macro(vxl_int_64, vxl_int_64, VIL_PIXEL_FORMAT_INT_64);
00120 #endif
00121 vil_pixel_format_macro(vxl_uint_32, vxl_uint_32, VIL_PIXEL_FORMAT_UINT_32);
00122 vil_pixel_format_macro(vxl_int_32, vxl_int_32, VIL_PIXEL_FORMAT_INT_32);
00123 vil_pixel_format_macro(vxl_uint_16, vxl_uint_16, VIL_PIXEL_FORMAT_UINT_16);
00124 vil_pixel_format_macro(vxl_int_16, vxl_int_16, VIL_PIXEL_FORMAT_INT_16);
00125 vil_pixel_format_macro(vxl_byte, vxl_byte, VIL_PIXEL_FORMAT_BYTE);
00126 vil_pixel_format_macro(vxl_sbyte, vxl_sbyte, VIL_PIXEL_FORMAT_SBYTE);
00127 vil_pixel_format_macro(float, float, VIL_PIXEL_FORMAT_FLOAT);
00128 vil_pixel_format_macro(double, double, VIL_PIXEL_FORMAT_DOUBLE);
00129 vil_pixel_format_macro(bool, bool, VIL_PIXEL_FORMAT_BOOL);
00130
00131 #if VXL_HAS_INT_64
00132 vil_pixel_format_macro(vil_rgb<vxl_uint_64>, vxl_uint_64, VIL_PIXEL_FORMAT_RGB_UINT_64);
00133 vil_pixel_format_macro(vil_rgb<vxl_int_64>, vxl_int_64, VIL_PIXEL_FORMAT_RGB_INT_64);
00134 #endif
00135 vil_pixel_format_macro(vil_rgb<vxl_uint_32>, vxl_uint_32, VIL_PIXEL_FORMAT_RGB_UINT_32);
00136 vil_pixel_format_macro(vil_rgb<vxl_int_32>, vxl_int_32, VIL_PIXEL_FORMAT_RGB_INT_32);
00137 vil_pixel_format_macro(vil_rgb<vxl_uint_16>, vxl_uint_16, VIL_PIXEL_FORMAT_RGB_UINT_16);
00138 vil_pixel_format_macro(vil_rgb<vxl_int_16>, vxl_int_16, VIL_PIXEL_FORMAT_RGB_INT_16);
00139 vil_pixel_format_macro(vil_rgb<vxl_byte>, vxl_byte, VIL_PIXEL_FORMAT_RGB_BYTE);
00140 vil_pixel_format_macro(vil_rgb<vxl_sbyte>, vxl_sbyte, VIL_PIXEL_FORMAT_RGB_SBYTE);
00141 vil_pixel_format_macro(vil_rgb<float>, float, VIL_PIXEL_FORMAT_RGB_FLOAT);
00142 vil_pixel_format_macro(vil_rgb<double>, double, VIL_PIXEL_FORMAT_RGB_DOUBLE);
00143
00144 #if VXL_HAS_INT_64
00145 vil_pixel_format_macro(vil_rgba<vxl_uint_64>, vxl_uint_64, VIL_PIXEL_FORMAT_RGBA_UINT_64);
00146 vil_pixel_format_macro(vil_rgba<vxl_int_64>, vxl_int_64, VIL_PIXEL_FORMAT_RGBA_INT_64);
00147 #endif
00148 vil_pixel_format_macro(vil_rgba<vxl_uint_32>, vxl_uint_32, VIL_PIXEL_FORMAT_RGBA_UINT_32);
00149 vil_pixel_format_macro(vil_rgba<vxl_int_32>, vxl_int_32, VIL_PIXEL_FORMAT_RGBA_INT_32);
00150 vil_pixel_format_macro(vil_rgba<vxl_uint_16>, vxl_uint_16, VIL_PIXEL_FORMAT_RGBA_UINT_16);
00151 vil_pixel_format_macro(vil_rgba<vxl_int_16>, vxl_int_16, VIL_PIXEL_FORMAT_RGBA_INT_16);
00152 vil_pixel_format_macro(vil_rgba<vxl_byte>, vxl_byte, VIL_PIXEL_FORMAT_RGBA_BYTE);
00153 vil_pixel_format_macro(vil_rgba<vxl_sbyte>, vxl_sbyte, VIL_PIXEL_FORMAT_RGBA_SBYTE);
00154 vil_pixel_format_macro(vil_rgba<float>, float, VIL_PIXEL_FORMAT_RGBA_FLOAT);
00155 vil_pixel_format_macro(vil_rgba<double>, double, VIL_PIXEL_FORMAT_RGBA_DOUBLE);
00156
00157 vil_pixel_format_macro(vcl_complex<float>, vcl_complex<float>, VIL_PIXEL_FORMAT_COMPLEX_FLOAT);
00158 vil_pixel_format_macro(vcl_complex<double>,vcl_complex<double>,VIL_PIXEL_FORMAT_COMPLEX_DOUBLE);
00159
00160 #undef vil_pixel_format_macro
00161
00162
00163 unsigned vil_pixel_format_sizeof_components(enum vil_pixel_format f);
00164
00165
00166 unsigned vil_pixel_format_num_components(enum vil_pixel_format f);
00167
00168
00169 vil_pixel_format vil_pixel_format_component_format(enum vil_pixel_format f);
00170
00171
00172 vcl_ostream & operator << (vcl_ostream &os, vil_pixel_format f);
00173
00174
00175
00176 vil_pixel_format vil_pixel_format_from_string(const char * s);
00177
00178 #endif // vil_pixel_format_h_