After upgrading to fo-dicom 4.0, I started to get a DicomDataException: 'DicomTag doesn't support values'
when trying to obtain a DicomDataset from a DICOMDIR file.
Code is as follows:
var dicomDirectory = await DicomDirectory.OpenAsync(dicomdirPath);
foreach (var patientRecord in dicomDirectory.RootDirectoryRecordCollection)
{
foreach (var studyRecord in patientRecord.LowerLevelDirectoryRecordCollection)
{
foreach (var seriesRecord in studyRecord.LowerLevelDirectoryRecordCollection)
{
foreach (var imageRecord in seriesRecord.LowerLevelDirectoryRecordCollection)
{
//this is the problematic line
var dicomDataset = imageRecord.GetValue<DicomSequence>(DicomTag.IconImageSequence, 0).Items.First();
//more stuff
}
}
}
}
With the previous version (3.?) I was doing var dicomImage = imageRecord.Get<DicomSequence>(DicomTag.IconImageSequence).Items.First();
and it worked just fine, but after the upgrade I was getting an Obsolete warning so I changed it to the recommended method, which was GetValue.
How can I get the dataset using the current version of fo-dicom?