views:

25

answers:

2

I want to read dicom tags from dicomdir. How can i check if file is a dicomdir? Now, i'm trying like that, but i know that some files haven't dicomdir in name.

     if (fi_name.Contains("DICOMDIR"))
            {


                DicomDirectory fi_dicomdir = new DicomDirectory(fi);
                fi_dicomdir.Load(fi);
             }
A: 

NEMA publication states that the file name must be DICOMDIR. the DICOM file type can be also identified by the unique SOP class ID: 1.2.840.10008.1.3.10 which is reserved for these file type.

a soft copy of the standard can be found here

Alon
A: 

Since a DICOMDIR is specialized instance of a DICOM Part 10 file, you could read just up to the Media Storage SOP Class UID tag of the file (which would only be a few hundred bytes of the file), and then determine if the file is a DICOMDIR. Code like this would work:


DicomFile file = new DicomFile(fi);
file.Load(DicomTags.MediaStorageSopClassUid, DicomReadOptions.Default);
if (file.MediaStorageSopClassUid.Equals(SopClass.MediaStorageDirectoryStorageUid))
{
    DicomDirectory fi_dicomdir = new DicomDirectory("AETITLE");
    fi_dicomdir.Load(fi);                
}

This should perform fast and would be a fool proof way to determine if the file is a DICOMDIR.

Steve Wranovsky