00001
00002 #ifndef vil1_viff_h_
00003 #define vil1_viff_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <vil1/vil1_file_format.h>
00022 #include <vil1/vil1_image_impl.h>
00023 #include "vil1_viffheader.h"
00024 #include <vxl_config.h>
00025
00026
00027
00028
00029
00030 class vil1_viff_file_format : public vil1_file_format
00031 {
00032 public:
00033 virtual char const* tag() const;
00034 virtual vil1_image_impl* make_input_image(vil1_stream* vs);
00035 virtual vil1_image_impl* make_output_image(vil1_stream* vs, int planes,
00036 int width,
00037 int height,
00038 int components,
00039 int bits_per_component,
00040 vil1_component_format format);
00041 };
00042
00043
00044 class vil1_viff_generic_image : public vil1_image_impl
00045 {
00046 vil1_stream* is_;
00047 int width_;
00048 int height_;
00049 int maxval_;
00050 int planes_;
00051
00052 int start_of_data_;
00053 int bits_per_component_;
00054 enum vil1_component_format format_;
00055
00056 bool endian_consistent_;
00057 vil1_viff_xvimage header_;
00058
00059 bool read_header();
00060 bool write_header();
00061 bool check_endian();
00062
00063 friend class vil1_viff_file_format;
00064
00065 public:
00066 vil1_viff_generic_image(vil1_stream* is);
00067 vil1_viff_generic_image(vil1_stream* is,
00068 int planes,
00069 int width,
00070 int height,
00071 int components,
00072 int bits_per_component,
00073 vil1_component_format format);
00074 ~vil1_viff_generic_image();
00075
00076
00077 virtual int planes() const { return planes_; }
00078 virtual int width() const { return width_; }
00079 virtual int height() const { return height_; }
00080 virtual int components() const { return 1; }
00081
00082 virtual int bits_per_component() const { return bits_per_component_; }
00083 virtual enum vil1_component_format component_format() const { return format_; }
00084
00085
00086 virtual bool get_section(void* buf, int x0, int y0, int width, int height) const;
00087
00088 virtual bool put_section(void const* buf, int x0, int y0, int width, int height);
00089
00090 virtual vil1_image get_plane(unsigned int p) const;
00091
00092
00093 virtual bool get_section_rgb_byte(void* buf, int x0, int y0, int width, int height) const;
00094 virtual bool get_section_float(void* buf, int x0, int y0, int width, int height) const;
00095 virtual bool get_section_byte(void* buf, int x0, int y0, int width, int height) const;
00096
00097 char const* file_format() const;
00098 bool get_property(char const *tag, void *prop = 0) const;
00099
00100
00101 vxl_uint_32 ispare1() const { return header_.ispare1;}
00102 vxl_uint_32 ispare2() const { return header_.ispare2;}
00103 float fspare1() const { return header_.fspare1;}
00104 float fspare2() const { return header_.fspare2;}
00105 void set_ispare1(vxl_uint_32 ispare1);
00106 void set_ispare2(vxl_uint_32 ispare2);
00107 void set_fspare1(float fspare1);
00108 void set_fspare2(float fspare2);
00109 };
00110
00111 #endif // vil1_viff_h_