Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
BIAS::OpenEXRInterface Class Reference

Methods for reading and writing OpenEXR files into and from BIAS ImageBase. More...

#include <Base/Image/OpenEXRInterface.hh>

+ Collaboration diagram for BIAS::OpenEXRInterface:

Classes

class  ChannelData
 Used to maintain control of the heap when generating slices. More...
 

Public Member Functions

int Export (const std::string &FileName, const ImageBase &input, const Imf::Compression &compression=Imf::ZIP_COMPRESSION)
 
int Import (const std::string &FileName, ImageBase &result)
 
 OpenEXRInterface ()
 
void SetOverridePixelTypeEXR (Imf::PixelType overridePT)
 When exporting image this pixel type is used, not a derived one! Imf::HALF, Imf:FLOAT, Imf::INT are valid values. More...
 
 ~OpenEXRInterface ()
 

Protected Member Functions

int AddChannels_ (const ImageBase::EColorModel &cm, const ImageBase::EStorageType &st, Imf::Header &outHeader, Imf::FrameBuffer &fb, const ImageBase &input)
 
int AddSlice_ (Imf::PixelType pt, const int &exrwidth, const int &exrheight, const std::string &channelName, Imf::FrameBuffer &fb, unsigned int channel=0, const ImageBase *input=NULL)
 
void ClearChannels_ ()
 
ImageBase::EStorageType MapPixelType_ (const Imf::PixelType &pt, const std::string &storageTypeString="")
 
Imf::PixelType MapStorageType_ (const ImageBase::EStorageType &st)
 

Static Protected Member Functions

static int GenerateChannelNames_ (const ImageBase::EColorModel &cm, const unsigned int &numChannels, std::vector< std::string > &channelNames)
 The order of the channel names in the vector is also the order of channels in the ImageBase representation! E.G. More...
 

Protected Attributes

std::map< std::string,
ChannelData
channels_
 
Imf::PixelType overridePT_
 
bool useOverridePT_
 

Detailed Description

Methods for reading and writing OpenEXR files into and from BIAS ImageBase.

Attention
Not all color models have been implemented, have a look at GenerateChannelNames_() method.

If an EXR image is loaded without the new BIAS attributes the color model is chosen by means of the channel count, and defaults to the most common "intensity" based color models (i.e. Grey, RGB, RGBA).

Attention
If an EXR image is loaded that has channels of differing pixel type (e.g. one HALF and one UINT channel) FLOAT is chosen to be the common pixel type.

Since no unsigned char images are natively supported by OpenEXR the BIAS StorageType is also stored in an exported EXR image. This stored type is then used to chose the resulting ImageBase:EStorageType, when loading the image, overriding derived types. This behaviour is not optimal in any case, however most of our tools will expect Image<unsigned char>, when this has been the original source's type.

This is also not a full fledged implementation of all OpenEXR capabilties (i.e. Layers, Tiles, etc.).

Author
bartczak 02/2009

Definition at line 68 of file OpenEXRInterface.hh.

Constructor & Destructor Documentation

OpenEXRInterface::OpenEXRInterface ( )

Definition at line 55 of file OpenEXRInterface.cpp.

OpenEXRInterface::~OpenEXRInterface ( )

Definition at line 59 of file OpenEXRInterface.cpp.

References ClearChannels_().

Member Function Documentation

int OpenEXRInterface::AddChannels_ ( const ImageBase::EColorModel cm,
const ImageBase::EStorageType st,
Imf::Header &  outHeader,
Imf::FrameBuffer &  fb,
const ImageBase input 
)
protected
int OpenEXRInterface::AddSlice_ ( Imf::PixelType  pt,
const int &  exrwidth,
const int &  exrheight,
const std::string &  channelName,
Imf::FrameBuffer &  fb,
unsigned int  channel = 0,
const ImageBase input = NULL 
)
protected

Definition at line 255 of file OpenEXRInterface.cpp.

References channels_, and BIAS::ImageBase::GetChannel().

Referenced by AddChannels_(), and Import().

void OpenEXRInterface::ClearChannels_ ( )
protected

Definition at line 335 of file OpenEXRInterface.cpp.

References channels_.

Referenced by ~OpenEXRInterface().

int OpenEXRInterface::Export ( const std::string &  FileName,
const ImageBase input,
const Imf::Compression &  compression = Imf::ZIP_COMPRESSION 
)
int OpenEXRInterface::GenerateChannelNames_ ( const ImageBase::EColorModel cm,
const unsigned int &  numChannels,
std::vector< std::string > &  channelNames 
)
staticprotected
int OpenEXRInterface::Import ( const std::string &  FileName,
ImageBase result 
)
ImageBase::EStorageType OpenEXRInterface::MapPixelType_ ( const Imf::PixelType &  pt,
const std::string &  storageTypeString = "" 
)
protected
Imf::PixelType OpenEXRInterface::MapStorageType_ ( const ImageBase::EStorageType st)
protected
void OpenEXRInterface::SetOverridePixelTypeEXR ( Imf::PixelType  overridePT)

When exporting image this pixel type is used, not a derived one! Imf::HALF, Imf:FLOAT, Imf::INT are valid values.

Definition at line 497 of file OpenEXRInterface.cpp.

References overridePT_, and useOverridePT_.

Member Data Documentation

std::map<std::string, ChannelData> BIAS::OpenEXRInterface::channels_
protected

Definition at line 143 of file OpenEXRInterface.hh.

Referenced by AddSlice_(), ClearChannels_(), and Import().

Imf::PixelType BIAS::OpenEXRInterface::overridePT_
protected

Definition at line 146 of file OpenEXRInterface.hh.

Referenced by MapStorageType_(), and SetOverridePixelTypeEXR().

bool BIAS::OpenEXRInterface::useOverridePT_
protected

Definition at line 145 of file OpenEXRInterface.hh.

Referenced by MapStorageType_(), and SetOverridePixelTypeEXR().


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