11 # include <vcl_msvc_warnings.h> 72 prototype->pixel_format());
78 unsigned ni,
unsigned nj,
81 char const* file_format)
90 if (std::strcmp(fmt->tag(), file_format) == 0) {
91 outimage = fmt->make_output_image(os, ni, nj, nplanes, format);
93 std::cerr <<
"vil_new: Cannot new to type [" << file_format <<
"]\n";
98 std::cerr <<
"vil_new: Unknown file type [" << file_format <<
"]\n";
105 unsigned ni,
unsigned nj,
107 char const* file_format)
109 #ifdef VIL_USE_FSTREAM64 110 vil_stream_fstream64* os =
new vil_stream_fstream64(filename,
"w");
111 #else //VIL_USE_FSTREAM64 113 #endif //VIL_USE_FSTREAM64 116 prototype->nplanes(),
117 prototype->pixel_format(),
118 file_format ? file_format : prototype->file_format());
124 unsigned ni,
unsigned nj,
127 char const* file_format)
129 #ifdef VIL_USE_FSTREAM64 130 vil_stream_fstream64* os =
new vil_stream_fstream64(filename,
"w");
131 #else //VIL_USE_FSTREAM64 133 #endif //VIL_USE_FSTREAM64 135 if (!file_format || !*file_format)
144 unsigned ni,
unsigned nj,
146 char const* file_format)
149 prototype->nplanes(),
151 prototype->pixel_format(),
152 file_format ? file_format : prototype->file_format());
158 unsigned size_block_i,
unsigned size_block_j,
159 char const* file_format)
168 if (std::strcmp(fmt->tag(), file_format) == 0) {
169 outimage = fmt->make_blocked_output_image(os, ni, nj, nplanes,
170 size_block_i, size_block_j, format);
172 std::cerr <<
"vil_new: Cannot new a blocked resource to type [" << file_format <<
"]\n";
177 std::cerr <<
"vil_new: Unknown file type [" << file_format <<
"]\n";
184 unsigned size_block_i,
unsigned size_block_j,
185 char const* file_format)
187 #ifdef VIL_USE_FSTREAM64 188 vil_stream_fstream64* os =
new vil_stream_fstream64(filename,
"w");
189 #else //VIL_USE_FSTREAM64 191 #endif //VIL_USE_FSTREAM64 193 size_block_i, size_block_j,
199 unsigned size_block_i,
unsigned size_block_j)
207 const unsigned cache_size)
214 char const* file_format)
217 file_format =
"tiff";
222 if (std::strcmp(fmt->tag(), file_format) == 0) {
223 outimage = fmt->make_pyramid_output_image(file_or_directory);
225 std::cerr <<
"vil_new: Cannot new a pyramid resource to type [" << file_format <<
"]\n";
229 std::cerr <<
"vil_new: Unknown file type [" << file_format <<
"]\n";
237 char const* file_format,
238 char const* temp_dir)
241 file_format =
"tiff";
246 if (std::strcmp(fmt->tag(), file_format) == 0) {
247 outimage = fmt->make_pyramid_image_from_base(filename,
252 std::cerr <<
"vil_new: Cannot new a pyramid resource to type [" << file_format <<
"]\n";
256 std::cerr <<
"vil_new: Unknown file type [" << file_format <<
"]\n";
266 char const* level_file_format,
267 char const* filename)
271 copy_base, level_file_format,
283 #ifndef DOXYGEN_SHOULD_SKIP_THIS 284 #define macro( F , T ) \ 286 dest = new vil_image_view<T>(src); \ 291 macro(VIL_PIXEL_FORMAT_UINT_64 , vxl_uint_64 )
292 macro(VIL_PIXEL_FORMAT_INT_64 , vxl_int_64 )
302 #endif // DOXYGEN_SHOULD_SKIP_THIS 308 #if defined(_WIN32) && VXL_USE_WIN_WCHAR_T 314 unsigned ni,
unsigned nj,
317 wchar_t const* file_format)
320 file_format = L
"pnm";
322 constexpr
unsigned int size = 200;
323 char fmt_buffer[size];
326 const int ret = WideCharToMultiByte(CP_ACP, 0, file_format,
int(wcslen(file_format)), fmt_buffer, size, 0, &useless );
327 fmt_buffer[ret] =
'\0';
336 unsigned ni,
unsigned nj,
338 wchar_t const* file_format)
340 #ifdef VIL_USE_FSTREAM64 341 vil_stream_fstream64* os =
new vil_stream_fstream64(filename,
"w");
342 #else //VIL_USE_FSTREAM64 344 #endif //VIL_USE_FSTREAM64 346 constexpr
unsigned int size = 200;
347 wchar_t tag_buffer[size];
350 char const* tag = prototype->file_format();
351 const int ret = MultiByteToWideChar(CP_ACP, 0, tag, std::strlen(tag), tag_buffer, size);
353 file_format = tag_buffer;
358 prototype->nplanes(),
359 prototype->pixel_format(),
366 unsigned ni,
unsigned nj,
369 wchar_t const* file_format)
371 #ifdef VIL_USE_FSTREAM64 372 vil_stream_fstream64* os =
new vil_stream_fstream64(filename,
"w");
373 #else //VIL_USE_FSTREAM64 375 #endif //VIL_USE_FSTREAM64 377 if (!file_format || !*file_format)
382 #endif //defined(_WIN32) && VXL_USE_WIN_WCHAR_T An abstract base class of smart pointers to actual image data in memory.
vil_image_resource_sptr vil_new_image_resource(unsigned ni, unsigned nj, unsigned nplanes, vil_pixel_format format)
Make a new image of given format.
vil_pyramid_image_resource_sptr vil_new_pyramid_image_list_from_base(char const *directory, vil_image_resource_sptr const &base_image, unsigned nlevels, bool copy_base, char const *level_file_format, char const *filename)
Construct a new pyramid image resource from a base image.
A vil_stream implementation using std::fstream.
vil_image_resource_sptr vil_new_image_resource_interleaved(unsigned ni, unsigned nj, unsigned nplanes, vil_pixel_format format)
Make a new image of given format with interleaved planes.
vil_blocked_image_resource_sptr vil_new_cached_image_resource(const vil_blocked_image_resource_sptr &bir, const unsigned cache_size)
Make a new cached resource.
A cached and blocked representation of the image_resource.
vil_blocked_image_resource_sptr vil_new_blocked_image_resource(vil_stream *os, unsigned ni, unsigned nj, unsigned nplanes, vil_pixel_format format, unsigned size_block_i, unsigned size_block_j, char const *file_format)
Make a new blocked resource file.
vil_blocked_image_resource_sptr vil_new_blocked_image_facade(const vil_image_resource_sptr &src, unsigned size_block_i, unsigned size_block_j)
create a blocked interface around any image resource.
char const * vil_save_guess_file_format(char const *filename)
Given a filename, guess the file format tag.
Stream interface for VIL image loaders.
A vil_stream implementation using std::fstream.
virtual enum vil_pixel_format pixel_format() const =0
Return a description of the concrete data pixel type.
Generic image implementation for PNM files.
A blocked image facade for any image resource.
Representation of a pyramid resolution hierarchy.
vil_pyramid_image_resource_sptr vil_new_pyramid_image_resource(char const *file_or_directory, char const *file_format)
Make a new pyramid image resource for writing.
vil_image_resource_sptr vil_new_image_resource_of_view(vil_image_view_base const &view)
Make a new image resource that is a wrapper on an existing view's data.
vil_image_view_base_sptr vil_new_image_view_base_sptr(const vil_image_view_base &)
Create a shallow copy of an image and wrap it in a vil_image_view_base_sptr.
Representation of a generic image source or destination.
vil_pyramid_image_resource_sptr vil_new_pyramid_image_from_base(char const *filename, vil_image_resource_sptr const &base_image, unsigned nlevels, char const *file_format, char const *temp_dir)
Construct a pyramid image resource from a base image.
A pyramid image resource based on multiple file-based image resources.