12 #include <vsl/vsl_block_binary.h> 13 #include <vsl/vsl_complex_io.h> 15 #define write_case_macro(T)\ 16 vsl_b_write(os,unsigned(chunk.size()/sizeof(T ))); \ 17 vsl_block_binary_write(os,(const T*) chunk.const_data(),chunk.size()/sizeof(T)) 23 constexpr
short io_version_no = 3;
30 case VIL_PIXEL_FORMAT_UINT_64:
33 case VIL_PIXEL_FORMAT_INT_64:
71 std::cerr <<
"I/O ERROR: vsl_b_write(vsl_b_istream&, vil_memory_chunk&)\n" 72 <<
" Unknown component type\n";
77 #undef write_case_macro 82 #define read_case_macro_v1(T)\ 83 chunk.set_size(n*sizeof(T ),pixel_format); \ 84 for (unsigned i=0; i<n; ++i)\ 85 vsl_b_read(is, static_cast<T *>(chunk.data())[i]); 87 #define read_case_macro_v2(T)\ 88 chunk.set_size(n*sizeof(T ),pixel_format); \ 89 vsl_block_binary_read_confirm_specialisation(is, false); \ 90 for (unsigned i=0; i<n; ++i)\ 91 vsl_b_read(is, static_cast<T *>(chunk.data())[i]); 93 #define read_case_macro_v3(T)\ 94 chunk.set_size(n*sizeof(T ),pixel_format); \ 95 vsl_block_binary_read(is,static_cast<T *>(chunk.data()),n) 113 switch (pixel_format)
116 case VIL_PIXEL_FORMAT_UINT_64:
119 case VIL_PIXEL_FORMAT_INT_64:
152 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, vil_memory_chunk&)\n" 153 <<
" Unknown pixel format "<< format <<
'\n';
154 is.is().clear(std::ios::badbit);
162 switch (pixel_format)
165 case VIL_PIXEL_FORMAT_UINT_64:
168 case VIL_PIXEL_FORMAT_INT_64:
206 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, vil_memory_chunk&)\n" 207 <<
" Unknown pixel format "<< format <<
'\n';
208 is.is().clear(std::ios::badbit);
216 switch (pixel_format)
219 case VIL_PIXEL_FORMAT_UINT_64:
222 case VIL_PIXEL_FORMAT_INT_64:
260 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, vil_memory_chunk&)\n" 261 <<
" Unknown pixel format "<< format <<
'\n';
262 is.is().clear(std::ios::badbit);
268 std::cerr <<
"I/O ERROR: vsl_b_read(vsl_b_istream&, vil_memory_chunk&)\n" 269 <<
" Unknown version number "<< w <<
'\n';
270 is.is().clear(std::ios::badbit);
275 #undef read_case_macro 280 bool not_null_ptr = (chunk_ptr!=
nullptr);
304 os<<
"vil_memory_chunk containing "<<chunk.
size()<<
" bytes of "<<chunk.
pixel_format();
#define read_case_macro_v2(T)
std::size_t size() const
Number of bytes allocated.
#define read_case_macro_v1(T)
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.
#define read_case_macro_v3(T)
#define write_case_macro(T)
void vsl_b_write(vsl_b_ostream &os, const vil_image_view< T > &image)
Binary save vil_image_view<T> to stream.
Ref. counted block of data on the heap.
vil_pixel_format pixel_format() const
Indicate what format data is to be saved as in binary IO.
void vsl_b_read(vsl_b_istream &is, vil_image_view< T > &image)
Binary load vil_image_view<T> from stream.