Tag being set does not match tag in DicomElement
在处理Dicom 文件时,经常需要构建DicomSequenceItem ,此时要保证DicomElementSq的对象和DicomSequenceItem 一致,否则会在运行时发生异常
// 遇到的异常写法
var wedgesSq = new DicomElementSq(DicomTags.WedgeSequence);
sequenceItem[DicomTags.RecordedWedgeSequence] = wedgesSq;
使用上述写法时,编译正常,运行时会报错,提示
Tag being set does not match tag in DicomElement
// 修改后的写法
var wedgesSq = new DicomElementSq(DicomTags.RecordedWedgeSequence);
sequenceItem[DicomTags.RecordedWedgeSequence] = wedgesSq;