Creating a DICOM Directory (Delphi)
//global
LEADDicomDir1: TLEADDicomDir;
LEADDicomFactory1: TLEADDicomFactory;
Procedure TForm1.CreateDicomDirectory();
var
strLic: String;
DicomKernel: LEADDicomKernel;
begin
strLic:= 'LEADTOOLS OCX Copyright (c)' + ' 1991-2005 LEAD Technologies, Inc.';
DicomKernel:= LEADDicomFactory1.CreateObject ('LEADDicomKernel.LEADDicomKernel', strLic) as ILEADDicomKernel;
DicomKernel.UnlockSupport (L_SUPPORT_MEDICAL, L_KEY_MEDICAL);
if(DicomKernel.IsSupportLocked (L_SUPPORT_MEDICAL))then
begin
Application.MessageBox('Medical Support must be unlocked for this demo!','Error', MB_OK + MB_ICONEXCLAMATION);
Application.Terminate();
end;
// Set the destination folder
LEADDicomDir1.ResetDicomDir ('C:\Medical Images\Patient 1');
// If it is desired to change the Implementation Class UID and
// the Implementation Version Name...
LEADDicomDir1.ImplementationClassUID:= '1.2.840.114257.0.1';
LEADDicomDir1.ImplementationVersionName:= 'LEADTOOLS 14.5';
// Set the File-set Identifier
LEADDicomDir1.SetFileSetID ('SOME ID');
// We need icon images to be added
LEADDicomDir1.InsertIconImageSequence:= True;
// Don’t allow invalid File IDs
LEADDicomDir1.RejectInvalidFileID:= True;
// Set the File-set descriptor file
LEADDicomDir1.SetDescriptorFile('C:\Medical Images\Patient 1\ReadMe', '');
// Enable generating runtime exceptions
LEADDicomDir1.EnableMethodErrors:= True;
// Add some DICOM files to the Directory
LEADDicomDir1.InsertDicomFile ('C:\Medical Images\Patient 1\Image1');
LEADDicomDir1.InsertDicomFile('C:\Medical Images\Patient 1\Image2');
LEADDicomDir1.InsertDicomFile('C:\Medical Images\Patient 1\Image3');
// Disable generating runtime exceptions
LEADDicomDir1.EnableMethodErrors:= False;
// Save the DICOMDIR File
LEADDicomDir1.SaveDicomDir ();
end;