2 #ifndef vil_image_view_h_ 3 #define vil_image_view_h_ 17 # include <vcl_msvc_warnings.h> 70 vil_image_view(
unsigned ni,
unsigned nj,
unsigned n_planes=1,
unsigned n_interleaved_planes=1);
76 std::ptrdiff_t i_step, std::ptrdiff_t j_step, std::ptrdiff_t plane_step);
83 const T* top_left,
unsigned ni,
unsigned nj,
unsigned nplanes,
84 std::ptrdiff_t i_step, std::ptrdiff_t j_step, std::ptrdiff_t plane_step);
156 operator bool()
const 157 {
return (
top_left_ !=
nullptr)? true :
false; }
161 {
return (
top_left_ !=
nullptr)? false :
true; }
184 {
return (i>-1) && (i<(int)
ni_) && (j>-1) && (j<(
int)
nj_); }
188 {
return (i>-1) && (i<(int)
ni_) && (j>-1) && (j<(
int)
nj_)
193 assert(i<
ni_); assert(j<
nj_);
198 assert(i<
ni_); assert(j<
nj_);
202 inline const T&
operator()(
unsigned i,
unsigned j,
unsigned p)
const {
235 std::ptrdiff_t i_step, std::ptrdiff_t j_step, std::ptrdiff_t plane_step);
241 void print(std::ostream&)
const override;
244 std::string
is_a()
const override;
247 bool is_class(std::string
const& s)
const override;
314 im.
print(s);
return s;
325 #endif // vil_image_view_h_ unsigned ni_
Number of columns.
An abstract base class of smart pointers to actual image data in memory.
unsigned size_bytes() const
The number of bytes in the data.
bool operator>=(const vil_image_view_base &rhs) const
Provides an ordering.
std::ptrdiff_t istep_
Add this to a pixel pointer to move one column left.
const T & operator()(unsigned i, unsigned j) const
Return read-only reference to pixel at (i,j) in plane 0.
T & operator()(unsigned i, unsigned j)
Return read/write reference to pixel at (i,j) in plane 0.
A base class reference-counting view of some image data.
Concrete view of image data of type T held in memory.
void fill(T value)
Fill view with given value.
std::ostream & operator<<(std::ostream &s, vil_image_view< T > const &im)
Print a 1-line summary of contents.
const vil_image_view< T > & operator=(const vil_image_view_base_sptr &rhs)
Copy a view. The rhs and lhs will point to the same image data.
bool is_contiguous() const
True if data all in one unbroken block and top_left_ptr() is lowest data address.
bool operator<=(const vil_image_view_base &rhs) const
Provides an ordering.
void set_size(unsigned ni, unsigned nj) override
resize current planes to ni x nj.
bool in_range(int i, int j, int p) const
Return true if (i,j,p) is a valid index into this buffer.
std::ptrdiff_t planestep_
Add this to a pixel pointer to move one plane back.
std::ptrdiff_t jstep() const
Add this to your pixel pointer to get next j pixel.
bool vil_image_view_deep_equality(const vil_image_view< T > &lhs, const vil_image_view< T > &rhs)
True if the actual images are identical.
bool in_range(int i, int j) const
Return true if (i,j) is a valid index into this buffer.
bool operator<(const vil_image_view_base &rhs) const
Provides an ordering.
vil_memory_chunk_sptr ptr_
Reference to actual image data.
unsigned ni() const
Width.
bool operator!=(const vil_image_view_base &rhs) const
True if they do not share same view of same image data.
unsigned nj() const
Height.
std::ptrdiff_t planestep() const
Add this to your pixel pointer to get pixel on next plane.
const T & operator()(unsigned i, unsigned j, unsigned p) const
Return read-only reference to pixel at (i,j) in plane p.
bool operator!() const
Return false if pointing at some data.
bool operator>(const vil_image_view_base &rhs) const
Provides an ordering.
void deep_copy(const vil_image_view< T > &src)
Make a copy of the data in src and set this to view it.
void print(std::ostream &) const override
Print a 1-line summary of contents.
const_iterator end() const
~vil_image_view() override=default
unsigned nplanes_
Number of planes.
vil_memory_chunk_sptr & memory_chunk()
Smart pointer to the object holding the data for this view.
unsigned long size() const
The number of pixels.
std::string is_a() const override
Return class name.
T pixel_type
The pixel type of this image.
std::ptrdiff_t jstep_
Add this to a pixel pointer to move one row down.
T * top_left_ptr()
Pointer to the first (top left in plane 0) pixel.
unsigned nplanes() const
Number of planes.
vil_pixel_format pixel_format() const override
Return a description of the concrete data pixel type.
void set_to_memory(const T *top_left, unsigned ni, unsigned nj, unsigned nplanes, std::ptrdiff_t i_step, std::ptrdiff_t j_step, std::ptrdiff_t plane_step)
Set this view to look at someone else's memory data.
const vil_memory_chunk_sptr & memory_chunk() const
Smart pointer to the object holding the data for this view.
unsigned nj_
Number of rasters.
vil_image_view()
Dflt ctor.
bool is_class(std::string const &s) const override
True if this is (or is derived from) class s.
T * top_left_
Pointer to pixel at origin.
const vil_image_view< T > & operator=(const vil_image_view< T > &rhs)
Copy a view. The rhs and lhs will point to the same image data.
const T * top_left_ptr() const
Pointer to the first (top left in plane 0) pixel.
bool operator==(const vil_image_view_base &other) const
True if they share same view of same image data.
std::ptrdiff_t istep() const
Add this to your pixel pointer to get next i pixel.
const_iterator begin() const
void release_memory()
Disconnect this view from the underlying data,.
T & operator()(unsigned i, unsigned j, unsigned p)
Return read-only reference to pixel at (i,j) in plane p.