1

I've been trying to find a way to use fo-dicom to create a DICOMDIR file, and have it reference several files that contain image series, but so far I can't.

I've successfully read DICOMDIRs, series and even rendered images. From that, I was able to understand that the DicomDirectory has a RootDirectoryRecordCollection for Patients, and from there you have LowerLevelDirectoryRecordCollection for Studies, then Series, and then Images. But when it comes to building that structure (for example, to create DICOMDIR and Series files for new studies) I can't find a way to set those LowerLeverDirectoryRecords; RootDirectoryRecordCollection has an Add method, but it takes a DicomItem, so I take it it's for DicomDataset or DicomTag/Value, and its property LowerLevelDirectoryRecordCollection is an IEnumerable, so no Add there. I've also seen the AddFile method, but there's no hierarchy there, so I supposed that's for the series files.

Has anybody succesfully created a DICOMDIR and had it reference several series files with fo-dicom? How? Thanks

4

1 回答 1

1

它应该很简单:

var dicomDir = new DicomDirectory();
foreach (var file in dirInfo.GetFiles("*.*", SearchOption.AllDirectories))
{
    var dicomFile = Dicom.DicomFile.Open(file.FullName);
    dicomDir.AddFile(dicomFile, String.Format(@"000001\{0}", file.Name));
}
dicomDir.Save(dicomDirPath);

所有内部层次结构都是自动添加的。我从 fo-dicom-samples 存储库中获取了这个示例: https ://github.com/fo-dicom/fo-dicom-samples/blob/master/Desktop/DICOM%20Media/Program.cs

于 2018-11-08T09:43:25.757 回答