LImageViewerCell::EnableLowMemoryUsageCallBack

#include "ltwrappr.h"

L_BOOL LImageViewerCell::EnableLowMemoryUsageCallBack(bEnable)

Enables or disables the LImageViewerCell::LowMemoryUsageCallBack function.

Parameters

L_BOOL bEnable

Flag that indicates whether to enable or disable the LImageViewerCell::LowMemoryUsageCallBack function. Possible values are:

Value Meaning
TRUE Enable the LImageViewerCell::LowMemoryUsageCallBack function.
FALSE Disable the LImageViewerCell::LowMemoryUsageCallBack function.

Returns

The previous setting.

Comments

Call this function to enable or disable the Low Memory Usage callback overridable function for your class object. This will enable or disable the callback functions, which exist in the calling object.

Required DLLs and Libraries

See Also

Functions

Topics

Example

This example shows how to use the low memory usage feature to display a medical image with multiple pages. it will also invert all the bitmap to show the invert function works even if the bitmap is not loaded yet.

#ifdef LImageViewerChild  
class LImageViewerChild :public LImageViewerCell 
{ 
   virtual L_INT FramesRequestedCallBack (L_INT    nCellIndex, 
                                          L_UINT * puFramesRequested, 
                                          L_UINT   uLength); 
}; 
#endif 
 
L_INT LImageViewerChild::FramesRequestedCallBack (L_INT    nCellIndex, 
                               L_UINT * puFramesRequested, 
                               L_UINT   uLength) 
{ 
   UNREFERENCED_PARAMETER(nCellIndex); 
   L_INT nI; 
   LOADFILEOPTION LoadOption; 
   BITMAPHANDLE * pBitmap; 
   LBitmap        BitmapHandles; 
   pBITMAPHANDLE  pBitmapHandle; 
 
   if (uLength == 0) 
      return 0; 
 
   LBaseFile::GetDefaultLoadFileOption(&LoadOption, sizeof(LOADFILEOPTION)); 
 
   pBitmap = (pBITMAPHANDLE)malloc(sizeof(BITMAPHANDLE) * uLength); 
 
   for (nI = 0; nI < (L_INT)uLength; nI++) 
   { 
      LoadOption.PageNumber = puFramesRequested[nI]; 
      BitmapHandles.Load(MAKE_IMAGE_PATH(TEXT("image1.dcm")), 0, ORDER_BGRORGRAY, &LoadOption, NULL); 
 
      pBitmapHandle = BitmapHandles.GetHandle(); 
 
      memcpy(&pBitmap[nI], pBitmapHandle, sizeof(BITMAPHANDLE)); 
      BitmapHandles.SetHandle(NULL, FALSE); 
   } 
 
   SetRequestedImage(pBitmap, (L_INT *) puFramesRequested, uLength, 0); 
   return SUCCESS; 
} 
 
L_INT LImageViewer_EnableCellLowMemoryUsageExample(LImageViewer& ImageViewer) 
{ 
   FILEINFO                 FileInfo; 
   pDISPCONTAINERBITMAPINFO pBitmapInfo; 
   L_INT                    nI, nRet; 
   LBitmapBase             LeadBitmap; 
   LFile                  LeadFile; 
 
   LeadFile.SetBitmap(&LeadBitmap) ; 
   LeadFile.SetFileName(MAKE_IMAGE_PATH(TEXT("image1.dcm"))); 
 
   nRet = LeadFile.GetInfo(&FileInfo, sizeof(FILEINFO)) ; 
   if(nRet != SUCCESS) 
      return nRet; 
 
   pBitmapInfo = (DISPCONTAINERBITMAPINFO *)malloc(sizeof(DISPCONTAINERBITMAPINFO) * FileInfo.TotalPages); 
 
   for (nI = 0; nI < FileInfo.TotalPages; nI++) 
   { 
      pBitmapInfo[nI].uHeight = FileInfo.Height; 
      pBitmapInfo[nI].uWidth = FileInfo.Width; 
      pBitmapInfo[nI].uXResolution = FileInfo.XResolution; 
      pBitmapInfo[nI].uYResolution = FileInfo.YResolution; 
   } 
 
   LImageViewerCell * ImageViewerCell = new LImageViewerCell(); 
 
   ImageViewerCell->Create(ImageViewer.GetWindowHandle(0), 0); 
 
   ImageViewer.InsertCell(ImageViewerCell->GetWindowHandle(0), 0, 0); 
 
   ImageViewerCell->EnableLowMemoryUsageCallBack(TRUE); 
 
   ImageViewerCell->EnableCellLowMemoryUsage(0, 
                                             FileInfo.TotalPages, 
                                             pBitmapInfo, 
                                             0); 
 
   // invert all the frames in the cell. 
 
   for (nI = 0; nI < FileInfo.TotalPages; nI ++) 
   { 
      ImageViewerCell->InvertBitmap(nI, 0); 
   } 
 
   return SUCCESS; 
} 

Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Medical Image Viewer C++ Class Library Help