L_DicomEnableOptimizedMemorySend

#include "ltdic.h"

L_LTDIC_API L_VOID L_DicomEnableOptimizedMemorySend(hNet, bEnabled)

Enables or disables the use of optimized memory when sending files.

Parameters

HDICOMNET hNet

Handle to an existing DICOM Network. This is the handle returned from the L_DicomCreateNet function.

L_BOOL bEnabled

Flag that enables or disables the use of optimized memory when sending files.

Value Meaning
TRUE Enables the use of optimized memory when sending large files.
FALSE Disables the use of optimized memory when sending large files.

Returns

Value Meaning
DICOM_SUCCESS The function was successful.
>0 An error occurred. Refer to Return Codes.

Comments

It is possible for the toolkit to allocate large memory buffers when sending a large file to a server. Use this function to control whether to optimize memory useage to the minimum possible.

Note: The security mode (the nMode parameter used when calling L_DicomCreateNet or L_DicomCreateNetExt) must be set to DICOM_SECURE_NONE in order for this function to work.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

#include <memory.h> 
 
 
L_INT DicomL_DicomEnableOptimizedMemorySendExample(HDICOMNET hNet, HWND hWnd) 
{ 
   L_TCHAR * pszClass=NULL; 
   L_TCHAR * pszInstance=NULL; 
   L_TCHAR    szMsg[200]; 
   L_TCHAR    szFilter[100]= TEXT("AllFiles (*.*)\0*.*\0Dicom Files (*.dcm)\0*.dcm\0\0"); 
   L_UCHAR   nID; 
   HDICOMPDU hPDU; 
   OPENFILENAME OpenFileName; 
   L_TCHAR    szFile[MAX_PATH] = TEXT("\0"); 
   L_INT nRet; 
   HDICOMDS hDS=NULL; 
   pDICOMELEMENT pElement=NULL; 
   OPENDLGPARAMS DlgParams; 
 
    
   /* send a store request to the server */ 
    
   hPDU = L_DicomGetAssociate(hNet); 
    
   /* pick the data set to send */ 
   lstrcpy( szFile, TEXT("")); 
 
   memset ( &OpenFileName, 0, sizeof ( OPENFILENAME ) ) ; 
   memset ( &DlgParams, 0, sizeof ( OPENDLGPARAMS ) ) ; 
 
 
   OpenFileName.lStructSize       = sizeof(OPENFILENAME); 
   OpenFileName.hwndOwner         = hWnd; 
   OpenFileName.lpstrFilter       = szFilter; 
   OpenFileName.lpstrCustomFilter = NULL; 
   OpenFileName.nMaxCustFilter    = 0; 
   OpenFileName.nFilterIndex      = 0; 
   OpenFileName.lpstrFile         = szFile; 
   OpenFileName.nMaxFile          = sizeof(szFile); 
   OpenFileName.lpstrFileTitle    = NULL; 
   OpenFileName.nMaxFileTitle     = 0; 
   OpenFileName.lpstrInitialDir   = NULL; 
   OpenFileName.lpstrTitle        = TEXT("Pick a Dicom Data Set"); 
   OpenFileName.nFileOffset       = 0; 
   OpenFileName.nFileExtension    = 0; 
   OpenFileName.lpstrDefExt       = NULL; 
   OpenFileName.lpfnHook          = NULL; 
   OpenFileName.Flags             = 0; 
 
   DlgParams.uStructSize = sizeof ( OPENDLGPARAMS ) ; 
   DlgParams.pfnFileLoadCallback = NULL ; 
 
   DlgParams.uDlgFlags = DLG_OPEN_SHOW_PROGRESSIVE     | 
                         DLG_OPEN_SHOW_FILEINFO        | 
                         DLG_OPEN_SHOW_PREVIEW         | 
                         DLG_OPEN_SHOW_DELPAGE         | 
                         DLG_OPEN_SHOW_LOADOPTIONS     | 
                         DLG_OPEN_LOADBITMAP           ; 
 
   nRet = L_DlgOpen (hWnd, &OpenFileName, &DlgParams); 
 
   if( SUCCESS_DLG_OK == nRet ) 
   { 
      /* load the data set */ 
      hDS = L_DicomCreateDS(NULL); 
      nRet = L_DicomLoadDS(hDS, szFile, 0); 
      if(nRet != DICOM_SUCCESS) 
      { 
         MessageBox(NULL, TEXT("Error Loading Data Set!"), TEXT("Error"), MB_OK); 
         L_DicomFreeDS(hDS); 
         return nRet; 
      } 
       
      pElement = L_DicomFindFirstElement(hDS, NULL, TAG_SOP_INSTANCE_UID, FALSE); 
      pszInstance = L_DicomGetStringValue(hDS, pElement, 0, 1); 
       
      pElement = L_DicomFindFirstElement(hDS, NULL, TAG_SOP_CLASS_UID, FALSE); 
      pszClass = L_DicomGetStringValue(hDS, pElement, 0, 1); 
       
      /* send the command set */ 
      nID = L_DicomFindAbstract(hPDU, pszClass); 
      if(nID == 0) 
      { 
         wsprintf(szMsg, TEXT("Abstract Syntax %s Not Supported by Association!"), pszClass); 
         MessageBox(NULL, szMsg, TEXT("Error"), MB_OK); 
      } 
      else 
      { 
         L_DicomEnableOptimizedMemorySend(hNet, L_TRUE); 
         /* now, use the high-level method to send the command set */ 
         nRet = L_DicomSendCStoreRequest(hNet, nID, 1, pszClass, pszInstance, COMMAND_PRIORITY_MEDIUM, TEXT(""), 0, hDS); 
         if (nRet != DICOM_SUCCESS) 
         { 
            L_DicomFreeDS(hDS); 
            return nRet; 
         } 
      } 
      L_DicomFreeDS(hDS); 
   } 
   return DICOM_SUCCESS; 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.