#include "ltwrappr.h"
virtual L_INT LBitmapBase::ConvertSignedToUnsigned(uShift, uFlags = 0)
L_UINT uShift; |
shifting option |
L_UINT32 uFlags; |
flag |
Converts the signed class object's bitmap to an unsigned one.
Parameter | Description | |
uShift | Flag that indicates how the shift will be done. Possible values are: | |
Value | Meaning | |
SHIFT_ZERO_TO_CENTER | [0] Shift by 32768 (16-bit images) or by 2048 (12-bit images) | |
SHIFT_MIN_TO_ZERO | [1] Shift all image data to make minimum value in the image 0 and the maximum value to the maximum possible value (65535 for 16-bit, 4095 for 12-bit). | |
SHIFT_NEG_TO_ZERO | [2] Set all the negative pixels to 0 and leave the positive pixels unchanged. (Achieves the same result as LBitmapBase::ClearNegativePixels). | |
uFlags | Reserved for future use. Must be 0. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
If the ELO_SIGNED flag has been set using LOADFILEOPTION, when a file is loaded, the bitmap may contain negative pixel values and LEADTOOLS will paint/process the image incorrectly. To use this bitmap correctly the negative pixels should be converted, if it contains negative pixels (if LBitmapBase::IsPixelsSigned returns TRUE).
If LBitmapBase::IsPixelsSigned returns TRUE, this function will shift the color values in the class object's bitmap according to the uShift parameter.
The function will also update the MinVal and MaxVal members of the BITMAPHANDLE.
This function supersedes LBitmapBase::ClearNegativePixels.
This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.
This function supports signed data images.
Required DLLs and Libraries
LTIMG For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64.
Functions: |
|
Topics: |
|
|
L_INT LBitmapBase__ConvertSignedToUnsignedExample(LBitmapBase & Bitmap, L_TCHAR * pszFile)
{
L_INT nRet;
LOADFILEOPTION LoadFileOption;
// Enable negative pixels
LBaseFile::GetDefaultLoadFileOption(&LoadFileOption,sizeof(LOADFILEOPTION));
LoadFileOption.Flags |= ELO_SIGNED;
nRet =Bitmap.Load(pszFile, 0, ORDER_BGRORGRAY, &LoadFileOption);
if(nRet !=SUCCESS)
return nRet;
// Clear negative pixels if the bitmap is signed
if (Bitmap.IsPixelsSigned())
Bitmap.ConvertSignedToUnsigned(SHIFT_NEG_TO_ZERO);
else
return FAILURE;
return SUCCESS;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET