Basic Image AlgorithmS Library
2.8.0
|
Methods for reading and writing OpenEXR files into and from BIAS ImageBase. More...
#include <Base/Image/OpenEXRInterface.hh>
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_ |
Methods for reading and writing OpenEXR files into and from BIAS ImageBase.
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).
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.).
Definition at line 68 of file OpenEXRInterface.hh.
OpenEXRInterface::OpenEXRInterface | ( | ) |
Definition at line 55 of file OpenEXRInterface.cpp.
OpenEXRInterface::~OpenEXRInterface | ( | ) |
Definition at line 59 of file OpenEXRInterface.cpp.
References ClearChannels_().
|
protected |
Definition at line 224 of file OpenEXRInterface.cpp.
References AddSlice_(), GenerateChannelNames_(), BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetWidth(), and MapStorageType_().
Referenced by Export().
|
protected |
Definition at line 255 of file OpenEXRInterface.cpp.
References channels_, and BIAS::ImageBase::GetChannel().
Referenced by AddChannels_(), and Import().
|
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 |
||
) |
Definition at line 64 of file OpenEXRInterface.cpp.
References AddChannels_(), BIAS::ImageBase::GetColorModel(), BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetMetaData(), BIAS::ImageBase::GetStorageType(), BIAS::ImageBase::GetWidth(), and BIAS::MetaData::WriteAscii().
Referenced by BIAS::ImageIO::ExportOpenEXR().
|
staticprotected |
The order of the channel names in the vector is also the order of channels in the ImageBase representation! E.G.
channelNames[0] = "B", channelNames[1] = "G", channelNames[2] = "R" means that the OpenEXR channel named "B" is assigned to channel 0 in the ImageBase representation, while channel named "R" is found in ImageBase representation channel=2.
Definition at line 157 of file OpenEXRInterface.cpp.
References BIAS::ImageBase::CM_Bayer_BGGR, BIAS::ImageBase::CM_Bayer_GBRG, BIAS::ImageBase::CM_Bayer_GRBG, BIAS::ImageBase::CM_Bayer_RGGB, BIAS::ImageBase::CM_BGR, BIAS::ImageBase::CM_BGRA, BIAS::ImageBase::CM_Depth, BIAS::ImageBase::CM_DepthAndVariance, BIAS::ImageBase::CM_Disparity, BIAS::ImageBase::CM_DOES_NOT_EXIST, BIAS::ImageBase::CM_DV, BIAS::ImageBase::CM_Grey, BIAS::ImageBase::CM_GreyA, BIAS::ImageBase::CM_HSI_OBS, BIAS::ImageBase::CM_HSL, BIAS::ImageBase::CM_hsL, BIAS::ImageBase::CM_HSV, BIAS::ImageBase::CM_I1I2I3, BIAS::ImageBase::CM_invalid, BIAS::ImageBase::CM_LAB, BIAS::ImageBase::CM_LUV, BIAS::ImageBase::CM_PGR_XB3_F7M3_GBRG, BIAS::ImageBase::CM_RGB, BIAS::ImageBase::CM_RGBA, BIAS::ImageBase::CM_RGBE, BIAS::ImageBase::CM_SymTensor2x2, BIAS::ImageBase::CM_UYVY422, BIAS::ImageBase::CM_XYZ, BIAS::ImageBase::CM_YUV411, BIAS::ImageBase::CM_YUV420P, BIAS::ImageBase::CM_YUV444, BIAS::ImageBase::CM_YUYV, and BIAS::ImageBase::CM_YUYV422.
Referenced by AddChannels_(), and Import().
int OpenEXRInterface::Import | ( | const std::string & | FileName, |
ImageBase & | result | ||
) |
Definition at line 346 of file OpenEXRInterface.cpp.
References AddSlice_(), channels_, BIAS::ImageBase::CM_Grey, BIAS::ImageBase::CM_GreyA, BIAS::ImageBase::CM_invalid, BIAS::ImageBase::CM_RGB, BIAS::ImageBase::CM_RGBA, BIAS::OpenEXRInterface::ChannelData::empty, BIAS::ImageBase::Flip(), GenerateChannelNames_(), BIAS::ImageBase::GetMetaData(), BIAS::ImageBase::Init(), BIAS::ImageBase::IsEmpty(), BIAS::OpenEXRInterface::ChannelData::isFloat, BIAS::OpenEXRInterface::ChannelData::isHalf, BIAS::OpenEXRInterface::ChannelData::isUInt, MapPixelType_(), BIAS::ImageBase::Release(), BIAS::ImageBase::SetChannel(), BIAS::ImageBase::SetColorModel(), and BIAS::ImageBase::StringToColorModel().
Referenced by BIAS::ImageIO::ImportOpenEXR().
|
protected |
Definition at line 137 of file OpenEXRInterface.cpp.
References BIAS::ImageBase::ST_float, BIAS::ImageBase::ST_invalid, BIAS::ImageBase::ST_unsignedint, and BIAS::ImageBase::StringToStorageType().
Referenced by Import().
|
protected |
Definition at line 114 of file OpenEXRInterface.cpp.
References overridePT_, BIAS::ImageBase::ST_unsignedchar, BIAS::ImageBase::ST_unsignedint, and useOverridePT_.
Referenced by AddChannels_().
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_.
|
protected |
Definition at line 143 of file OpenEXRInterface.hh.
Referenced by AddSlice_(), ClearChannels_(), and Import().
|
protected |
Definition at line 146 of file OpenEXRInterface.hh.
Referenced by MapStorageType_(), and SetOverridePixelTypeEXR().
|
protected |
Definition at line 145 of file OpenEXRInterface.hh.
Referenced by MapStorageType_(), and SetOverridePixelTypeEXR().