last update 20 Sep 2009 |
#include <cvrIOImage.h>
Public Member Functions | |
ioImage () | |
ioImage (const ioImage &other) | |
virtual | ~ioImage () |
const parameters & | getParameters () const |
virtual const std::string & | name () const |
virtual ioImage * | clone () const |
virtual ioImage * | newInstance () const |
ioImage & | copy (const ioImage &other) |
ioImage & | operator= (const ioImage &other) |
bool | isSupportedExtension (const std::string &ext) const |
Loading images and channels | |
virtual bool | load (const std::string &filename, image &img) |
virtual bool | load (const std::string &filename, matrix< ubyte > &chnl, palette &pal) |
virtual bool | load (const std::string &filename, matrix< ubyte > &chnl) |
virtual bool | load (const std::string &filename, matrix< float > &chnl) |
virtual bool | load (const std::string &filename, matrix< int32 > &chnl, palette &pal) |
virtual bool | load (const std::string &filename, matrix< int32 > &chnl) |
virtual bool | checkHeader (const std::string &filename, headerInformation &info) |
Saving images and channels | |
virtual bool | save (const std::string &filename, const image &img) |
virtual bool | save (const std::string &filename, const matrix< ubyte > &chnl, const palette &pal) |
virtual bool | save (const std::string &filename, const matrix< ubyte > &chnl) |
virtual bool | save (const std::string &filename, const matrix< float > &chnl) |
virtual bool | save (const std::string &filename, const matrix< int32 > &chnl, const palette &pal) |
virtual bool | save (const std::string &filename, const matrix< int32 > &chnl) |
Protected Member Functions | |
bool | buildRepository () |
bool | clearRepository () |
std::string | getFileExtension (const std::string &filename) const |
ioImageInterface * | get (const std::string &ext) |
Protected Attributes | |
std::map< std::string, ioImageInterface * > | ioObjects_ |
This class makes use of all its sibling classes to save or load image files in all supported formats (bmp, jpg, png).
Example:
cvr::ioImage imgFiler; // create the object to save/load images cvr::image img(256,256,cvr::White); // create a white image 256x256 imgFiler.save("myImage.png",img); // save image as png file cvr::image other; // another variable imgFiler.load("myImage.png",other); // load the recently created file.
cvr::ioImage::ioImage | ( | ) |
Default constructor.
cvr::ioImage::ioImage | ( | const ioImage & | other | ) |
Copy constructor.
virtual cvr::ioImage::~ioImage | ( | ) | [virtual] |
destructor
bool cvr::ioImage::buildRepository | ( | ) | [protected] |
Build repository.
Use the factory to create the repository
virtual bool cvr::ioImage::checkHeader | ( | const std::string & | filename, | |
headerInformation & | info | |||
) | [virtual] |
Check the file header for common information.
All classes implementing this interface usually provide additional methods to check other options of the specific file formats, or overload the headerInformation to include additional items.
Implements cvr::ioImageInterface.
bool cvr::ioImage::clearRepository | ( | ) | [protected] |
Clear repository.
Remove all objects in the repository
virtual ioImage* cvr::ioImage::clone | ( | ) | const [virtual] |
ioImageInterface* cvr::ioImage::get | ( | const std::string & | ext | ) | [protected] |
Search an appropriate functor for the given file extension, or null if there is nothing available.
std::string cvr::ioImage::getFileExtension | ( | const std::string & | filename | ) | const [protected] |
Get file extension.
const parameters& cvr::ioImage::getParameters | ( | ) | const |
bool cvr::ioImage::isSupportedExtension | ( | const std::string & | ext | ) | const |
Load the contents as a integer mask.
Default implementation discards the palette of the other matrix<int32> method.
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioImage::load | ( | const std::string & | filename, | |
matrix< int32 > & | chnl, | |||
palette & | pal | |||
) | [virtual] |
Load the contents as a integer mask.
Default implementation returns the casting of the channel8 related method.
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioImage::load | ( | const std::string & | filename, | |
matrix< float > & | chnl | |||
) | [virtual] |
Load a floating point channel.
Not many file formats support floating point channels, so the default implementation just casts a channel8 into the float.
Reimplemented from cvr::ioImageInterface.
Load the contents as a gray channel.
Default implementation just discards the palette of load(const std::string&,matrix<ubyte>&,palette&)
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioImage::load | ( | const std::string & | filename, | |
matrix< ubyte > & | chnl, | |||
palette & | pal | |||
) | [virtual] |
Load a channel8 as a label mask with its corresponding palette.
If the file contained a color image, then the functor has to quantize the colors and returned the quantized table.
Implements cvr::ioImageInterface.
virtual bool cvr::ioImage::load | ( | const std::string & | filename, | |
image & | img | |||
) | [virtual] |
virtual const std::string& cvr::ioImage::name | ( | ) | const [virtual] |
virtual ioImage* cvr::ioImage::newInstance | ( | ) | const [virtual] |
virtual bool cvr::ioImage::save | ( | const std::string & | filename, | |
const matrix< int32 > & | chnl | |||
) | [virtual] |
Save the contents as a integer mask.
Default implementation discards the palette of the other matrix<int32> method.
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioImage::save | ( | const std::string & | filename, | |
const matrix< int32 > & | chnl, | |||
const palette & | pal | |||
) | [virtual] |
Save the contents as a integer mask.
Default implementation returns the casting of the channel8 related method.
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioImage::save | ( | const std::string & | filename, | |
const matrix< float > & | chnl | |||
) | [virtual] |
virtual bool cvr::ioImage::save | ( | const std::string & | filename, | |
const matrix< ubyte > & | chnl | |||
) | [virtual] |
Save the contents as a gray channel.
Default implementation just discards the palette of save(const std::string&,matrix<ubyte>&,palette&)
Reimplemented from cvr::ioImageInterface.
virtual bool cvr::ioImage::save | ( | const std::string & | filename, | |
const matrix< ubyte > & | chnl, | |||
const palette & | pal | |||
) | [virtual] |
Save a channel8 as a label mask with its corresponding palette.
If the file contained a color image, then the functor has to quantize the colors and returned the quantized table.
Implements cvr::ioImageInterface.
virtual bool cvr::ioImage::save | ( | const std::string & | filename, | |
const image & | img | |||
) | [virtual] |
std::map<std::string,ioImageInterface*> cvr::ioImage::ioObjects_ [protected] |
Local object repository.