Functions
core/vil/vil_new.cxx File Reference
#include "vil_new.h"
#include <vcl_cstring.h>
#include <vcl_cassert.h>
#include <vil/vil_save.h>
#include <vil/vil_file_format.h>
#include <vil/vil_stream_fstream.h>
#include <vil/vil_image_resource.h>
#include <vil/vil_memory_image.h>
#include <vil/vil_blocked_image_facade.h>
#include <vil/vil_cached_image_resource.h>
#include <vil/vil_pyramid_image_resource.h>
#include <vil/file_formats/vil_pyramid_image_list.h>

Go to the source code of this file.

Functions

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_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_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_resource_sptr vil_new_image_resource (unsigned ni, unsigned nj, vil_image_resource_sptr const &prototype)
 Make a new image, similar format to the prototype.
vil_image_resource_sptr vil_new_image_resource (vil_stream *os, unsigned ni, unsigned nj, unsigned nplanes, vil_pixel_format format, char const *file_format)
 Make a new image.
vil_image_resource_sptr vil_new_image_resource (char const *filename, unsigned ni, unsigned nj, vil_image_resource_sptr const &prototype, char const *file_format)
 Make a new vil_image_resource, writing to file "filename", size ni x nj, copying pixel format etc from "prototype".
vil_image_resource_sptr vil_new_image_resource (char const *filename, unsigned ni, unsigned nj, unsigned nplanes, vil_pixel_format format, char const *file_format)
 Make a new image.
vil_image_resource_sptr vil_new_image_resource (vil_stream *os, unsigned ni, unsigned nj, vil_image_resource_sptr const &prototype, char const *file_format)
 Make a new vil_image_resource, writing to stream "os", size ni x nj, copying pixel format etc from "prototype".
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_resource (char const *filename, 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.
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.
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_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.
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.
vil_image_view_base_sptr vil_new_image_view_base_sptr (const vil_image_view_base &src)
 Create a shallow copy of an image and wrap it in a vil_image_view_base_sptr.

Detailed Description

Author:
Andrew W. Fitzgibbon, Oxford RRG
Date:
16 Feb 00

Definition in file vil_new.cxx.


Function Documentation

vil_blocked_image_resource_sptr vil_new_blocked_image_facade ( const vil_image_resource_sptr src,
const unsigned  size_block_i = 0,
const unsigned  size_block_j = 0 
)

create a blocked interface around any image resource.

For zero size blocks, appropriate default blocking is created

Definition at line 198 of file vil_new.cxx.

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.

Definition at line 156 of file vil_new.cxx.

vil_blocked_image_resource_sptr vil_new_blocked_image_resource ( char const *  filename,
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.

Definition at line 182 of file vil_new.cxx.

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.

Definition at line 206 of file vil_new.cxx.

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.

If the format is not scalar, the number of planes must be 1. When you create a multi-component image in this way, the vil_image_resource API will treat it as a scalar pixel image with multiple planes. (This doesn't affect the underlying data storage.)

Definition at line 32 of file vil_new.cxx.

vil_image_resource_sptr vil_new_image_resource ( unsigned  ni,
unsigned  nj,
vil_image_resource_sptr const &  prototype 
)

Make a new image, similar format to the prototype.

Definition at line 69 of file vil_new.cxx.

vil_image_resource_sptr vil_new_image_resource ( vil_stream os,
unsigned  ni,
unsigned  nj,
unsigned  nplanes,
vil_pixel_format  format,
char const *  file_format 
)

Make a new image.

Definition at line 77 of file vil_new.cxx.

vil_image_resource_sptr vil_new_image_resource ( char const *  filename,
unsigned  ni,
unsigned  nj,
vil_image_resource_sptr const &  prototype,
char const *  file_format 
)

Make a new vil_image_resource, writing to file "filename", size ni x nj, copying pixel format etc from "prototype".

Definition at line 104 of file vil_new.cxx.

vil_image_resource_sptr vil_new_image_resource ( char const *  filename,
unsigned  ni,
unsigned  nj,
unsigned  nplanes,
vil_pixel_format  format,
char const *  file_format 
)

Make a new image.

Definition at line 123 of file vil_new.cxx.

vil_image_resource_sptr vil_new_image_resource ( vil_stream os,
unsigned  ni,
unsigned  nj,
vil_image_resource_sptr const &  prototype,
char const *  file_format 
)

Make a new vil_image_resource, writing to stream "os", size ni x nj, copying pixel format etc from "prototype".

Definition at line 143 of file vil_new.cxx.

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.

The format must be scalar.

Definition at line 44 of file vil_new.cxx.

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.

Note:
The output will be a shallow copy of the input, so changing the pixel values of one may change the pixel value of the other. Thanks to the magic of smart pointers, the output will remain valid even if you destroy the input. When you wrap a multi-component image in this way, the vil_image_resource API will treat it as a scalar pixel image with multiple planes. (This doesn't affect the underlying data storage.)

Definition at line 62 of file vil_new.cxx.

vil_image_view_base_sptr vil_new_image_view_base_sptr ( const vil_image_view_base src)

Create a shallow copy of an image and wrap it in a vil_image_view_base_sptr.

Note:
vil_image_view_base_sptr almost certainly doesn't behave as you would expect, and this function should really only be used by experts.

Definition at line 278 of file vil_new.cxx.

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.

All levels are stored in the same resource file. Each level has the same scale ratio (0.5) to the preceding level. Level 0 is the original base image. The resource is returned open for reading. The temporary directory is for storing intermediate image resources during the construction of the pyramid. Files are be removed from the directory after completion. If temp_dir is 0 then the intermediate resources are created in memory.

Definition at line 234 of file vil_new.cxx.

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.

The result is a directory containing separate images for each pyramid level. Each level has the same scale ratio (0.5) to the preceding level and is created using level_file_format. Level 0 is the original base image. If copy_base is false, then Level 0 is already present in the directory and is used without modification. Each pyramid file in the directory is named filename + "level_index", e.g. R0, R1, ... Rn.

Definition at line 262 of file vil_new.cxx.

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.

Any number of pyramid layers can be inserted and with any scale. Image resources that duplicate existing scales are not inserted.

Definition at line 213 of file vil_new.cxx.