Abstract representation of an image source or image destination. More...
#include <vil3d_image_resource.h>
Public Member Functions | |
vil3d_image_resource () | |
virtual | ~vil3d_image_resource () |
virtual unsigned | nplanes () const =0 |
Dimensions: Planes x ni x nj. | |
virtual unsigned | ni () const =0 |
Dimensions: Planes x ni x nj x nk. | |
virtual unsigned | nj () const =0 |
Dimensions: Planes x ni x nj x nk. | |
virtual unsigned | nk () const =0 |
Dimensions: Planes x ni x nj x nk. | |
virtual enum vil_pixel_format | pixel_format () const =0 |
Pixel Format. | |
virtual vil3d_image_view_base_sptr | get_view (unsigned i0, unsigned ni, unsigned j0, unsigned nj, unsigned k0, unsigned nk) const |
Create a read/write view of the data. | |
vil3d_image_view_base_sptr | get_view () const |
Create a read/write view of all the data. | |
virtual bool | set_voxel_size (float, float, float) |
Set the size of the each voxel in the i,j,k directions. | |
virtual vil3d_image_view_base_sptr | get_copy_view (unsigned i0, unsigned ni, unsigned j0, unsigned nj, unsigned k0, unsigned nk) const =0 |
Create a read/write view of a copy of this data. | |
virtual bool | put_view (const vil3d_image_view_base &im, unsigned i0=0, unsigned j0=0, unsigned k0=0)=0 |
Put the data in this view back into the image source. | |
virtual bool | view_fits (const vil3d_image_view_base &im, unsigned i0, unsigned j0, unsigned k0) |
Check that a view will fit into the data at the given offset. | |
virtual char const * | file_format () const |
Return a string describing the file format. | |
virtual bool | get_property (char const *label, void *property_value=0) const =0 |
Extra property information. | |
Private Member Functions | |
void | ref () |
void | unref () |
Private Attributes | |
int | reference_count_ |
Friends | |
class | vil_smart_ptr< vil3d_image_resource > |
Related Functions | |
(Note that these are not member functions.) | |
bool | vil3d_copy_deep (const vil3d_image_resource_sptr &src, vil3d_image_resource_sptr &dest) |
Copy src to dest. | |
vil3d_image_resource_sptr | vil3d_crop (const vil3d_image_resource_sptr &src, unsigned i0, unsigned ni, unsigned j0, unsigned nj, unsigned k0, unsigned nk) |
Crop to a region of src. | |
vil3d_image_resource_sptr | vil3d_new_image_resource (unsigned ni, unsigned nj, unsigned nk, unsigned nplanes, vil_pixel_format format) |
Make a new image of given format. | |
vil3d_image_resource_sptr | vil3d_new_image_resource (const char *filename, unsigned ni, unsigned nj, unsigned nk, unsigned nplanes, vil_pixel_format format, char const *file_format=0) |
Make a new image on disk. | |
bool | vil3d_save_image_resource (const vil3d_image_resource_sptr &ir, char const *filename, char const *file_format) |
Send vil3d_image_resource to disk. | |
bool | vil3d_save_image_resource (const vil3d_image_resource_sptr &ir, char const *filename) |
Save vil3d_image_resource to file, deducing format from filename. |
Abstract representation of an image source or image destination.
Most references to vil3d_image_resource objects should usually be done through smart pointers - vil3d_image_resource_sptr;
All image data is presumed to be in planes, not components. This does not say whether the data is stored on disk or in memory as RGBRGBRGB.. or RRR..GGG..BBB.., just that the interface will always tell you that it has a multi-plane single-component view.
Definition at line 28 of file vil3d_image_resource.h.
vil3d_image_resource::vil3d_image_resource | ( | ) | [inline] |
Definition at line 31 of file vil3d_image_resource.h.
virtual vil3d_image_resource::~vil3d_image_resource | ( | ) | [inline, virtual] |
Definition at line 32 of file vil3d_image_resource.h.
virtual char const* vil3d_image_resource::file_format | ( | ) | const [inline, virtual] |
Return a string describing the file format.
Only file images have a format, others return 0
Reimplemented in vil3d_analyze_image, vil3d_meta_image, vil3d_gipl_image, vil3d_slice_list_image, and vil3d_dicom_image.
Definition at line 107 of file vil3d_image_resource.h.
virtual vil3d_image_view_base_sptr vil3d_image_resource::get_copy_view | ( | unsigned | i0, |
unsigned | ni, | ||
unsigned | j0, | ||
unsigned | nj, | ||
unsigned | k0, | ||
unsigned | nk | ||
) | const [pure virtual] |
Create a read/write view of a copy of this data.
This function will always return a multi-plane scalar-pixel view of the data.
Implemented in vil3d_analyze_image, vil3d_meta_image, vil3d_gipl_image, vil3d_slice_list_image, vil3d_crop_image_resource, and vil3d_memory_image.
virtual bool vil3d_image_resource::get_property | ( | char const * | label, |
void * | property_value = 0 |
||
) | const [pure virtual] |
Extra property information.
Implemented in vil3d_analyze_image, vil3d_meta_image, vil3d_gipl_image, vil3d_slice_list_image, vil3d_crop_image_resource, and vil3d_memory_image.
virtual vil3d_image_view_base_sptr vil3d_image_resource::get_view | ( | unsigned | i0, |
unsigned | ni, | ||
unsigned | j0, | ||
unsigned | nj, | ||
unsigned | k0, | ||
unsigned | nk | ||
) | const [inline, virtual] |
Create a read/write view of the data.
Modifying this view might modify the actual data. If you want to modify this data in place, call put_view after you done, and it should work efficiently. This function will always return a multi-plane scalar-pixel view of the data.
If you want to fill an existing view (e.g. a window onto some other image), then use
vil3d_reformat(data->get_view(..), window); *
Reimplemented in vil3d_crop_image_resource, and vil3d_memory_image.
Definition at line 63 of file vil3d_image_resource.h.
vil3d_image_view_base_sptr vil3d_image_resource::get_view | ( | ) | const [inline] |
Create a read/write view of all the data.
Definition at line 69 of file vil3d_image_resource.h.
virtual unsigned vil3d_image_resource::ni | ( | ) | const [pure virtual] |
Dimensions: Planes x ni x nj x nk.
The number of pixels in each row.
Implemented in vil3d_analyze_image, vil3d_meta_image, vil3d_gipl_image, vil3d_slice_list_image, vil3d_crop_image_resource, and vil3d_memory_image.
virtual unsigned vil3d_image_resource::nj | ( | ) | const [pure virtual] |
Dimensions: Planes x ni x nj x nk.
The number of pixels in each column.
Implemented in vil3d_analyze_image, vil3d_meta_image, vil3d_gipl_image, vil3d_slice_list_image, vil3d_crop_image_resource, and vil3d_memory_image.
virtual unsigned vil3d_image_resource::nk | ( | ) | const [pure virtual] |
Dimensions: Planes x ni x nj x nk.
The number of pixels in each column.
Implemented in vil3d_analyze_image, vil3d_meta_image, vil3d_gipl_image, vil3d_slice_list_image, vil3d_crop_image_resource, and vil3d_memory_image.
virtual unsigned vil3d_image_resource::nplanes | ( | ) | const [pure virtual] |
Dimensions: Planes x ni x nj.
This concept is treated as a synonym to components.
Implemented in vil3d_analyze_image, vil3d_meta_image, vil3d_gipl_image, vil3d_slice_list_image, vil3d_crop_image_resource, and vil3d_memory_image.
virtual enum vil_pixel_format vil3d_image_resource::pixel_format | ( | ) | const [pure virtual] |
Pixel Format.
pixel_format() == VIL_PIXEL_FORMAT_BYTE
Implemented in vil3d_analyze_image, vil3d_meta_image, vil3d_gipl_image, vil3d_slice_list_image, vil3d_crop_image_resource, and vil3d_memory_image.
virtual bool vil3d_image_resource::put_view | ( | const vil3d_image_view_base & | im, |
unsigned | i0 = 0 , |
||
unsigned | j0 = 0 , |
||
unsigned | k0 = 0 |
||
) | [pure virtual] |
Put the data in this view back into the image source.
The view must be of scalar components. Assign your view to a scalar-component view if this is not the case.
Implemented in vil3d_analyze_image, vil3d_meta_image, vil3d_gipl_image, vil3d_slice_list_image, vil3d_crop_image_resource, and vil3d_memory_image.
void vil3d_image_resource::ref | ( | ) | [inline, private] |
Definition at line 116 of file vil3d_image_resource.h.
virtual bool vil3d_image_resource::set_voxel_size | ( | float | , |
float | , | ||
float | |||
) | [inline, virtual] |
Set the size of the each voxel in the i,j,k directions.
You can get the voxel sizes via get_properties().
Reimplemented in vil3d_analyze_image, vil3d_meta_image, and vil3d_gipl_image.
Definition at line 76 of file vil3d_image_resource.h.
void vil3d_image_resource::unref | ( | ) | [inline, private] |
Definition at line 117 of file vil3d_image_resource.h.
virtual bool vil3d_image_resource::view_fits | ( | const vil3d_image_view_base & | im, |
unsigned | i0, | ||
unsigned | j0, | ||
unsigned | k0 | ||
) | [inline, virtual] |
Check that a view will fit into the data at the given offset.
This includes checking that the pixel type is scalar.
Definition at line 97 of file vil3d_image_resource.h.
bool vil3d_copy_deep | ( | const vil3d_image_resource_sptr & | src, |
vil3d_image_resource_sptr & | dest | ||
) | [related] |
Copy src to dest.
This is useful if you want to copy on image into a window on another image. src and dest must have identical sizes, and pixel-types. Returns false if the copy failed. O(size).
Definition at line 25 of file vil3d_copy.cxx.
vil3d_image_resource_sptr vil3d_crop | ( | const vil3d_image_resource_sptr & | src, |
unsigned | i0, | ||
unsigned | ni, | ||
unsigned | j0, | ||
unsigned | nj, | ||
unsigned | k0, | ||
unsigned | nk | ||
) | [related] |
Crop to a region of src.
Definition at line 13 of file vil3d_crop.cxx.
vil3d_image_resource_sptr vil3d_new_image_resource | ( | unsigned | ni, |
unsigned | nj, | ||
unsigned | nk, | ||
unsigned | nplanes, | ||
vil_pixel_format | format | ||
) | [related] |
Make a new image of given format.
Reimplemented in vil3d_memory_image.
Definition at line 23 of file vil3d_new.cxx.
vil3d_image_resource_sptr vil3d_new_image_resource | ( | const char * | filename, |
unsigned | ni, | ||
unsigned | nj, | ||
unsigned | nk, | ||
unsigned | nplanes, | ||
vil_pixel_format | format, | ||
char const * | file_format = 0 |
||
) | [related] |
Make a new image on disk.
Definition at line 31 of file vil3d_new.cxx.
bool vil3d_save_image_resource | ( | const vil3d_image_resource_sptr & | ir, |
char const * | filename, | ||
char const * | file_format | ||
) | [related] |
Send vil3d_image_resource to disk.
Definition at line 97 of file vil3d_save.cxx.
bool vil3d_save_image_resource | ( | const vil3d_image_resource_sptr & | ir, |
char const * | filename | ||
) | [related] |
Save vil3d_image_resource to file, deducing format from filename.
Definition at line 111 of file vil3d_save.cxx.
friend class vil_smart_ptr< vil3d_image_resource > [friend] |
Definition at line 115 of file vil3d_image_resource.h.
int vil3d_image_resource::reference_count_ [private] |
Definition at line 120 of file vil3d_image_resource.h.