contrib/mul/mvl2/mvl2_image_format_plugin.h
Go to the documentation of this file.
00001 #ifndef mvl2_image_format_plugin_h_
00002 #define mvl2_image_format_plugin_h_
00003 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00004 #pragma interface
00005 #endif
00006 //:
00007 // \file
00008 // \brief Interface for loading avi frames as image formats
00009 // \author Franck Bettinger
00010 // \date   Sun Mar 17 22:57:00 2002
00011 // This class implements the plugin to load avi frames as a new formats
00012 
00013 #include <vcl_string.h>
00014 #include <vcl_map.h>
00015 #include <vil/vil_image_view_base.h>
00016 #include <vil/vil_image_resource_plugin.h>
00017 #include <mvl2/mvl2_video_reader.h>
00018 
00019 //=======================================================================
00020 
00021 //: A base class for vil_image_view_base_sptr loading
00022 // This class provides an interface for loading images in new formats
00023 class mvl2_image_format_plugin : public vil_image_resource_plugin
00024 {
00025  public:
00026 
00027   //: Default constructor
00028   mvl2_image_format_plugin();
00029 
00030   //: Destructor
00031   virtual ~mvl2_image_format_plugin();
00032 
00033   //: Name of the class
00034   virtual vcl_string is_a() const;
00035 
00036   //: Attempt to load image from named file.
00037   // \param filetype  String hinting at what image format is (currently unused)
00038   // \param colour define whether to load images as colour or grey-scale
00039   //        Options are '' (ie rely on image), 'Grey' or 'RGB'
00040   // \return true if successful
00041   virtual bool load_the_image(vil_image_view_base_sptr& image,
00042                               vcl_string const& path,
00043                               vcl_string const& filetype,
00044                               vcl_string const& colour="");
00045 
00046   virtual bool load_the_image(vil_image_view_base_sptr& image,
00047                               vcl_string const& path)
00048   { return load_the_image(image, path, "", ""); }
00049 
00050   //: Check whether a filename is a potential candidate for loading and if it is available.
00051   virtual bool can_be_loaded(const vcl_string& filename);
00052 
00053  protected:  // add user-defined methods after this line (do not remove)
00054 
00055   vcl_map<vcl_string,mvl2_video_reader*> mvl2_list_;
00056 
00057   //: Compute the real file name and extract the frame number from the path.
00058   //  The result is true if the file that will be used exists.
00059   bool get_frame_number_and_filename(
00060     vcl_string& filename, int& frame_number, const vcl_string& path);
00061 };
00062 
00063 #endif // mvl2_image_format_plugin_h_