core/vil1/file_formats/vil1_tiff.h

Go to the documentation of this file.
00001 // This is core/vil1/file_formats/vil1_tiff.h
00002 #ifndef vil1_tiff_file_format_h_
00003 #define vil1_tiff_file_format_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \author    awf@robots.ox.ac.uk
00010 // \date 16 Feb 00
00011 //
00012 //\verbatim
00013 //  Modifications
00014 //  3 October 2001 Peter Vanroose - Implemented get_property and set_property
00015 //\endverbatim
00016 
00017 #include <vil1/vil1_file_format.h>
00018 #include <vil1/vil1_image_impl.h>
00019 
00020 //: Loader for tiff files
00021 class vil1_tiff_file_format : public vil1_file_format
00022 {
00023  public:
00024   virtual char const* tag() const;
00025   virtual vil1_image_impl* make_input_image(vil1_stream* vs);
00026   virtual vil1_image_impl* make_output_image(vil1_stream* vs, int planes,
00027                                              int width,
00028                                              int height,
00029                                              int components,
00030                                              int bits_per_component,
00031                                              vil1_component_format format);
00032 };
00033 
00034 struct vil1_tiff_structures;
00035 
00036 //: Generic image interface for TIFF files
00037 class vil1_tiff_generic_image : public vil1_image_impl
00038 {
00039   vil1_tiff_structures* p;
00040 
00041   int width_;
00042   int height_;
00043 
00044   int components_;
00045   int bits_per_component_;
00046 
00047   bool read_header();
00048   bool write_header();
00049 
00050   friend class vil1_tiff_file_format;
00051  public:
00052 
00053   vil1_tiff_generic_image(vil1_stream* is);
00054   vil1_tiff_generic_image(vil1_stream* is, int planes,
00055                           int width,
00056                           int height,
00057                           int components,
00058                           int bits_per_component,
00059                           vil1_component_format format);
00060   ~vil1_tiff_generic_image();
00061 
00062   //: TIFF specific fields relating to scanned images
00063   void get_resolution(float& x_res, float& y_res, unsigned short& units) const;
00064   void set_resolution(float x_res, float y_res, unsigned short units);
00065 
00066   //: Dimensions.  Planes x W x H x Components
00067   virtual int planes() const { return 1; }
00068   virtual int width() const { return width_; }
00069   virtual int height() const { return height_; }
00070   virtual int components() const { return components_; }
00071 
00072   virtual int bits_per_component() const { return bits_per_component_; }
00073   virtual enum vil1_component_format component_format() const { return VIL1_COMPONENT_FORMAT_UNSIGNED_INT; }
00074 
00075   //: Copy this to BUF,
00076   virtual bool get_section(void* buf, int x0, int y0, int width, int height) const;
00077   virtual bool put_section(void const* buf, int x0, int y0, int width, int height);
00078 
00079   char const* file_format() const;
00080   bool get_property(char const *tag, void *prop = 0) const;
00081   bool set_property(char const *tag, const void *prop = 0) const;
00082 
00083   vil1_image get_plane(unsigned int p) const;
00084 };
00085 
00086 #endif // vil1_tiff_file_format_h_

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