1 // This is mul/vil3d/vil3d_file_format.h
2 #ifndef vil3d_file_format_h_
3 #define vil3d_file_format_h_
4 //:
5 // \file
6 // \brief Manager for 3d image file loaders
7 // \author Tim Cootes - Manchester
8 
9 #include <vil3d/vil3d_image_view_base.h>
10 #include <vil3d/vil3d_image_resource.h>
11 
12 class vil3d_file_format
13 {
14  public:
15   virtual ~vil3d_file_format() = default;
16 
17   //: Add a format reader to current list of those available
18   // This function will take ownership of the passed object, and will
19   // delete it when the program dies.
20   static void add_format(vil3d_file_format* new_format);
21 
22   //: Number of formats available (number added by add_format()
23   static unsigned n_formats();
24 
25   //: Access to available format readers supplied by add_format
26   static const vil3d_file_format& format(unsigned i);
27 
28   //: Create an image_resource from an existing file.
29   virtual vil3d_image_resource_sptr make_input_image(const char *filename)const =0;
30 
31   //: Make a "generic_image" on which put_section may be applied.
32   // The file may be opened immediately for writing so that a header can be written.
33   virtual vil3d_image_resource_sptr make_output_image(const char* filename,
34                                                       unsigned ni,
35                                                       unsigned nj,
36                                                       unsigned nk,
37                                                       unsigned nplanes,
38                                                       enum vil_pixel_format) const =0;
39 
40   //: default filename tag for this image.
41   virtual const char *tag()const =0;
42 };
43 
44 #endif
45