contrib/mul/vimt/vimt_image_pyramid_builder.h
Go to the documentation of this file.
00001 // This is mul/vimt/vimt_image_pyramid_builder.h
00002 #ifndef vimt_image_pyramid_builder_h_
00003 #define vimt_image_pyramid_builder_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 //  \file
00009 //  \brief Base class for objects which build image pyramids.
00010 //  \author Tim Cootes
00011 
00012 #include <vsl/vsl_binary_io.h>
00013 #include <vcl_string.h>
00014 #include <vcl_iosfwd.h>
00015 
00016 class vimt_image;
00017 class vimt_image_pyramid;
00018 
00019 //: Base class for objects which build image pyramids
00020 class vimt_image_pyramid_builder
00021 {
00022  public:
00023 
00024     //: Dflt ctor
00025     vimt_image_pyramid_builder();
00026 
00027     //: Destructor
00028     virtual ~vimt_image_pyramid_builder();
00029 
00030     //: Create new (empty) pyramid on heap
00031     //  Caller responsible for its deletion
00032     virtual vimt_image_pyramid* new_image_pyramid() const =0;
00033 
00034     //: Define maximum number of levels to build
00035     //  Limits levels built in subsequent calls to build()
00036     //  Useful efficiency measure.  As build() only takes
00037     //  a shallow copy of the original image, using
00038     //  max_l=1 avoids any copying or smoothing.
00039     virtual void set_max_levels(int max_l) =0;
00040 
00041     //: Get the current maximum number levels allowed
00042     virtual int max_levels() const =0;
00043 
00044     //: Build pyramid
00045     virtual void build(vimt_image_pyramid&, const vimt_image&) const = 0;
00046 
00047     //: Extend pyramid
00048     // The first layer of the pyramid must already be set.
00049     virtual void extend(vimt_image_pyramid&) const = 0;
00050 
00051     //: Scale step between levels
00052     virtual double scale_step() const = 0;
00053 
00054     //: Version number for I/O
00055     short version_no() const;
00056 
00057     //: Name of the class
00058     virtual vcl_string is_a() const;
00059 
00060     //: Does the name of the class match the argument?
00061     virtual bool is_class(vcl_string const& s) const;
00062 
00063     //: Create a copy on the heap and return base class pointer
00064     virtual vimt_image_pyramid_builder* clone() const = 0;
00065 
00066     //: Print class to os
00067     virtual void print_summary(vcl_ostream& os) const = 0;
00068 
00069     //: Save class to binary file stream
00070     virtual void b_write(vsl_b_ostream& bfs) const = 0;
00071 
00072     //: Load class from binary file stream
00073     virtual void b_read(vsl_b_istream& bfs) = 0;
00074 };
00075 
00076 //: Allows derived class to be loaded by base-class pointer
00077 //  A loader object exists which is invoked by calls
00078 //  of the form "vsl_b_read(bfs,base_ptr);".  This loads derived class
00079 //  objects from the disk, places them on the heap and
00080 //  returns a base class pointer.
00081 //  In order to work the loader object requires
00082 //  an instance of each derived class that might be
00083 //  found.  This function gives the model class to
00084 //  the appropriate loader.
00085 void vsl_add_to_binary_loader(const vimt_image_pyramid_builder& b);
00086 
00087 //: Binary file stream output operator for class reference
00088 void vsl_b_write(vsl_b_ostream& bfs, const vimt_image_pyramid_builder& b);
00089 
00090 //: Binary file stream input operator for class reference
00091 void vsl_b_read(vsl_b_istream& bfs, vimt_image_pyramid_builder& b);
00092 
00093 //: Stream output operator for class reference
00094 vcl_ostream& operator<<(vcl_ostream& os,const vimt_image_pyramid_builder& b);
00095 
00096 //: Stream output operator for class pointer
00097 vcl_ostream& operator<<(vcl_ostream& os,const vimt_image_pyramid_builder* b);
00098 
00099 #endif // vimt_image_pyramid_builder_h_