vil_ras.h
Go to the documentation of this file.
1 // This is core/vil/file_formats/vil_ras.h
2 #ifndef vil_ras_file_format_h_
3 #define vil_ras_file_format_h_
4 //:
5 // \file
6 // \author Amitha Perera
7 // \date 12 Apr 2002
8 //
9 // \verbatim
10 // Modifications
11 // 22 Apr 2003: Amitha Perera - converted to vil
12 // 31 Dec 2005: J.L. Mundy - extended to read 16 bit images - didn't extend writing
13 // \endverbatim
14 //
15 #include <vil/vil_image_resource.h>
16 #include <vil/vil_file_format.h>
17 #include <vil/vil_stream.h>
18 
19 #include <vxl_config.h>
20 
22 
23 
24 //: Loader for Sun raster files
26 {
27  public:
28  char const* tag() const override;
31  unsigned ni,
32  unsigned nj,
33  unsigned nplanes,
34  vil_pixel_format format) override;
35 };
36 
37 //: Generic image implementation for Sun raster files
39 {
41  vxl_uint_32 width_;
42  vxl_uint_32 height_;
43  unsigned components_;
44  unsigned bits_per_component_; //< always 8
45 
47 
48  vxl_uint_32 depth_;
49  vxl_uint_32 length_;
50  vxl_uint_32 type_;
51  vxl_uint_32 map_type_;
52  vxl_uint_32 map_length_;
53  vxl_uint_8* col_map_;
54 
55  bool read_header();
56  bool write_header();
57 
58  friend class vil_ras_file_format;
59  public:
60 
63  unsigned ni,
64  unsigned nj,
65  unsigned nplanes,
66  vil_pixel_format format );
67  ~vil_ras_image() override;
68 
69  // Inherit the documentation from vil_image_resource
70 
71  unsigned nplanes() const override;
72  unsigned ni() const override;
73  unsigned nj() const override;
74 
75  vil_pixel_format pixel_format() const override;
76 
77  //: Create a read/write view of a copy of this data.
78  //
79  // This function will always return a multi-plane, scalar-pixel, RGB
80  // view of the data, even if the disk format is BGR. This follows
81  // the principle of least surprise, since there is an implicit
82  // assumption everywhere that 3-component colour image data is
83  // stored RGB.
84  //
85  // \return 0 if unable to get view of correct size, or if resource is write-only.
86  vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
87  unsigned j0, unsigned nj) const override;
88 
89  bool put_view(const vil_image_view_base& im, unsigned i0, unsigned j0) override;
90 
91  char const* file_format() const override;
92  bool get_property(char const *tag, void *prop = nullptr) const override;
93 };
94 
95 #endif // vil_ras_file_format_h_
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.
unsigned components_
Definition: vil_ras.h:43
vxl_uint_8 * col_map_
Definition: vil_ras.h:53
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_ras.cxx:441
bool write_header()
Definition: vil_ras.cxx:297
bool get_property(char const *tag, void *prop=nullptr) const override
Extra property information.
Definition: vil_ras.cxx:146
vxl_uint_32 length_
Definition: vil_ras.h:49
vil_streampos start_of_data_
Definition: vil_ras.h:46
~vil_ras_image() override
Definition: vil_ras.cxx:204
vxl_uint_32 depth_
Definition: vil_ras.h:48
char const * file_format() const override
Return a string describing the file format.
Definition: vil_ras.cxx:155
vxl_uint_32 type_
Definition: vil_ras.h:50
Base class for image formats.
vil_image_resource_sptr make_output_image(vil_stream *vs, unsigned ni, unsigned nj, unsigned nplanes, vil_pixel_format format) override
Make a "generic_image" on which put_section may be applied.
Definition: vil_ras.cxx:113
unsigned bits_per_component_
Definition: vil_ras.h:44
vxl_uint_32 map_type_
Definition: vil_ras.h:51
Stream interface for VIL image loaders.
Definition: vil_stream.h:21
vil_stream * vs_
Definition: vil_ras.h:40
Generic image implementation for Sun raster files.
Definition: vil_ras.h:38
vil_ras_image(vil_stream *is)
Definition: vil_ras.cxx:136
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.
bool read_header()
Read the header of a Sun raster file.
Definition: vil_ras.cxx:214
unsigned nplanes() const override
Dimensions: Planes x ni x nj.
Definition: vil_ras.cxx:322
vxl_uint_32 width_
Definition: vil_ras.h:41
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_ras.cxx:99
vxl_int_32 vil_streampos
Definition: vil_stream.h:16
unsigned nj() const override
Dimensions: Planes x ni x nj.
Definition: vil_ras.cxx:338
Representation of a generic image source or destination.
char const * tag() const override
Return a character string which uniquely identifies this format.
Definition: vil_ras.cxx:125
Base class for image formats.
vil_pixel_format pixel_format() const override
Pixel Format.
Definition: vil_ras.cxx:345
vxl_uint_32 map_length_
Definition: vil_ras.h:52
Loader for Sun raster files.
Definition: vil_ras.h:25
vxl_uint_32 height_
Definition: vil_ras.h:42
unsigned ni() const override
Dimensions: Planes x ni x nj.
Definition: vil_ras.cxx:330