L_INT LBitmap::ShiftMinimumToZero(puShiftAmount, uFlags = 0)
Converts the signed bitmap to an unsigned bitmap by increasing or shifting the bitmap's intensity values, so the lowest intensity value (the most negative value) will be shifted to zero.
Pointer to a variable to be updated with the value by which the intensity values were shifted.
Reserved for future use. Must be 0.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function is similar to LBitmap::ConvertSignedToUnsigned. However, LBitmap::ShiftMinimumToZero updates the puShiftAmount parameter with the value by which the intensity values were shifted.
The LBitmap::ShiftMinimumToZero and LBitmap::ShiftZeroToNegative functions are most often used in concert with one or more image processing or analysis functions. LBitmap::ShiftMinimumToZero converts signed data to unsigned data, in preparation for some image processing or analysis. (Most image processing functions work only on unsigned data.) After the image processing or analysis is performed, LBitmap::ShiftZeroToNegative converts the unsigned data back to signed data.
This function updates the "Flags.Signed", "MinVal" and "MaxVal" members of the class objects BITMAPHANDLE member; a pointer obtained by calling LBitmapBase::GetHandle function.
This function doesn't support 8-bit images.
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.
This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.
Win32, x64.
L_INT LBitmap__ShiftMinimumToZeroExample()
{
// This function will apply LBitmap::MultiScaleEnhancementBitmap on a signed image,
// but since LBitmap::MultiScaleEnhancementBitmap doesn't support signed images,
// we will convert the image to unsigned image, apply the effect,
// and then convert it back to signed image.
L_UINT nShiftAmount;
LBitmap LeadBitmap;
L_INT nRet;
LOADFILEOPTION LoadFileOption;
/* enable negative pixels to be loaded from TIFF files */
nRet =LBaseFile::GetDefaultLoadFileOption(&LoadFileOption, sizeof(LoadFileOption));
if(nRet !=SUCCESS)
return nRet;
LoadFileOption.Flags |= ELO_SIGNED;
/* Load the bitmap, keeping the bits per pixel of the file */
nRet =LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("signed-test.tif")), 0, ORDER_BGRORGRAY, &LoadFileOption, NULL);
if(nRet !=SUCCESS)
return nRet;
// Convert the bitmap to unsigned bitmap by shifting the negative values to become positive.
nRet =LeadBitmap.ShiftMinimumToZero(&nShiftAmount);
if(nRet !=SUCCESS)
return nRet;
// Apply multiscale enhancement
nRet =LeadBitmap.MultiScaleEnhancement(2000, 4, MSE_DEFAULT, 0, 0, MSE_GAUSSIAN | MSE_EDGEENH);
if(nRet !=SUCCESS)
return nRet;
// Convert the bitmap back to signed by shifting the same amount in the negative side.
nRet =LeadBitmap.ShiftZeroToNegative( nShiftAmount, -32767, 32766, 0, 65535);
if(nRet !=SUCCESS)
return nRet;
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document