ColormapFile Class Reference

Colormap file. More...

#include <fvutils/colormap/cmfile.h>

Inheritance diagram for ColormapFile:

List of all members.


Classes

class  ColormapBlockVector
 Vector of colormap blocks. More...

Public Member Functions

 ColormapFile ()
 Constructor.
 ColormapFile (uint16_t depth, uint16_t width, uint16_t height)
 Constructor.
void add_colormap (Colormap *colormap)
 Add colormap.
ColormapBlockVectorcolormap_blocks ()
 Get colormap blocks.
Colormapget_colormap ()
 Get a freshly generated colormap based on current file content.
uint16_t get_depth ()
 Get depth of colormap.
uint16_t get_width ()
 Get width of colormap.
uint16_t get_height ()
 Get height of colormap.
virtual void clear ()
 Clear internal storage.

Static Public Member Functions

static bool is_colormap_file (const char *filename)
 Check if given file is a colormap file.
static std::string compose_filename (const std::string format)
 Compose filename.

Detailed Description

Colormap file.

This class implements a FireVision data file format for colormaps.

Author:
Tim Niemueller

Definition at line 50 of file cmfile.h.


Constructor & Destructor Documentation

ColormapFile::ColormapFile (  ) 

Constructor.

Creates a plain empty colormap file.

Definition at line 78 of file cmfile.cpp.

ColormapFile::ColormapFile ( uint16_t  depth,
uint16_t  width,
uint16_t  height 
)

Constructor.

Creates a plain empty colormap file with given dimensions.

Parameters:
depth depth of colormap
width width of colormap
height height of colormap

Definition at line 64 of file cmfile.cpp.

References FireVisionDataFile::_spec_header, FireVisionDataFile::_spec_header_size, cmfile_header_t::depth, cmfile_header_t::height, and cmfile_header_t::width.


Member Function Documentation

void ColormapFile::add_colormap ( Colormap colormap  ) 

Add colormap.

This will add the given colormap to this file. It will query the colormap for a number of blocks that shall be added to the file. Note that for now only a single colormap per file is supported, though not enforced.

Parameters:
colormap colormap to add

Definition at line 93 of file cmfile.cpp.

References FireVisionDataFile::_spec_header, FireVisionDataFile::_spec_header_size, FireVisionDataFile::add_block(), FireVisionDataFile::blocks(), Colormap::depth(), cmfile_header_t::depth, Colormap::get_blocks(), Colormap::height(), cmfile_header_t::height, Colormap::width(), and cmfile_header_t::width.

Referenced by FireVisionNetworkTool::fuse_inbound_received(), BayesHistosToLut::save(), and BayesHistosToLut::saveLut().

void ColormapFile::clear (  )  [virtual]

Clear internal storage.

All internal data is deleted.

Reimplemented from FireVisionDataFile.

Definition at line 230 of file cmfile.cpp.

ColormapFile::ColormapBlockVector * ColormapFile::colormap_blocks (  ) 

Get colormap blocks.

Returns:
vector of colormap blocks

Definition at line 129 of file cmfile.cpp.

References FireVisionDataFile::blocks().

std::string ColormapFile::compose_filename ( const std::string  format  )  [static]

Compose filename.

In the format g is replaced with the hostname.

Parameters:
format format for the filename

Definition at line 212 of file cmfile.cpp.

Colormap * ColormapFile::get_colormap (  ) 

Get a freshly generated colormap based on current file content.

This returns an instance of a colormap that uses all current blocks of this instance. Currently it only supports file which contain a valid YuvColormap. This means that it has d blocks of YUV type. d is the depth and must fulfill d=2^n with n from [1,8]. It can throw any exception that the YuvColormap ctor can throw.

Returns:
instance of colormap. You must delete it after you are done with it.

Definition at line 164 of file cmfile.cpp.

References FireVisionDataFile::blocks(), YuvColormap::copy_uvplane(), cmfile_header_t::depth, cmfile_header_t::height, YuvColormap::plane_size(), and cmfile_header_t::width.

Referenced by ColorModelLookupTable::ColorModelLookupTable(), ColorModelLookupTable::load(), ColorTrainWidget::load_colormap(), YuvColormap::operator+=(), and FireVisionNetworkTool::set_colormap().

uint16_t ColormapFile::get_depth (  ) 

Get depth of colormap.

Returns:
depth

Definition at line 241 of file cmfile.cpp.

References cmfile_header_t::depth.

uint16_t ColormapFile::get_height (  ) 

Get height of colormap.

Returns:
height

Definition at line 261 of file cmfile.cpp.

References cmfile_header_t::height.

uint16_t ColormapFile::get_width (  ) 

Get width of colormap.

Returns:
width

Definition at line 251 of file cmfile.cpp.

References cmfile_header_t::width.

bool ColormapFile::is_colormap_file ( const char *  filename  )  [static]

Check if given file is a colormap file.

Parameters:
filename name of file to check

Definition at line 201 of file cmfile.cpp.

References FireVisionDataFile::has_magic_token().


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