Go to the documentation of this file.00001
00002 #ifndef vil_viff_file_format_h_
00003 #define vil_viff_file_format_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <vil/vil_stream.h>
00019 #include <vil/vil_file_format.h>
00020 #include <vil/vil_image_resource.h>
00021 #include "vil_viffheader.h"
00022 #include <vxl_config.h>
00023
00024
00025
00026
00027 class vil_viff_file_format : public vil_file_format
00028 {
00029 public:
00030 virtual char const* tag() const;
00031 virtual vil_image_resource_sptr make_input_image(vil_stream* vs);
00032 virtual vil_image_resource_sptr make_output_image(vil_stream* vs,
00033 unsigned int ni, unsigned int nj, unsigned int nplanes,
00034 vil_pixel_format format);
00035 };
00036
00037
00038 class vil_viff_image : public vil_image_resource
00039 {
00040 vil_stream* is_;
00041 unsigned int ni_;
00042 unsigned int nj_;
00043 unsigned int nplanes_;
00044
00045 vil_streampos start_of_data_;
00046 enum vil_pixel_format format_;
00047
00048 bool endian_consistent_;
00049 vil_viff_xvimage header_;
00050
00051 bool read_header();
00052 bool write_header();
00053 bool check_endian();
00054
00055 friend class vil_viff_file_format;
00056
00057 public:
00058 vil_viff_image(vil_stream* is);
00059 vil_viff_image(vil_stream* is,
00060 unsigned int ni, unsigned int nj, unsigned int nplanes,
00061 vil_pixel_format format);
00062 ~vil_viff_image();
00063
00064
00065 virtual unsigned int ni() const { return ni_; }
00066 virtual unsigned int nj() const { return nj_; }
00067 virtual unsigned int nplanes() const { return nplanes_; }
00068
00069 virtual enum vil_pixel_format pixel_format() const { return format_; }
00070
00071
00072 virtual vil_image_view_base_sptr get_copy_view(unsigned int x0, unsigned int ni, unsigned int y0, unsigned int nj) const;
00073
00074 virtual bool put_view(vil_image_view_base const& buf, unsigned int x0, unsigned int y0);
00075
00076 char const* file_format() const;
00077 bool get_property(char const *tag, void *prop = 0) const;
00078
00079
00080 vxl_uint_32 ispare1() const { return header_.ispare1;}
00081 vxl_uint_32 ispare2() const { return header_.ispare2;}
00082 float fspare1() const { return header_.fspare1;}
00083 float fspare2() const { return header_.fspare2;}
00084 void set_ispare1(vxl_uint_32 ispare1);
00085 void set_ispare2(vxl_uint_32 ispare2);
00086 void set_fspare1(float fspare1);
00087 void set_fspare2(float fspare2);
00088 };
00089
00090 #endif // vil_viff_file_format_h_