vil_cached_image_resource.h
Go to the documentation of this file.
1 // This is core/vil/vil_cached_image_resource.h
2 #ifndef vil_cached_image_resource_h_
3 #define vil_cached_image_resource_h_
4 //:
5 // \file
6 // \brief A cached and blocked representation of the image_resource
7 // \author J. L. Mundy
8 
10 #include <vil/vil_block_cache.h>
11 
13 {
14  public:
15 
17  const unsigned cache_size):
18  bir_(bir), cache_(vil_block_cache(cache_size)){}
19 
20  ~vil_cached_image_resource() override = default;
21 
22  inline unsigned nplanes() const override
23  {return bir_->nplanes();}
24  inline unsigned ni() const override
25  {return bir_->ni();}
26  inline unsigned nj() const override
27  {return bir_->nj();}
28  //: Block size in columns
29  inline unsigned size_block_i() const override
30  {return bir_->size_block_i();}
31  //: Block size in rows
32  inline unsigned size_block_j() const override
33  {return bir_->size_block_j();}
34  //: Number of blocks in image width
35  inline unsigned n_block_i() const override
36  {return bir_->n_block_i();}
37  //: Number of blocks in image height
38  inline unsigned n_block_j() const override
39  {return bir_->n_block_j();}
40 
41  inline enum vil_pixel_format pixel_format() const override
42  {return bir_->pixel_format();}
43 
44  inline bool put_view(const vil_image_view_base& im, unsigned i0, unsigned j0) override {return bir_->put_view(im, i0, j0);}
45 
46  //: Block access
47  vil_image_view_base_sptr get_block( unsigned block_index_i,
48  unsigned block_index_j ) const override;
49 
50  //: put the block into the resource at the indicated location
51  bool put_block(unsigned block_index_i,
52  unsigned block_index_j,
53  const vil_image_view_base& view) override
54  {return bir_->put_block(block_index_i, block_index_j, view);}
55 
56 
57  //: Extra property information
58  inline bool get_property(char const* tag, void* property_value = nullptr) const override
59  {return bir_->get_property(tag, property_value);}
60 
61  protected:
64 };
65 
66 #endif // vil_cached_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.
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 size_block_j() const override
Block size in rows.
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 nplanes() const override
Dimensions: Planes x ni x nj.
A block cache with block population prioritized by age.
unsigned size_block_i() const override
Block size in columns.
A blocked representation of the image_resource.
vil_cached_image_resource(vil_blocked_image_resource_sptr bir, const unsigned cache_size)
unsigned n_block_i() const override
Number of blocks in image width.
vil_blocked_image_resource_sptr bir_
unsigned n_block_j() const override
Number of blocks in image height.
vil_image_view_base_sptr get_block(unsigned block_index_i, unsigned block_index_j) const override
Block access.
unsigned nj() const override
Dimensions: Planes x ni x nj.
enum vil_pixel_format pixel_format() const override
Pixel Format.
~vil_cached_image_resource() override=default
bool get_property(char const *tag, void *property_value=nullptr) const override
Extra property information.
unsigned ni() const override
Dimensions: Planes x ni x nj.