imebra  build 2011-09-18_22-24-41
puntoexe::imebra::transforms::colorTransforms::colorTransformsFactory Class Reference

This class maintains a list of all the available colorTransform classes and retrieve the most appropriate transform class (or classes) when a color space conversion is needed. More...

#include <colorTransformsFactory.h>

Inheritance diagram for puntoexe::imebra::transforms::colorTransforms::colorTransformsFactory:
puntoexe::baseObject

List of all members.

Public Member Functions

Color space conversion

Return the transform that convert one color space into another

ptr< colorTransformgetTransform (std::wstring startColorSpace, std::wstring endColorSpace)
 Returns a transform or a sequence of transforms (see transformsChain) that can convert the pixels from one color space to another color space.

Static Public Member Functions

Static instance

Static functions that return a pointer to the statically allocated instance of colorTransformsFactory

static ptr
< colorTransformsFactory
getColorTransformsFactory ()
 Retrieve a pointer to the unique statically allocated instance of the colorTransforsFactory class.
Static functions

Static functions that operate on the color space name

static std::wstring normalizeColorSpace (std::wstring colorSpace)
 Normalize a color space name.
static bool isMonochrome (std::wstring colorSpace)
 Returns true if the color space name specified in the parameter has only one color channel and is monochrome (it doesn't have a lookup color table).
static bool isSubsampledX (std::wstring colorSpace)
 Returns true if the name of the color space specified in the parameter indicates that the chrominance channels are subsampled horizontally.
static bool isSubsampledY (std::wstring colorSpace)
 Returns true if the name of the color space specified in the parameter indicates that the chrominance channels are subsampled vertically.
static bool canSubsample (std::wstring colorSpace)
 Returns true if the color space specified in the parameter can be subsampled.
static std::wstring makeSubsampled (std::wstring colorSpace, bool bSubsampleX, bool bSubsampleY)
 Add the subsamplig information to a color space name.
static imbxUint32 getNumberOfChannels (std::wstring colorSpace)
 Returns the number of channels used by the specified color space.

Detailed Description

This class maintains a list of all the available colorTransform classes and retrieve the most appropriate transform class (or classes) when a color space conversion is needed.

One instance of this class is statically allocated by the library; the application does NOT have to allocate its own instance of colorTransformsFactory.

A pointer to the statically allocated colorTransformsFactory class can be obtained by calling that static function colorTransformsFactory::getColorTransformsFactory().

The class can also retrieve more information from a name of a color space (in dicom standard). For instance, both the Dicom color space "YBR_FULL_422" and "YBR_FULL" describe the color space YBR, but the first indicates that the image is subsampled both horizontally and vertically.

The colorTransformsFactory can normalize the color space name (e.g.: convert "YBR_FULL_422" to "YBR_FULL") and can retrieve the subsampling parameters.


Member Function Documentation

bool puntoexe::imebra::transforms::colorTransforms::colorTransformsFactory::canSubsample ( std::wstring  colorSpace) [static]

Returns true if the color space specified in the parameter can be subsampled.

For instance, the color spaces "YBR_FULL" and "YBR_PARTIAL" can be subsampled, but the color space "RGB" cannot be subsampled.

Parameters:
colorSpacethe name of the color space to be tested
Returns:
true if the name of the color space in the parameter colorSpace can be subsampled
ptr< colorTransformsFactory > puntoexe::imebra::transforms::colorTransforms::colorTransformsFactory::getColorTransformsFactory ( ) [static]

Retrieve a pointer to the unique statically allocated instance of the colorTransforsFactory class.

The application must use the colorTransformsFactory referenced by this function.

Returns:
a pointer to the unique instance of the colorTransformsFactory
imbxUint32 puntoexe::imebra::transforms::colorTransforms::colorTransformsFactory::getNumberOfChannels ( std::wstring  colorSpace) [static]

Returns the number of channels used by the specified color space.

For instance, the color space "RGB" has 3 color channels, while the "MONOCHROME2" color space has 1 color channel.

Parameters:
colorSpacethe name of the color space for which the number of channels must be returned
Returns:
the number of color channels in the specified color channel
ptr< colorTransform > puntoexe::imebra::transforms::colorTransforms::colorTransformsFactory::getTransform ( std::wstring  startColorSpace,
std::wstring  endColorSpace 
)

Returns a transform or a sequence of transforms (see transformsChain) that can convert the pixels from one color space to another color space.

If the no conversion is needed then the function returns 0. If the function cannot find any suitable transform then a colorTransformsFactoryExceptionNoTransform is thrown.

Parameters:
startColorSpacethe color space from which the conversion has to take place
endColorSpacethe color space resulting from the conversion
Returns:
the transform that can convert the startColorSpace into endColorSpace, or 0 if startColorSpace and endColorSpace have the same value
bool puntoexe::imebra::transforms::colorTransforms::colorTransformsFactory::isMonochrome ( std::wstring  colorSpace) [static]

Returns true if the color space name specified in the parameter has only one color channel and is monochrome (it doesn't have a lookup color table).

At the moment, only the color space names "MONOCHROME1" and "MONOCHROME2" indicate a monochrome color space.

Parameters:
colorSpacethe name of the color space to be tested
Returns:
true if the color space indicated in the parameter is monochrome, or false otherwise
bool puntoexe::imebra::transforms::colorTransforms::colorTransformsFactory::isSubsampledX ( std::wstring  colorSpace) [static]

Returns true if the name of the color space specified in the parameter indicates that the chrominance channels are subsampled horizontally.

Parameters:
colorSpacethe name of the color space to be tested
Returns:
true if the name of the color space in the parameter colorSpace has the chrominance channels subsampled horizontally
bool puntoexe::imebra::transforms::colorTransforms::colorTransformsFactory::isSubsampledY ( std::wstring  colorSpace) [static]

Returns true if the name of the color space specified in the parameter indicates that the chrominance channels are subsampled vertically.

Parameters:
colorSpacethe name of the color space to be tested
Returns:
true if the name of the color space in the parameter colorSpace has the chrominance channels subsampled vertically
std::wstring puntoexe::imebra::transforms::colorTransforms::colorTransformsFactory::makeSubsampled ( std::wstring  colorSpace,
bool  bSubsampleX,
bool  bSubsampleY 
) [static]

Add the subsamplig information to a color space name.

Only the color spaces for which canSubsample() returns true can have the subsampling information.

Parameters:
colorSpacethe name of the color space to which the subsampling information should be added
bSubsampleXif true, then the function will make the color space subsampled horizontally. The color space will also be subsampled vertically
bSubsampleYif true, then the function will make the color space subsampled vertically
Returns:
the color space name subsampled as specified
std::wstring puntoexe::imebra::transforms::colorTransforms::colorTransformsFactory::normalizeColorSpace ( std::wstring  colorSpace) [static]

Normalize a color space name.

The function converts all the chars to uppercase and remove additional information from the color space.

For instance, the color space "ybr_full_420" is converted to "YBR_FULL".

Parameters:
colorSpacethe color space name to be normalized
Returns:
the normalized color space name

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