|
imebra
build 2011-09-18_22-24-41
|
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>
Public Member Functions | |
Color space conversion | |
Return the transform that convert one color space into another | |
| ptr< colorTransform > | 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. | |
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. | |
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.
| 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.
| colorSpace | the name of the color space to be tested |
| 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.
| 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.
| colorSpace | the name of the color space for which the number of channels must be returned |
| 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.
| startColorSpace | the color space from which the conversion has to take place |
| endColorSpace | the color space resulting from the conversion |
| 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.
| colorSpace | the name of the color space to be tested |
| 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.
| colorSpace | the name of the color space to be tested |
| 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.
| colorSpace | the name of the color space to be tested |
| 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.
| colorSpace | the name of the color space to which the subsampling information should be added |
| bSubsampleX | if true, then the function will make the color space subsampled horizontally. The color space will also be subsampled vertically |
| bSubsampleY | if true, then the function will make the color space subsampled vertically |
| 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".
| colorSpace | the color space name to be normalized |