vil_blocked_image_facade.h
Go to the documentation of this file.
1 // This is core/vil/vil_blocked_image_facade.h
2 #ifndef vil_blocked_image_facade_h_
3 #define vil_blocked_image_facade_h_
4 //:
5 // \file
6 // \brief A blocked image facade for any image resource
7 // \author J. L. Mundy
8 //
9 // this class "wraps" any image resource and provides blocking methods
10 //
11 // not used? #include <vcl_compiler.h>
12 #include <vector>
14 
16 {
17  public:
19  const unsigned sbi=0, const unsigned sbj=0);
20  ~vil_blocked_image_facade() override = default;
21 
22  inline unsigned nplanes() const override
23  { return src_->nplanes();}
24  inline unsigned ni() const override
25  { return src_->ni();}
26  inline unsigned nj() const override
27  { return src_->nj();}
28  //: Block size in columns
29  inline unsigned size_block_i() const override
30  { return sbi_;}
31  //: Block size in rows
32  inline unsigned size_block_j() const override
33  { return sbj_;}
34  //: Number of blocks in image width
35  inline unsigned n_block_i() const override
36  { if (sbi_>0)return (src_->ni()+sbi_-1)/sbi_; return 0; }
37  //: Number of blocks in image height
38  inline unsigned n_block_j() const override
39  { if (sbj_>0)return (src_->nj()+sbj_-1)/sbj_; return 0; }
40 
41  inline enum vil_pixel_format pixel_format() const override
42  { return src_->pixel_format();}
43 
45  get_copy_view(unsigned i0, unsigned n_i, unsigned j0, unsigned n_j) const override
46  { return src_->get_copy_view(i0, n_i, j0, n_j);}
47 
48  inline bool put_view(const vil_image_view_base& im,
49  unsigned i0, unsigned j0) override
50  { return src_->put_view(im, i0, j0);}
51 
52  //: Block access
53  vil_image_view_base_sptr get_block( unsigned block_index_i,
54  unsigned block_index_j ) const override;
55 
56  //: put the block into the resource at the indicated location
57  bool put_block(unsigned block_index_i,
58  unsigned block_index_j,
59  const vil_image_view_base& view) override;
60 
61 
62  //: Extra property information
63  bool get_property(char const* tag, void* property_value = nullptr) const override;
64 
65  protected:
66  //Internal functions
68 
69  //:the image resource masquerading as a blocked resource
71  //:block size in i
72  unsigned sbi_;
73  //:block size in j
74  unsigned sbj_;
75  vil_blocked_image_facade();//not meaningful
76 };
77 
78 #endif // vil_blocked_image_facade_h_
An abstract base class of smart pointers to actual image data in memory.
vil_pixel_format
Describes the type of the concrete data.
unsigned n_block_i() const override
Number of blocks in image width.
vil_image_view_base_sptr get_block(unsigned block_index_i, unsigned block_index_j) const override
Block access.
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.
unsigned ni() const override
Dimensions: Planes x ni x nj.
bool get_property(char const *tag, void *property_value=nullptr) const override
Extra property information.
vil_image_resource_sptr src_
the image resource masquerading as a blocked resource.
bool put_block(unsigned block_index_i, unsigned block_index_j, const vil_image_view_base &view) override
put the block into the resource at the indicated location.
unsigned size_block_i() const override
Block size in columns.
~vil_blocked_image_facade() override=default
A blocked representation of the image_resource.
vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned n_i, unsigned j0, unsigned n_j) const override
Create a read/write view of a copy of this data.
unsigned size_block_j() const override
Block size in rows.
vil_image_view_base_sptr fill_block(vil_image_view_base_sptr &view) const
enum vil_pixel_format pixel_format() const override
Pixel Format.
unsigned nplanes() const override
Dimensions: Planes x ni x nj.
unsigned sbj_
block size in j.
unsigned sbi_
block size in i.
unsigned n_block_j() const override
Number of blocks in image height.
unsigned nj() const override
Dimensions: Planes x ni x nj.