Creating a DICOM Directory for Visual Basic
Private Sub CreateDicomDirectory()
Dim DicomDir As New LEADDicomDir
Dim DicomFactory As New LEADDicomFactory
Dim DicomKernel As LEADDicomKernel
Dim strLic As String
strLic = "LEADTOOLS OCX Copyright (c)" + _
" 1991-2005 LEAD Technologies, Inc."
Set DicomKernel = _
DicomFactory.CreateObject("LEADDicomKernel.LEADDicomKernel", strLic)
DicomKernel.UnlockSupport L_SUPPORT_MEDICAL, L_KEY_MEDICAL
If DicomKernel.IsSupportLocked(L_SUPPORT_MEDICAL) Then
MsgBox "Medical Support must be unlocked for this demo!", _
vbExclamation
Exit Sub
End If
' Set the destination folder
DicomDir.ResetDicomDir "C:\Medical Images\Patient 1"
' If it is desired to change the Implementation Class UID and
' the Implementation Version Name...
DicomDir.ImplementationClassUID = "1.2.840.114257.0.1"
DicomDir.ImplementationVersionName = "LEADTOOLS 14.5"
' Set the File-set Identifier
DicomDir.SetFileSetID "SOME ID"
' We need icon images to be added
DicomDir.InsertIconImageSequence = True
' Don't allow invalid File IDs
DicomDir.RejectInvalidFileID = True
' Set the File-set descriptor file
DicomDir.SetDescriptorFile "C:\Medical Images\Patient 1\ReadMe", ""
' Enable generating runtime exceptions
DicomDir.EnableMethodErrors = True
' Add some DICOM files to the Directory
DicomDir.InsertDicomFile "C:\Medical Images\Patient 1\Image1"
DicomDir.InsertDicomFile "C:\Medical Images\Patient 1\Image2"
DicomDir.InsertDicomFile "C:\Medical Images\Patient 1\Image3"
' Disable generating runtime exceptions
DicomDir.EnableMethodErrors = False
' Save the DICOMDIR File
DicomDir.SaveDicomDir
End Sub