2 #ifndef vil_io_image_view_h_ 3 #define vil_io_image_view_h_ 11 # include <vcl_msvc_warnings.h> 21 constexpr
short io_version_no = 1;
34 reinterpret_cast<const T*>(image.
memory_chunk()->data()));
48 std::ptrdiff_t istep,jstep,pstep;
50 std::ptrdiff_t offset;
70 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, vil_image_view<T>&)\n" 71 <<
" Mismatched pixel format.\n";
72 is.is().clear(std::ios::badbit);
76 const T* data = reinterpret_cast<const T*>(chunk->data());
78 if (chunk->size() < np*ni*nj*
sizeof(T) ||
79 offset < 0 || offset*
sizeof(T) >= chunk->size())
81 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, vil_image_view<T>&)\n" 82 <<
" Image details not compatible with chunk data.\n";
83 is.is().clear(std::ios::badbit);
88 ni,nj,np,istep,jstep,pstep);
93 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, vil_image_view<T>&)\n" 94 <<
" Unknown version number "<< w <<
'\n';
95 is.is().clear(std::ios::badbit);
125 #endif // vil_io_image_view_h_
Concrete view of image data of type T held in memory.
void set_size(unsigned ni, unsigned nj) override
resize current planes to ni x nj.
std::ptrdiff_t jstep() const
Add this to your pixel pointer to get next j pixel.
unsigned ni() const
Width.
void vsl_print_summary(std::ostream &os, const vil_image_view< T > &image)
Print human readable summary of a vil_image_view<T> object to a stream.
unsigned nj() const
Height.
std::ptrdiff_t planestep() const
Add this to your pixel pointer to get pixel on next plane.
void print(std::ostream &) const override
Print a 1-line summary of contents.
void vsl_b_write(vsl_b_ostream &os, const vil_image_view< T > &image)
Binary save vil_image_view<T> to stream.
A base class reference-counting view of some image data.
unsigned long size() const
The number of pixels.
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.
const vil_memory_chunk_sptr & memory_chunk() const
Smart pointer to the object holding the data for this view.
void vsl_b_read(vsl_b_istream &is, vil_image_view< T > &image)
Binary load vil_image_view<T> from stream.
std::ptrdiff_t istep() const
Add this to your pixel pointer to get next i pixel.