vil_sgi.h
Go to the documentation of this file.
1 // This is core/vil/file_formats/vil_sgi.h
2 #ifndef vil_sgi_file_format_h_
3 #define vil_sgi_file_format_h_
4 //:
5 // \file
6 // \author David Hughes
7 // \date 16 May 2018
8 
9 
10 #include <vil/vil_file_format.h>
11 #include <vil/vil_stream.h>
12 #include "vil_sgi_file_header.h"
13 
14 //=============================================================================
15 
16 //: Loader for SGI files
18 {
19  public:
20  char const* tag() const override;
23  unsigned nx,
24  unsigned ny,
25  unsigned nplanes,
26  vil_pixel_format format) override;
27 };
28 
29 //: Generic image implementation for SGI files
31 {
32  public:
33  vil_sgi_image(vil_stream* is, unsigned ni,
34  unsigned nj, unsigned nplanes, vil_pixel_format format);
36  ~vil_sgi_image() override;
37 
38  //: Dimensions: planes x width x height x components
39  unsigned nplanes() const override;
40  unsigned ni() const override;
41  unsigned nj() const override;
42 
43  enum vil_pixel_format pixel_format() const override {return VIL_PIXEL_FORMAT_BYTE; }
44 
45  //: Create a read/write view of a copy of this data.
46  // \return 0 if unable to get view of correct size.
47  vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
48  unsigned j0, unsigned nj) const override;
49 
50  //: Put the data in this view back into the image source.
51  bool put_view(const vil_image_view_base& im, unsigned i0, unsigned j0) override;
52 
53  char const* file_format() const override;
54  bool get_property(char const *tag, void *prop = nullptr) const override;
55  private:
57 
58  bool read_header();
59  bool write_header();
60 
61  friend class vil_sgi_file_format;
62 
64 };
65 
66 
67 #endif // vil_sgi_file_format_h_
vil_sgi_image(vil_stream *is, unsigned ni, unsigned nj, unsigned nplanes, vil_pixel_format format)
Definition: vil_sgi.cxx:63
Stream interface for VIL image loaders.
An abstract base class of smart pointers to actual image data in memory.
vil_pixel_format
Describes the type of the concrete data.
enum vil_pixel_format pixel_format() const override
Pixel Format.
Definition: vil_sgi.h:43
bool put_view(const vil_image_view_base &im, unsigned i0, unsigned j0) override
Put the data in this view back into the image source.
Definition: vil_sgi.cxx:190
bool get_property(char const *tag, void *prop=nullptr) const override
Extra property information.
Definition: vil_sgi.cxx:58
Base class for image formats.
char const * tag() const override
Return a character string which uniquely identifies this format.
Definition: vil_sgi.cxx:38
bool write_header()
Definition: vil_sgi.cxx:150
vil_stream * is_
Definition: vil_sgi.h:56
Stream interface for VIL image loaders.
Definition: vil_stream.h:21
~vil_sgi_image() override
Definition: vil_sgi.cxx:92
bool read_header()
Definition: vil_sgi.cxx:112
vil_image_resource_sptr make_input_image(vil_stream *vs) override
Attempt to make a generic_image which will read from vil_stream vs.
Definition: vil_sgi.cxx:14
char const * file_format() const override
Return a string describing the file format.
Definition: vil_sgi.cxx:45
Generic image implementation for SGI files.
Definition: vil_sgi.h:30
Abstract representation of an image source or image destination.
vil_image_view_base_sptr get_copy_view() const
Create a read/write view of a copy of all the data.
unsigned ni() const override
Dimensions: Planes x ni x nj.
Definition: vil_sgi.cxx:102
unsigned nplanes() const override
Dimensions: planes x width x height x components.
Definition: vil_sgi.cxx:97
unsigned nj() const override
Dimensions: Planes x ni x nj.
Definition: vil_sgi.cxx:107
Loader for SGI files.
Definition: vil_sgi.h:17
Base class for image formats.
vil_image_resource_sptr make_output_image(vil_stream *vs, unsigned nx, unsigned ny, unsigned nplanes, vil_pixel_format format) override
Make a "generic_image" on which put_section may be applied.
Definition: vil_sgi.cxx:27
vil_sgi_file_header hdr
Definition: vil_sgi.h:63