CVR-Lib last update 20 Sep 2009

cvr::ioImage Class Reference

Class to read/write image files. More...

#include <cvrIOImage.h>

Inheritance diagram for cvr::ioImage:

Inheritance graph
[legend]
Collaboration diagram for cvr::ioImage:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ioImage ()
 ioImage (const ioImage &other)
virtual ~ioImage ()
const parametersgetParameters () const
virtual const std::string & name () const
virtual ioImageclone () const
virtual ioImagenewInstance () const
ioImagecopy (const ioImage &other)
ioImageoperator= (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
ioImageInterfaceget (const std::string &ext)

Protected Attributes

std::map< std::string,
ioImageInterface * > 
ioObjects_


Detailed Description

Class to read/write image files.

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.

Constructor & Destructor Documentation

cvr::ioImage::ioImage (  ) 

Default constructor.

cvr::ioImage::ioImage ( const ioImage other  ) 

Copy constructor.

virtual cvr::ioImage::~ioImage (  )  [virtual]

destructor


Member Function Documentation

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]

Returns a pointer to a clone of the functor.

Implements cvr::ioImageInterface.

ioImage& cvr::ioImage::copy ( const ioImage other  ) 

Copy operator.

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

returns current parameters.

Reimplemented from cvr::ioImageInterface.

bool cvr::ioImage::isSupportedExtension ( const std::string &  ext  )  const

Returns true if the given extension ext is supported (i.e.

can be loaded/saved). The argument is not case sensitive.

This function is dedicated for more sophisticated IO interfaces that use ioImage to actually load different image types.

virtual bool cvr::ioImage::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 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.

virtual bool cvr::ioImage::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 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]

Load file as a color image.

Implements cvr::ioImageInterface.

virtual const std::string& cvr::ioImage::name (  )  const [virtual]

Returns the name of this class.

Reimplemented from cvr::ioImageInterface.

virtual ioImage* cvr::ioImage::newInstance (  )  const [virtual]

Returns a pointer to a new instance of this functor.

Implements cvr::ioImageInterface.

ioImage& cvr::ioImage::operator= ( const ioImage other  ) 

Copy operator.

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]

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 from cvr::ioImageInterface.

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]

Save file as a color image.

Implements cvr::ioImageInterface.


Member Data Documentation

std::map<std::string,ioImageInterface*> cvr::ioImage::ioObjects_ [protected]

Local object repository.


The documentation for this class was generated from the following file:

Generated on Sun Sep 20 22:08:54 2009 for CVR-Lib by Doxygen 1.5.8