last update 20 Sep 2009 |
#include <cvrIOImageInterface.h>
Classes | |
class | headerInformation |
Common header information block. More... | |
class | parameters |
ioFunctor parameters class More... | |
Public Member Functions | |
ioImageInterface () | |
ioImageInterface (const ioImageInterface &other) | |
virtual | ~ioImageInterface () |
const parameters & | getParameters () const |
virtual const std::string & | name () const |
virtual ioImageInterface * | clone () const =0 |
virtual ioImageInterface * | newInstance () const =0 |
ioImageInterface & | copy (const ioImageInterface &other) |
ioImageInterface & | operator= (const ioImageInterface &other) |
Loading images and channels | |
virtual bool | load (const std::string &filename, image &img)=0 |
virtual bool | load (const std::string &filename, matrix< ubyte > &chnl, palette &pal)=0 |
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)=0 |
Saving images and channels | |
virtual bool | save (const std::string &filename, const image &img)=0 |
virtual bool | save (const std::string &filename, const matrix< ubyte > &chnl, const palette &pal)=0 |
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 | |
const palette & | getGrayPalette () const |
It is a very simple class with nothing but an empty definition of a parameters class with the attribute "filename".
Note that these classes cannot be considered CVR-Lib functors, as they lack the for the later mandatory apply() methods.
cvr::ioImageInterface::ioImageInterface | ( | ) |
Default constructor.
cvr::ioImageInterface::ioImageInterface | ( | const ioImageInterface & | other | ) |
Copy constructor.
virtual cvr::ioImageInterface::~ioImageInterface | ( | ) | [virtual] |
destructor
virtual bool cvr::ioImageInterface::checkHeader | ( | const std::string & | filename, | |
headerInformation & | info | |||
) | [pure 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.
Implemented in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual ioImageInterface* cvr::ioImageInterface::clone | ( | ) | const [pure virtual] |
Returns a pointer to a clone of the functor.
Implements cvr::object.
Implemented in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
ioImageInterface& cvr::ioImageInterface::copy | ( | const ioImageInterface & | other | ) |
Copy operator.
const palette& cvr::ioImageInterface::getGrayPalette | ( | ) | const [protected] |
Method to get a read-only reference to a 256 long gray-palette.
const parameters& cvr::ioImageInterface::getParameters | ( | ) | const |
returns current parameters.
Reimplemented from cvr::parametersManager.
Reimplemented in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual bool cvr::ioImageInterface::load | ( | const std::string & | filename, | |
matrix< int32 > & | chnl | |||
) | [virtual] |
Load the contents as a integer mask.
Default implementation discards the palette of the other matrix<int32> method.
Reimplemented in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual bool cvr::ioImageInterface::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 in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual bool cvr::ioImageInterface::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 in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual bool cvr::ioImageInterface::load | ( | const std::string & | filename, | |
matrix< ubyte > & | chnl | |||
) | [virtual] |
Load the contents as a gray channel.
Default implementation just discards the palette of load(const std::string&,matrix<ubyte>&,palette&)
Reimplemented in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual bool cvr::ioImageInterface::load | ( | const std::string & | filename, | |
matrix< ubyte > & | chnl, | |||
palette & | pal | |||
) | [pure 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.
Implemented in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual bool cvr::ioImageInterface::load | ( | const std::string & | filename, | |
image & | img | |||
) | [pure virtual] |
virtual const std::string& cvr::ioImageInterface::name | ( | ) | const [virtual] |
Returns the name of this class.
Implements cvr::object.
Reimplemented in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual ioImageInterface* cvr::ioImageInterface::newInstance | ( | ) | const [pure virtual] |
Returns a pointer to a new instance of this functor.
Implements cvr::object.
Implemented in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
ioImageInterface& cvr::ioImageInterface::operator= | ( | const ioImageInterface & | other | ) |
Copy operator.
virtual bool cvr::ioImageInterface::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 in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual bool cvr::ioImageInterface::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 in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual bool cvr::ioImageInterface::save | ( | const std::string & | filename, | |
const matrix< float > & | chnl | |||
) | [virtual] |
Save a floating point channel.
Not many file formats support floating point channels, so the default implementation just casts the channel to a channel8, which is saved. You normally lose precision.
Reimplemented in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual bool cvr::ioImageInterface::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 in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual bool cvr::ioImageInterface::save | ( | const std::string & | filename, | |
const matrix< ubyte > & | chnl, | |||
const palette & | pal | |||
) | [pure 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.
Implemented in cvr::ioBMP, cvr::ioImage, cvr::ioJPEG, and cvr::ioPNG.
virtual bool cvr::ioImageInterface::save | ( | const std::string & | filename, | |
const image & | img | |||
) | [pure virtual] |