1

I'm trying to locate DICOM filepaths by parsing a DICOMDIR.

But can't seem to figure out how to locate them. I parse through the DICOMDIR as follows:

DicomDirectory dir = new DicomDirectory("AE_TITLE");
dir.Load(dirPath);
foreach(DirectoryRecordSequenceItem elem in dir.RootDirectoryRecordCollection){//study
    foreach(DirectoryRecordSequenceItem innerElem in elem.LowerLevelDirectoryRecordCollection){//sequence
        foreach(DirectoryRecordSequenceItem inner2Elem in innerElem.LowerLevelDirectoryRecordCollection){//series
            foreach (DirectoryRecordSequenceItem inner3Elem in lastElem.LowerLevelDirectoryRecordCollection) // img
            {

            } 
        }
    }
}

this loops through the each study/sequence/series/image but non of these seem to contain a filepath to a .dcm file.

P.S. I use the ClearCanvas library to create the DicomDirectory object

jophab
  • 5,356
  • 14
  • 41
  • 60
TCulos
  • 183
  • 3
  • 13

1 Answers1

1

It appears that if you go to the lowest level (image level) the dicomfile has an attribute ReferencedFileId which holds the relative path so all that was needed is:

Console.inner3Elem.GetAttribute(DicomTags.ReferencedFileId).ToString();

This returns the path to the dicom file relative to where the DICOMDIR is located

TCulos
  • 183
  • 3
  • 13
  • 1
    Please note that Referenced File ID (0004,1500) representing the ordered components of the File ID of Referenced SOP Instance can be multi-value component. It can have maximum of 8 components and each component can be 1 to 8 characters. A character 5CH (BACKSLASH "\" in the case of DICOM default repertoire) is used as a delimiter between each components. As for example a four component DICOM File ID separated by backslashes is:SUBDIR1\SUBDIR2\SUBDIR3\XYZ-ABCD – LEADTOOLS Support Aug 27 '15 at 18:49