CustomProcess_Initialize Function
Applies To: Implementing a custom process
Sets up the process and returns the output properties.
This function gets the information pertaining to the input raster in the form of a CustomRasterInfo object. It then changes the same object to reflect the properties of the processed raster.
[C++]
CustomProcess_API BOOL __stdcall CustomProcess_Initialize(void* clientHandle,
void* rasterInfo);
Arguments
[in] clientHandle
Unique ID used to identify the caller.
[in,out] rasterInfo
Input image information in the form of a CustomRasterInfo object.
This has to be changed to reflect properties of the processed raster.
Return Value
A Boolean value signifying successful initialization.
Reporting errors and warnings: A false return value can be regarded as an error which can be obtained by calling the GetLastError function which will give out the error message for the last error in the DLL.
Example
The following example represents a partial C++ implementation of this function:
[C++]
typedef struct
{
unsigned long Rows;
unsigned long Cols;
unsigned long BandsPerPixel;
unsigned long BitsPerBand;
enum CustomProcess_ColorSpaceValue ColorSpace;
enum CustomProcess_PixelDataValue DataType;
unsigned short** ColorMap;
}CustomRasterInfo;
CustomProcess_API BOOL __stdcall CustomProcess_Initialize(void* clientHandle,
void* rasterInfo)
{
ClientHandle* myClientHandle = (ClientHandle*)clientHandle;
myClientHandle->myOutputRasterInfo = (CustomRasterInfo*)rasterInfo;
if(myClientHandle->myOutputRasterInfo->BandsPerPixel < 5)
{
strcpy_s(myClientHandle->errorString, 2048,
"Not enough bands to process Image");
return FALSE;
}
if(myClientHandle->myOutputRasterInfo->BitsPerBand != 8)
{
strcpy_s(myClientHandle->errorString, 2048,
"Process only works on 8 bit Imagery");
return FALSE;
}
myClientHandle->myOutputRasterInfo->BandsPerPixel = 3;
return TRUE;
}
For a detailed example on how to implement this function, see Sample custom process.
Related Topics
See also: CustomProcess_Create, CustomProcess_SetWindow, CustomProcess_GetRow, CustomProcess_GetMetadata, CustomProcess_GetLastError, CustomProcess_Cleanup, CustomProcess_SetCallbackFunctions, CustomProcess_SetAreaOfInterest, CustomProcessUI_Init, CustomProcessUI_ShowModalDialog, CustomProcessUI_GetUpdatedXML, CustomProcessUI_GetStatus, CustomProcessUI_GetProperty, CustomProcessUI_SetProperty, CustomProcessUIForm_GetUpdatedXML, CustomProcessUIForm_Init