vil_transpose.h
Go to the documentation of this file.
1 // This is core/vil/vil_transpose.h
2 #ifndef vil_transpose_h_
3 #define vil_transpose_h_
4 //:
5 // \file
6 // \author Ian Scott.
7 
9 #include <vil/vil_image_view.h>
10 
11 
12 //: Create a view which appears as the transpose of this view.
13 // i.e. transpose(i,j,p) = view(j,i,p). O(1).
14 // \relatesalso vil_image_view
15 template<class T>
17 {
18  // Create view with i and j switched
19  return vil_image_view<T>(v.memory_chunk(),v.top_left_ptr(),
20  v.nj(),v.ni(),v.nplanes(),
21  v.jstep(),v.istep(),v.planestep());
22 }
23 
24 
25 //: Transpose an image.
26 // \relatesalso vil_image_resource
28 
29 
30 //: A generic_image adaptor that behaves like a transposed version of its input
32 {
33  //: Reference to underlying image source
35  //: You can't construct one of these directly, use vil_transpose() instead.
38 
39  public:
40  inline unsigned nplanes() const override { return src_->nplanes(); }
41  inline unsigned ni() const override { return src_->nj(); }
42  inline unsigned nj() const override { return src_->ni(); }
43 
44  inline enum vil_pixel_format pixel_format() const override { return src_->pixel_format(); }
45 
46  vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
47  unsigned j0, unsigned nj) const override;
48 
49  vil_image_view_base_sptr get_view(unsigned i0, unsigned ni,
50  unsigned j0, unsigned nj) const override;
51 
52  //: Put the data in this view back into the image source.
53  bool put_view(const vil_image_view_base& im, unsigned i0, unsigned j0) override;
54 
55  //: Extra property information
56  bool get_property(char const* tag, void* property_value = nullptr) const override {
57  return src_->get_property(tag, property_value); }
58 };
59 
60 #endif // vil_transpose_h_
An abstract base class of smart pointers to actual image data in memory.
vil_pixel_format
Describes the type of the concrete data.
friend vil_image_resource_sptr vil_transpose(const vil_image_resource_sptr &src)
Transpose an image.
vil_image_resource_sptr src_
Reference to underlying image source.
Definition: vil_transpose.h:34
A generic_image adaptor that behaves like a transposed version of its input.
Definition: vil_transpose.h:31
unsigned ni() const override
Dimensions: Planes x ni x nj.
Definition: vil_transpose.h:41
enum vil_pixel_format pixel_format() const override
Pixel Format.
Definition: vil_transpose.h:44
Concrete view of image data of type T held in memory.
Definition: vil_fwd.h:13
bool get_property(char const *tag, void *property_value=nullptr) const override
Extra property information.
Definition: vil_transpose.h:56
#define v
Abstract representation of an image source or image destination.
vil_transpose_image_resource(vil_image_resource_sptr const &)
You can't construct one of these directly, use vil_transpose() instead.
vil_image_view_base_sptr get_copy_view() const
Create a read/write view of a copy of all the data.
A base class reference-counting view of some image 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 nj() const override
Dimensions: Planes x ni x nj.
Definition: vil_transpose.h:42
Representation of a generic image source or destination.
unsigned nplanes() const override
Dimensions: Planes x ni x nj.
Definition: vil_transpose.h:40
vil_image_view_base_sptr get_view() const
Create a read/write view of all the data.
vil_image_view< T > vil_transpose(const vil_image_view< T > &v)
Create a view which appears as the transpose of this view.
Definition: vil_transpose.h:16