LDicomDir::OnInsertDicomFile

#include "Ltdic.h"

virtual L_UINT16 LDicomDir::OnInsertDicomFile(pszFileName, pDataSet, uStatus)

const L_TCHAR* pszFileName;

name of the file being processed

LDicomDS* pDataSet;

pointer to an LDicomDS object

L_UINT16 uStatus;

status code

Called for each DICOM file enumerated by LDicomDir::InsertDicomFile.

Parameter Description
pszFileName Character string that contains the name of the file being added to the DICOM Directory.
pDataSet Pointer to an LDicomDS object that specifies the Data Set contained by the DICOM file being processed. If the Data Set wasnt loaded successfully, this parameter is set to NULL.
uStatus The status code. Possible values are:
  Value Meaning
  DICOMDIR_INSERTDICOMFILE_PREADD [300] The Data Set in the file was loaded successfully and the file is about to be added to the DICOM Directory.
  DICOM_SUCCESS [0] The file has been added successfully to the DICOM Directory.
  Any other value [> 0] An error occurred. Refer to Return Codes.

Returns

0

The function was successful.

> 0

An error occurred. Refer to Return Codes.

Comments

If the parameter passed to LDicomDir::InsertDicomFile is NULL, then all files in the destination folder will be enumerated. If the bIncludeSubfolders member of a DICOMDIROPTIONS structure is set to TRUE and set using LDicomDir::SetOptions, and then LDicomDir::InsertDicomFile is called with pszFileName set to NULL, then all files in the destination folder and all files in all of the subfolders of the destination folder will be enumerated. For each file, the callback function OnInsertDicomFile is called once or twice:

If the callback function returned a value other than DICOM_SUCCESS or DICOM_ERROR_FORMAT, the function LDicomDir::InsertDicomFile will stop adding new files and will return the same value returned by the callback function. Therefore, to keep adding the DICOM files, the callback function should return DICOM_SUCCESS, or DICOM_ERROR_FORMAT if only the current file is to be skipped (which can be done during the first call).

The function LDicomDir::InsertDicomFile will stop adding new files if an error occurred and it will return an error value.

The implementation of the LDicomDir class for the function OnInsertDicomFile simply returns DICOM_SUCCESS. In order to make use of this callback function, you should create a new class derived from the LDicomDir class and override the function OnInsertDicomFile providing the desired implementation.

Required DLLs and Libraries

LTDIC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

Platforms

Win32, x64

See Also

Functions:

LDicomDir::InsertDicomFile, Class Members

Topics:

Creating DICOM Directories

 

Dicom Directories

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
class LUserDicomDir : public LDicomDir 
{ 
public: 
LUserDicomDir(L_TCHAR* pszDICOMDIRDstFolder = NULL, L_TCHAR* pszPath = NULL) : 
   LDicomDir(pszDICOMDIRDstFolder, pszPath) { } 
   L_UINT16 OnInsertDicomFile(const L_TCHAR* pszFileName, LDicomDS* pDataSet, L_UINT16 uStatus) 
   { 
      UNREFERENCED_PARAMETER(pDataSet); 
      L_TCHAR szBuffer[512]; 
      if (uStatus == DICOMDIR_INSERTDICOMFILE_PREADD) 
      { 
         wsprintf(szBuffer, TEXT("About to add the file \"%s\".\n\nProceed?"), pszFileName); 
         switch (MessageBox(NULL, szBuffer, TEXT("DICOM Directory Sample"), MB_YESNOCANCEL)) 
         { 
            case IDYES: // Add the file 
            break; 
            case IDNO: // Skip the file 
            return DICOM_ERROR_FORMAT; 
            case IDCANCEL: // Abort 
            return DICOM_ERROR_END; 
         } 
      } 
      else if (uStatus == DICOM_SUCCESS) 
      { 
         wsprintf(szBuffer, TEXT("The file \"%s\" has been added successfully.\n\nContinue?"), pszFileName); 
         switch (MessageBox(NULL, szBuffer, TEXT("DICOM Directory Sample"), MB_YESNO)) 
         { 
            case IDYES: // Continue 
            break; 
            case IDNO: // Abort 
            return DICOM_ERROR_END; 
         } 
      } 
      return DICOM_SUCCESS; 
   } 
}; 
L_INT LDicomDir_OnInsertDicomFileExample() 
{ 
   L_INT nRet; 
   LUserDicomDir DicomDir(MAKE_IMAGE_PATH(TEXT(""))); 
   // Add all the DICOM files to the Directory 
   nRet = DicomDir.InsertDicomFile(NULL); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
   // Save the DICOMDIR File 
   nRet = DicomDir.SaveDicomDir(); 
   if(nRet != DICOM_SUCCESS) 
      return nRet; 
   return DICOM_SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS DICOM C++ Class Library Help