LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::ioFunctor Class Reference

Base class to all io functors. More...

#include <ltiIOFunctor.h>

Inheritance diagram for lti::ioFunctor:
Inheritance graph
[legend]
Collaboration diagram for lti::ioFunctor:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 ioFunctor parameters class More...

Public Member Functions

 ioFunctor ()
 ioFunctor (const parameters &theParam)
 ioFunctor (const std::string &theFilename)
virtual ~ioFunctor ()
const parametersgetParameters () const
virtual bool apply (image &)
virtual bool apply (channel8 &, lti::palette &)
virtual int apply (image &, channel8 &, lti::palette &)
virtual bool apply (const image &)
virtual bool apply (const channel &)
virtual bool apply (const channel8 &, const lti::palette &=emptyPalette)
virtual bool save (const std::string &, const image &)
virtual bool save (const std::string &, const channel8 &, const lti::palette &=emptyPalette)
virtual bool load (const std::string &, image &)
virtual bool load (const std::string &, channel8 &, lti::palette &)
virtual const char * getTypeName () const

Detailed Description

Base class to all io functors.

All functors to load and save images are considered io functors.

This is an abstract class and therefore no instances of this class should exist!


Constructor & Destructor Documentation

lti::ioFunctor::ioFunctor (  )  [inline]

default constructor

lti::ioFunctor::ioFunctor ( const parameters theParam  ) 

constructor, sets the parameters

lti::ioFunctor::ioFunctor ( const std::string &  theFilename  ) 

constructor, sets the filename

virtual lti::ioFunctor::~ioFunctor (  )  [virtual]

destructor


Member Function Documentation

virtual bool lti::ioFunctor::apply ( const channel8 ,
const lti::palette = emptyPalette 
) [inline, virtual]

save 8-bit channel with the given color palette.

Parameters:
theChannel the channel to be saved
colors if a color palette is given, theChannel will be considered to contain indices to this palette. If nothing (or an empty palette) is given, theChannel will be considered as a gray valued channel.
Returns:
false if error, otherwise true

Reimplemented in lti::saveImage, lti::saveBMP, and lti::savePNG.

virtual bool lti::ioFunctor::apply ( const channel  )  [inline, virtual]

save float channel

Parameters:
theChannel channel to be stored. This channel must contain values between 0.0f and 1.0f.
Returns:
false if error, otherwise true

Reimplemented in lti::saveImage, lti::saveBMP, lti::saveJPEG, and lti::savePNG.

virtual bool lti::ioFunctor::apply ( const image  )  [inline, virtual]

save image.

The file name is specified in the parameters.

Parameters:
theImage the image to be stored.
Returns:
false if error, otherwise true

Reimplemented in lti::saveImage, lti::saveBMP, lti::saveJPEG, and lti::savePNG.

virtual int lti::ioFunctor::apply ( image ,
channel8 ,
lti::palette  
) [inline, virtual]

this method loads an image or a channel8, depending on the contents of the file header.

if the number of bits per pixel is 24, the image will be initialized, if the number of bits is less or equal 8, the channel and palette will be initialized.

If the file contains an indexed image, the palette will contain the corresponding colors. If the file contains a "true color" image, the palette will have size 0.

Parameters:
theImage if the file contains a 24-bit image, this parameter will be initialized
theChannel if the channel contains an 8-bit image, this parameters will contain the readed data
colors if the channel was loaded this parameter will contain the used colors.
Returns:
the number of bits per pixel of the loaded image or 0 if an error occured. The valid values are 1, 4, 8, or 24

Reimplemented in lti::loadBMP.

virtual bool lti::ioFunctor::apply ( channel8 ,
lti::palette  
) [inline, virtual]

load Channel Use this method if you know that the file contains a gray valued image.

Parameters:
theChannel the image on the file will be loaded here
colors theChannel contains just indexes to the pixel values in this palette (vector or rgbPixel).
Returns:
true if successful, false otherwise.

Reimplemented in lti::loadImage, lti::loadBMP, lti::loadImageList, and lti::loadPNG.

virtual bool lti::ioFunctor::apply ( image  )  [inline, virtual]

load Image

Parameters:
theImage the file specified in the parameters will be loaded in this image. Note that independently of the sort of image in the file, this will always be converted to a color lti::image.
Returns:
a reference to the loaded image.

Reimplemented in lti::loadImage, lti::loadBMP, lti::loadJPEG, lti::loadImageList, and lti::loadPNG.

const parameters& lti::ioFunctor::getParameters (  )  const
virtual const char* lti::ioFunctor::getTypeName (  )  const [virtual]
virtual bool lti::ioFunctor::load ( const std::string &  ,
channel8 ,
lti::palette  
) [inline, virtual]

shortcut for load image.

Use this method if you know that the file contains a gray valued image.

Parameters:
filename name of the file to be readed
theChannel variable where the image will be stored
colors the palette used will be stored here

Reimplemented in lti::loadImage, lti::loadBMP, and lti::loadPNG.

virtual bool lti::ioFunctor::load ( const std::string &  ,
image  
) [inline, virtual]

shortcut for load image

Parameters:
filename name of the file to be readed
theImage variable where the image will to be stored

Reimplemented in lti::loadImage, lti::loadBMP, lti::loadJPEG, and lti::loadPNG.

virtual bool lti::ioFunctor::save ( const std::string &  ,
const channel8 ,
const lti::palette = emptyPalette 
) [inline, virtual]

this will save a channel8

Parameters:
filename name of the destination file
theChannel the channel to be save
colors the palette to be used

Reimplemented in lti::saveImage, lti::saveBMP, and lti::savePNG.

virtual bool lti::ioFunctor::save ( const std::string &  ,
const image  
) [inline, virtual]

this will save an image as a 24 bit RGB image

Reimplemented in lti::saveImage, lti::saveBMP, lti::saveJPEG, and lti::savePNG.


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

Generated on Sat Apr 10 15:28:02 2010 for LTI-Lib by Doxygen 1.6.1