In order to identify a DICOM file-set, and to facilitate accessing the information stored in the DICOM files of the file-set, the DICOM standard has defined the Basic Directory IOD. A DICOM file-set contains one or more DICOM files. One of the files contained in the file-set is the DICOMDIR file. The DICOMDIR file contains Dicom Directory information, which makes it easier to access the information contained in the other DICOM files in the file-set. The DICOM files in the file-set are assigned File IDs, so that they can be referenced by the DICOMDIR File, which itself, is identified by a File ID of DICOMDIR.
LEADTOOLS provides the DicomDir class to simplify the process of creating DICOM Directories for file-sets.
As a demonstration of a typical usage of the DicomDir class, let's suppose that we need to build the DICOM Directory of the file-set defined by the files contained in the folder "C:\DICOM Images\" and in any subfolders. This folder is then the destination folder of the DICOMDIR File.
At the beginning of the application, the destination folder should be specified. This can be done either at construction time or later by using the method DicomDir.Reset.
Only the DICOM files within the destination folder (e.g., "C:\DICOM Images\Brain") or in a subfolder of this folder (e.g., "C:\DICOM Images\Patient1\Series1\Knee") can be added to the Dicom Directory. The File ID, which is used by the Dicom Directory to reference an added file, will be the relative path of the file. For instance, the File IDs of the two previous files would be "Brain" and "Patient1\Series1\Knee", respectively.
A DICOM file can be added to the Dicom Directory in one of two ways:
The method DicomDir.SetFileSetId can be used to identify the file-set by providing a simple humanly readable identifier. Also, the method DicomDir.SetDescriptorFile can be used to specify a descriptor file (a "readme" file) for the file-set.
The DicomDir.Options property lets you get or set certain options that affect the behavior of the methods of the class.
Once the DICOM Directory is ready, the method DicomDir.Save can be called to create the DICOMDIR File and store the directory information. The DICOMDIR File is named "DICOMDIR" and is saved in the destination folder ("C:\DICOM Images\DICOMDIR").
The method DicomDir.Load can be used to load the DICOM Directory Data Set stored in an existing DICOMDIR file. The loaded DICOM Directory can then be manipulated using the various methods. For instance, additional DICOM files can be added to the DICOM Directory.
This topic provides information about high-level "Basic Directory" support. For information on low-level Basic Directory Key Element support, refer to Working with Basic Directory Key Elements.