15 # include <vcl_msvc_warnings.h> 17 #include <vxl_config.h> 35 assert( ( (n_planes==1?0:1) + (n_interleaved_planes==1?0:1) +
43 #define macro( F , T ) \ 44 case F : view_ = new vil_image_view<T >(n_i, n_j, n_planes, n_interleaved_planes); \ 49 macro(VIL_PIXEL_FORMAT_UINT_64, vxl_uint_64)
50 macro(VIL_PIXEL_FORMAT_INT_64 , vxl_int_64)
63 std::cerr <<
"ERROR: vil_memory_image::vil_memory_image\n" 64 "\t unknown format " << format << std::endl;
75 #define macro( F , T ) \ 76 case F : view_ = new vil_image_view<T >(view); break; 80 macro(VIL_PIXEL_FORMAT_UINT_64, vxl_uint_64 )
81 macro(VIL_PIXEL_FORMAT_INT_64 , vxl_int_64 )
94 std::cerr <<
"ERROR: vil_memory_image::vil_memory_image\n\tunknown format " 106 unsigned j0,
unsigned n_j)
const 108 if (i0 + n_i >
view_->
ni() || j0 + n_j >
view_->
nj())
return nullptr;
112 #define macro( F , T ) \ 114 const vil_image_view< T > &v = static_cast<const vil_image_view< T > &>(*view_); \ 115 vil_image_view< T > w(v.memory_chunk(), &v(i0,j0), \ 116 n_i, n_j, v.nplanes(), \ 117 v.istep(), v.jstep(), v.planestep()); \ 118 return new vil_image_view< T >(vil_copy_deep(w)); } 122 macro(VIL_PIXEL_FORMAT_UINT_64 , vxl_uint_64 )
123 macro(VIL_PIXEL_FORMAT_INT_64 , vxl_int_64 )
143 unsigned j0,
unsigned n_j)
const 145 if (i0 + n_i >
view_->
ni() || j0 + n_j >
view_->
nj())
return nullptr;
149 #define macro( F , T ) \ 151 const vil_image_view< T > &v = static_cast<const vil_image_view< T > &>(*view_); \ 152 return new vil_image_view< T >(v.memory_chunk(), &v(i0,j0), \ 153 n_i, n_j, v.nplanes(), \ 154 v.istep(), v.jstep(), v.planestep()); } 158 macro(VIL_PIXEL_FORMAT_UINT_64 , vxl_uint_64 )
159 macro(VIL_PIXEL_FORMAT_INT_64 , vxl_int_64 )
182 if (!
view_fits(im, i0, j0))
return false;
186 #define macro( F , T ) \ 188 vil_image_view< T > &v = static_cast<vil_image_view< T > &>(*view_); \ 189 const vil_image_view< T > &w = static_cast<const vil_image_view< T > &>(im); \ 190 if (v.memory_chunk() == w.memory_chunk()) \ 192 if (&v(i0,j0) != w.top_left_ptr()) { \ 193 std::cerr << "ERROR: vil_memory_image::put_view()\n" \ 194 << "different window from that used in get_view()\n"; \ 198 vil_copy_to_window(w, v, i0, j0); \ 204 macro(VIL_PIXEL_FORMAT_UINT_64 , vxl_uint_64 )
205 macro(VIL_PIXEL_FORMAT_INT_64 , vxl_int_64 )
218 std::cerr <<
"WARNING: vil_memory_image::put_view()\n" An abstract base class of smart pointers to actual image data in memory.
virtual bool view_fits(const vil_image_view_base &im, unsigned i0, unsigned j0)
Check that a view will fit into the data at the given offset.
Concrete view of image data of type T held in memory.
vil_image_view_base * view_
Management of the memory image is devolved to an internal image_view.
unsigned ni() const
Width.
unsigned nj() const
Height.
virtual enum vil_pixel_format pixel_format() const =0
Return a description of the concrete data pixel type.
Various image copying functions.
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.
enum vil_pixel_format pixel_format() const override
Pixel Format.
vil_image_view_base_sptr get_view() const
Create a read/write view of all the data.
vil_memory_image()
Create an empty memory image.