Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Attributes | Static Private Attributes | Friends

File Writer implementation writing images to the hard disc. More...

#include <FileWriter.h>

Inheritance diagram for icl::io::FileWriter:
icl::io::ImageOutput icl::io::ImageCompressor icl::utils::Uncopyable

List of all members.

Public Member Functions

 FileWriter ()
 creates an empty file writer
 FileWriter (const std::string &filepattern)
 Creates a new filewriter with given filepattern.
 FileWriter (const FilenameGenerator &gen)
 Creates a new FileWriter with given FilenameGenerator.
 ~FileWriter ()
 Destructor.
const FilenameGeneratorgetFilenameGenerator () const
 returns the wrapped filename generator reference
void write (const core::ImgBase *image)
 writes the next image
virtual void send (const core::ImgBase *image)
 wraps write to implement ImageOutput interface
FileWriteroperator<< (const core::ImgBase *image)
 as write but in stream manner
void setOption (const std::string &option, const std::string &value)
 sets a core::format specific option

Private Attributes

FilenameGenerator m_oGen
 internal generator for new filenames

Static Private Attributes

static std::map< std::string,
FileWriterPlugin * > 
s_mapPlugins
 static map of writer plugins

Friends

class FileWriterPluginMapInitializer
 initializer class

Detailed Description

File Writer implementation writing images to the hard disc.

Overview

The implementation has been re-designed to provide a structured more flexible plugin based interface for writing images using most different file formats. Currently the following formats are supported:

Z-Lib support

All supported file formats (except jpg) can be written/read as gzipped file. This feature is available if the libz is found by the makefile system, which automatically defines the -DWITH_ZLIB_SUPPORT then. To write a file with zip compression, you just have to add an additional ".gz"-suffix to the file name.

Speed

Dependent on the particular core::format, the IO process needs a larger or smaller amount of time. The following table shows a summary of the I/O Times. The times are taken on a 1.6GHz pentium-m notebook, so the actual times may fluctuate:

Writing (gz) Reading (gz) File-utils::Size (640x480-Parrot) (gz)
ppm 10ms (100ms) 6ms (25ms) 901K (545K)
pnm 10ms (100ms) 6ms (25ms) 901K (545K)
pgm 7ms (120ms) 7ms (25ms)

901K (562K)

icl 4ms (122ms) 7ms (26ms)

901K (562K)

csv 800ms (1800ms) 780ms (820ms)

2901K (690K)

jpg 10% 5ms (not supported) 5ms (not supported) 15K (not supported)
jpg 50% 6ms (not supported) 5ms (not supported) 41K (not supported)
jpg 90% 5ms (not supported) 5ms (not supported) 101K (not supported)
jpg 100% 7ms (not supported) 3ms (not supported) 269K (not supported)

Example

The following example illustrates using the file writer:

        #include <ICLIO/FileWriter.h>
        #include <ICLQt/Quick.h>

        int main(){
           // create an image
           icl::core::Img8u a = cvt8u(scale(create("parrot"),640,480));

           // create the file writer
           icl::io::FileWriter writer("image_####.jpg");

           // write the file
           writer.write(&a);
        }

Constructor & Destructor Documentation

creates an empty file writer

icl::io::FileWriter::FileWriter ( const std::string &  filepattern)

Creates a new filewriter with given filepattern.

Parameters:
filepatternthis string is passed to the member FilenameGenerator
See also:
FilenameGenerator

Creates a new FileWriter with given FilenameGenerator.

Destructor.


Member Function Documentation

returns the wrapped filename generator reference

FileWriter& icl::io::FileWriter::operator<< ( const core::ImgBase image)

as write but in stream manner

virtual void icl::io::FileWriter::send ( const core::ImgBase image) [inline, virtual]

wraps write to implement ImageOutput interface

Implements icl::io::ImageOutput.

void icl::io::FileWriter::setOption ( const std::string &  option,
const std::string &  value 
)

sets a core::format specific option

currently allowed options are:

  • "jpg:quality" values of type int in range [0,100]
  • "csv:extend-file-name" value of type bool ("true" or "false")
void icl::io::FileWriter::write ( const core::ImgBase image)

writes the next image


Friends And Related Function Documentation

friend class FileWriterPluginMapInitializer [friend]

initializer class


Member Data Documentation

internal generator for new filenames

std::map<std::string,FileWriterPlugin*> icl::io::FileWriter::s_mapPlugins [static, private]

static map of writer plugins


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines