vil_j2k_pyramid_image_resource.h
Go to the documentation of this file.
1 // This is core/vil/file_formats/vil_j2k_pyramid_image_resource.h
2 #ifndef vil_j2k_pyramid_image_resource_h_
3 #define vil_j2k_pyramid_image_resource_h_
4 //:
5 // \file
6 // \brief Representation of a pyramid resolution hierarchy based on the j2k_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:
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  virtual unsigned nplanes() const;
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  virtual unsigned ni() const;
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  virtual unsigned nj() const;
42 
43  //: Pixel Format.
44  virtual enum vil_pixel_format pixel_format() const;
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  virtual bool put_view(vil_image_view_base const& /*im*/, unsigned /*i0*/, unsigned /*j0*/)
50  { return false; }
51 
52  //: Return a string describing the file format.
53  // Only file images have a format, others return 0
54  virtual char const* file_format() const;
55 
56  // === Methods particular to pyramid resource ===
57 
58  //: Number of pyramid levels.
59  // In principle, the number of levels is
60  // undefined since the j2k decoder can decompress to any window size.
61  // A reasonable strategy is to define the number of levels so that
62  // the lowest scale produces a smallest image dimension of 1K pixels
63  virtual unsigned nlevels() const;
64 
65  //: Get a partial view from the image from a specified pyramid level
66  virtual vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned n_i,
67  unsigned j0, unsigned n_j,
68  unsigned level) const;
69 
70  //: Get a complete view from a specified pyramid level.
71  // This method needs no specialisation.
72  virtual vil_image_view_base_sptr get_copy_view(unsigned level) const
73  { return get_copy_view(0, ni(), 0, nj(), level); }
74 
75  //: Get a partial view from the image in the pyramid closest to scale.
76  // The origin and size parameters are in the coordinate system of the base image.
77  // The scale factor is with respect to the base image (base scale = 1.0).
78  virtual vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned n_i,
79  unsigned j0, unsigned n_j,
80  const float scale,
81  float& actual_scale) const;
82 
83  //: Get a complete view from the image in the pyramid closest to the specified scale.
84  // The scale factor is with respect to the base image (base scale = 1.0).
85  // This method needs no specialisation.
86  virtual vil_image_view_base_sptr get_copy_view(const float scale, float& actual_scale) const
87  { return get_copy_view(0, ni(), 0, nj(), scale, actual_scale); }
88 
89  //: Copy a resource into the pyramid, level is determined by resource scale
90  virtual bool put_resource(vil_image_resource_sptr const& resc)
91  {return false;}
92 
93  //: Get an image resource from the pyramid at the specified level
94  virtual vil_image_resource_sptr get_resource(const unsigned level) const;
95 
96  //: for debug purposes
97  virtual void print(const unsigned level);
98 
99  protected:
103 };
104 
105 
106 #endif // vil_j2k_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.
virtual unsigned nj() const
The number of pixels in each column.
virtual vil_image_view_base_sptr get_copy_view(unsigned level) const
Get a complete view from a specified pyramid level.
virtual unsigned ni() const
The number of pixels in each row.
Class capable of reading JPEG2000 Part I files and ECW (ER Mapper's proprietary format) image files.
Definition: vil_j2k_image.h:63
virtual vil_image_view_base_sptr get_copy_view(const float scale, float &actual_scale) const
Get a complete view from the image in the pyramid closest to the specified scale.
vil_j2k: Written by Rob Radtke (rob@) and Harry Voorhees (hlv@) of Stellar Science Ltd.
Representation of a pyramid resolution hierarchy; mostly pure virtual methods.
virtual char const * file_format() const
Return a string describing the file format.
virtual unsigned nlevels() const
Number of pyramid levels.
Representation of a pyramid resolution hierarchy.
virtual bool put_view(vil_image_view_base const &, unsigned, unsigned)
Put the data in this view back into the base image.
virtual vil_image_resource_sptr get_resource(const unsigned level) const
Get an image resource from the pyramid at the specified level.
vil_image_view_base_sptr get_copy_view() const
Create a read/write view of a copy of all the data.
virtual unsigned nplanes() const
The number of planes (or components) in the image.
virtual bool put_resource(vil_image_resource_sptr const &resc)
Copy a resource into the pyramid, level is determined by resource scale.
virtual enum vil_pixel_format pixel_format() const
Pixel Format.
virtual void print(const unsigned level)
for debug purposes.