|
|
CTransformation provides methods for selecting channels from the source image for the operation. The single- or multi-channel operation will only be executed on the selected channels.
For implementing single-channel operations, the user has to derive an object from CTransformation and overwrite singleChannelOp. While calling the method exec() of the derived object, singleChannelOp is called successively for each selected channel. The data to transform is passed as a reference on a temporary single-channel image. For implementing multi-channel operations, the user has to overwrite the method multiChannelOp. This method is called once by exec(). Only the selected channels are passed to multiChannelOp by a reference to a multi-channel image. In both cases, the second argument is a reference on a single-channel image of the same width and height as the source image. This image has to be filled with the operation result.
Single channel transformation:
Multi channel transformation:
bool * pbMask | pbMask |
[protected]
bool bMultiChannelOp | bMultiChannelOp |
[protected]
const CImage | pSource |
[protected]
CImage | pTarget |
[protected]
int iSelectedChannels | iSelectedChannels |
[protected]
int iDepth | iDepth |
[protected]
CTransformation ()
| CTransformation |
Constructor
~CTransformation ()
| ~CTransformation |
[virtual]
Destructor
void setInput (const CImage | setInput |
Specifies the source image for the transformation.
Parameters:
tSrc | Image to be transformed |
int depth ()
| depth |
[const]
Return depth of images that will be accepted for transformation
Returns: depth
void setOutput (CImage | setOutput |
Specifies the target image for the transformation.
Parameters:
tTgt | Image to be filled with transformed data |
void setMutliChannelOp (bool bMultiChannelOp)
| setMutliChannelOp |
Specifies whether the operation should be performed successively for each channel or once comprising all channel data. Note that it is up to the user whether he implements the transformation as single-channel, multi-channel or both.
void setMask (bool* pbMask)
| setMask |
Selects/Deselects some channels for the transformation. The mask has to be of the same dimension as the number of channels of the input image. If the mask is not set manually, all channels will be selected initially.
Parameters:
pbMask | Array of bool values |
void resetMask ()
| resetMask |
Resets all channel selections (all channels become selected).
void selectChannel (int iChannel, bool bSelect)
| selectChannel |
Selects/Deselects a specific channel for the transformation
Parameters:
iChannel | Index of Channel to be selected/deselected |
bSelect | New selection of the specified channel |
int selectChannel (char* pcCommand)
| selectChannel |
Selects/Deselects channels using a command string
Parameters:
pcCommand | Command string |
Returns: Return 1 if string defines a legal selection, otherwise 0.
int selected ()
| selected |
[const]
Returns the number of selected channels
Returns: Number of selected channels
bool isSelected (int iChannel)
| isSelected |
[const]
Checks if a channels is selected.
Parameters:
iChannel | Index of channel to check. |
Returns: True if channel is selected, else false
void exec ()
| exec |
Executes the transformation. The methode invokes the following methodes in the following order:
void multiChannelOperation (const CImage | multiChannelOperation |
[protected virtual]
Implemetation of a multi-channel transformation algorithm. This methode is called once by exec(). The image tSrc contains only channels selected for processing. The result of the operation has to be written in tTgt. By default, tTgt is a refence to an single-channel image with width and height equal to tSrc. While the user can change the number of channels of tTgt, he must not change the width and height.
Parameters:
tSrc | Multi-channel image with source data. |
tTgt | Single-channel image for operation result. |
void singleChannelOperation (const CImage | singleChannelOperation |
[protected virtual]
Implemetation of a single-channel transformation algorithm. This methode is called once for each selected channel iChannel by the method exec(). The source data for each operation is passed via tSrc. The operation result has to be written in tTgt.
Parameters:
tSrc | Single-channel image with source data. |
tTgt | Single-channel image for operation result. |
void preOperation ()
| preOperation |
[protected pure virtual]
This methode is called immediately after the invokation of exec(). If the data needs preprocessing (depth convertation, etc.) before the transformation, place the corresponding code in this methode.
void postOperation ()
| postOperation |
[protected pure virtual]
This methode is called at the end of exec(). If the data needs processing (depth convertation, etc.) after the transformation place the corresponding code in this methode.