vil_openjpeg_pyramid_image_resource.h
Go to the documentation of this file.
1 // This is core/vil/file_formats/vil_openjpeg_pyramid_image_resource.h
2 #ifndef vil_openjpeg_pyramid_image_resource_h_
3 #define vil_openjpeg_pyramid_image_resource_h_
4 //:
5 // \file
6 // \brief Representation of a pyramid resolution hierarchy based on the openjpeg_image
7 //
8 // \author J. L. Mundy
9 // \date April 22, 2009
10 // Do not remove the following notice
11 // Approved for public Release, distribution unlimited
12 // DISTAR Case 14074
13 //
14 #include <vector>
15 #ifdef _MSC_VER
16 # include <vcl_msvc_warnings.h>
17 #endif
20 
22 {
23  public:
25  ~vil_openjpeg_pyramid_image_resource() override = default;
26 
27  //: The number of planes (or components) in the image.
28  // Dimensions: Planes x ni x nj.
29  // This method refers to the base (max resolution) image
30  // This concept is treated as a synonym to components.
31  unsigned nplanes() const override;
32 
33  //: The number of pixels in each row.
34  // Dimensions: Planes x ni x nj.
35  // This method refers to the base (max resolution) image
36  unsigned ni() const override;
37 
38  //: The number of pixels in each column.
39  // Dimensions: Planes x ni x nj.
40  // This method refers to the base (max resolution) image
41  unsigned nj() const override;
42 
43  //: Pixel Format.
44  enum vil_pixel_format pixel_format() const override;
45 
46  //: Put the data in this view back into the base image.
47  // Pyramid is readonly.
48  // This is essentially (although not formally) a pure virtual function.
49  bool put_view(vil_image_view_base const& /*im*/, unsigned /*i0*/, unsigned /*j0*/) override
50  { return false; }
51 
52  //: Return a string describing the file format.
53  // Only file images have a format, others return 0
54  char const* file_format() const override;
55 
56  // === Methods particular to pyramid resource ===
57 
58  //: Number of pyramid levels.
59  unsigned nlevels() const override;
60 
61  //: Get a partial view from the image from a specified pyramid level
62  vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
63  unsigned j0, unsigned nj,
64  unsigned level) const override;
65 
66  //: Get a complete view from a specified pyramid level.
67  // This method needs no specialization.
68  vil_image_view_base_sptr get_copy_view(unsigned level) const override
69  { return get_copy_view(0, ni(), 0, nj(), level); }
70 
71  //: Get a partial view from the image in the pyramid closest to scale.
72  // The origin and size parameters are in the coordinate system of the base image.
73  // The scale factor is with respect to the base image (base scale = 1.0).
74  vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
75  unsigned j0, unsigned nj,
76  const float scale,
77  float& actual_scale) const override;
78 
79  //: Get a complete view from the image in the pyramid closest to the specified scale.
80  // The scale factor is with respect to the base image (base scale = 1.0).
81  // This method needs no specialization.
82  vil_image_view_base_sptr get_copy_view(const float scale, float& actual_scale) const override
83  { return get_copy_view(0, ni(), 0, nj(), scale, actual_scale); }
84 
85  //: Copy a resource into the pyramid, level is determined by resource scale
86  bool put_resource(vil_image_resource_sptr const& /*resc*/) override
87  { return false; }
88 
89  //: Get an image resource from the pyramid at the specified level
90  vil_image_resource_sptr get_resource(const unsigned level) const override;
91 
92  //: for debug purposes
93  void print(const unsigned level) override;
94 
95  protected:
99 };
100 
101 
102 #endif // vil_openjpeg_pyramid_image_resource_h_
An abstract base class of smart pointers to actual image data in memory.
vil_pixel_format
Describes the type of the concrete data.
vil_image_view_base_sptr get_copy_view(unsigned level) const override
Get a complete view from a specified pyramid level.
vil_image_view_base_sptr get_copy_view(const float scale, float &actual_scale) const override
Get a complete view from the image in the pyramid closest to the specified scale.
unsigned ni() const override
The number of pixels in each row.
Representation of a pyramid resolution hierarchy; mostly pure virtual methods.
void print(const unsigned level) override
for debug purposes.
bool put_resource(vil_image_resource_sptr const &) override
Copy a resource into the pyramid, level is determined by resource scale.
enum vil_pixel_format pixel_format() const override
Pixel Format.
bool put_view(vil_image_view_base const &, unsigned, unsigned) override
Put the data in this view back into the base image.
unsigned nj() const override
The number of pixels in each column.
Representation of a pyramid resolution hierarchy.
vil_image_view_base_sptr get_copy_view() const
Create a read/write view of a copy of all the data.
Image I/O for JPEG2000 imagery using OpenJPEG.
unsigned nplanes() const override
The number of planes (or components) in the image.
~vil_openjpeg_pyramid_image_resource() override=default
vil_image_resource_sptr get_resource(const unsigned level) const override
Get an image resource from the pyramid at the specified level.
Derived image resource for JPEG2000 imagery using OpenJPEG.
Definition: vil_openjpeg.h:121
char const * file_format() const override
Return a string describing the file format.
unsigned nlevels() const override
Number of pyramid levels.