core/vil1/file_formats/vil1_iris.h

Go to the documentation of this file.
00001 // This is core/vil1/file_formats/vil1_iris.h
00002 #ifndef vil1_iris_file_format_h_
00003 #define vil1_iris_file_format_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \author Joris Schouteden, ESAT, KULeuven.
00010 // \date 17 Feb 2000
00011 //
00012 //\verbatim
00013 //  Modifications
00014 //  17-Feb-2000 JS - Initial version, copied from IrisRGBImage.C
00015 //     Jul-2000 Peter Vanroose - bug fixed in write_header() by adding extra argument to constructor to pass imagename_ member
00016 //   3-Oct-2001 Peter Vanroose - Implemented get_property("top_row_first")
00017 //   5-Jun-2003 Peter Vanroose - bug fix in get_section & put_section: storage is planar, not RGB
00018 //\endverbatim
00019 
00020 #include <vil1/vil1_file_format.h>
00021 #include <vil1/vil1_image_impl.h>
00022 
00023 //: Loader for RGB files (sgi iris)
00024 class vil1_iris_file_format : public vil1_file_format
00025 {
00026  public:
00027   virtual char const* tag() const;
00028   virtual vil1_image_impl* make_input_image(vil1_stream* vs);
00029   virtual vil1_image_impl* make_output_image(vil1_stream* vs, int planes,
00030                                              int width,
00031                                              int height,
00032                                              int components,
00033                                              int bits_per_component,
00034                                              vil1_component_format format);
00035 };
00036 
00037 //: Generic image implementation for RGB files
00038 class vil1_iris_generic_image : public vil1_image_impl
00039 {
00040   unsigned long *starttab_;
00041   unsigned long *lengthtab_;
00042 
00043   bool read_header();
00044   bool write_header();
00045 
00046   friend class vil1_iris_file_format;
00047  public:
00048 
00049   vil1_iris_generic_image(vil1_stream* is, char* imagename = "");
00050   vil1_iris_generic_image(vil1_stream* is,
00051                           int planes,
00052                           int width,
00053                           int height,
00054                           int components,
00055                           int bits_per_component,
00056                           vil1_component_format format);
00057   ~vil1_iris_generic_image();
00058 
00059   //: Dimensions.  Planes x W x H x Components.  components() is always 1.
00060   virtual int planes() const { return planes_; }
00061   virtual int width() const { return width_; }
00062   virtual int height() const { return height_; }
00063   virtual int components() const { return components_; }
00064 
00065   virtual int bits_per_component() const { return bytes_per_component_ * 8; }
00066   int bytes_per_pixel() const { return bytes_per_component_ * planes_; };
00067 
00068   virtual enum vil1_component_format component_format() const { return VIL1_COMPONENT_FORMAT_UNSIGNED_INT; }
00069 
00070   virtual vil1_image get_plane(unsigned int p) const;
00071 
00072   virtual bool get_section(void* buf, int x0, int y0, int, int) const;
00073   virtual bool put_section(void const* buf, int x0, int y0, int width, int height);
00074 
00075   char const* file_format() const;
00076   bool get_property(char const *tag, void *prop = 0) const;
00077 
00078 //protected:
00079   vil1_stream* is_;
00080 
00081   int magic_;
00082 
00083   int width_;
00084   int height_;
00085   int planes_;
00086 
00087   int pixmin_;
00088   int pixmax_;
00089   int storage_;
00090   int dimension_;
00091   int colormap_;
00092   char imagename_[81];
00093   int start_of_data_;
00094   int components_;
00095   int bits_per_component_;
00096   int bytes_per_component_;
00097 
00098   bool read_offset_tables();
00099 
00100   // Read a Run-Length encoded section
00101   bool get_section_rle(void* ib, int x0, int y0, int xs, int ys) const;
00102 
00103   // Read a plain section
00104   bool get_section_verbatim(void* ib, int x0, int y0, int xs, int ys) const;
00105 };
00106 
00107 #endif // vil1_iris_file_format_h_

Generated on Sat Nov 22 05:08:28 2008 for core/vil1 by  doxygen 1.5.1