Image Component Library (ICL)
Public Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members

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

Public Member Functions

 FileWriter ()
 creates an empty file writer More...
 
 FileWriter (const std::string &filepattern)
 Creates a new filewriter with given filepattern. More...
 
 FileWriter (const FilenameGenerator &gen)
 Creates a new FileWriter with given FilenameGenerator. More...
 
 ~FileWriter ()
 Destructor. More...
 
const FilenameGeneratorgetFilenameGenerator () const
 returns the wrapped filename generator reference More...
 
void write (const core::ImgBase *image)
 writes the next image More...
 
virtual void send (const core::ImgBase *image)
 wraps write to implement ImageOutput interface More...
 
FileWriteroperator<< (const core::ImgBase *image)
 as write but in stream manner More...
 
void setOption (const std::string &option, const std::string &value)
 sets a core::format specific option More...
 
- Public Member Functions inherited from icl::io::ImageOutput
virtual ~ImageOutput ()
 virtual destructor More...
 
virtual CompressionSpec getCompression () const
 provide the protectedly inherited image compressor options here More...
 
virtual void setCompression (const CompressionSpec &spec)
 provide the protectedly inherited image compressor options here More...
 

Private Attributes

FilenameGenerator m_oGen
 internal generator for new filenames More...
 

Static Private Attributes

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

Friends

class FileWriterPluginMapInitializer
 initializer class More...
 

Additional Inherited Members

- Protected Member Functions inherited from icl::io::ImageCompressor
Header uncompressHeader (const icl8u *compressedData, int len)
 only decodes an image header More...
 
Header createHeader (const core::ImgBase *image, bool skipMetaData)
 creates a header for a given image (not data will be null) More...
 
 ImageCompressor (const CompressionSpec &spec=CompressionSpec("none"))
 Creates an image Compressor with given compression mode. More...
 
 ~ImageCompressor ()
 Destructor. More...
 
virtual void setCompression (const CompressionSpec &spec)
 string based interface for setting the compression mode More...
 
virtual CompressionSpec getCompression () const
 can be implemented for returning the current compression mode More...
 
utils::Time pickTimeStamp (const icl8u *compressedData)
 this can help to find out wheter the data is new and must be encoded More...
 
const CompressedData compress (const core::ImgBase *image, bool skipMetaData=false)
 encodes a given image into the compressed code More...
 
const core::ImgBaseuncompress (const icl8u *compressedData, int len, core::ImgBase **dst=0)
 decodes the given byte segment More...
 
- Protected Member Functions inherited from icl::utils::Uncopyable
 Uncopyable ()
 Empty base constructor. More...
 

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.

IO-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 (Image Convolution)

The following example illustrates using the file writer:

#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

◆ FileWriter() [1/3]

icl::io::FileWriter::FileWriter ( )

creates an empty file writer

◆ FileWriter() [2/3]

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

◆ FileWriter() [3/3]

icl::io::FileWriter::FileWriter ( const FilenameGenerator gen)

Creates a new FileWriter with given FilenameGenerator.

◆ ~FileWriter()

icl::io::FileWriter::~FileWriter ( )

Destructor.

Member Function Documentation

◆ getFilenameGenerator()

const FilenameGenerator& icl::io::FileWriter::getFilenameGenerator ( ) const

returns the wrapped filename generator reference

◆ operator<<()

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

as write but in stream manner

◆ send()

virtual void icl::io::FileWriter::send ( const core::ImgBase image)
inlinevirtual

wraps write to implement ImageOutput interface

Implements icl::io::ImageOutput.

◆ setOption()

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")

◆ write()

void icl::io::FileWriter::write ( const core::ImgBase image)

writes the next image

Friends And Related Function Documentation

◆ FileWriterPluginMapInitializer

friend class FileWriterPluginMapInitializer
friend

initializer class

Member Data Documentation

◆ m_oGen

FilenameGenerator icl::io::FileWriter::m_oGen
private

internal generator for new filenames

◆ s_mapPlugins

std::map<std::string,FileWriterPlugin*> icl::io::FileWriter::s_mapPlugins
staticprivate

static map of writer plugins


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