简体   繁体   English

Evil Dicom hw 检查标签是否存在

[英]Evil Dicom hw to check if a tag exists

I am working with DICOM RT data sets and the Frame of reference UID is common across all files except the RT structure file where it is called referenced frame of reference.我正在使用 DICOM RT 数据集,参考框架 UID 在所有文件中都是通用的,除了 RT 结构文件,它被称为参考参考框架。

What I would like to do is to read each DICOM file and check if the file has the tag FrameOfReferenceUID or ReferencedFrameOfReferenceUID and act accordingly.我想要做的是读取每个 DICOM 文件并检查该文件是否具有标签FrameOfReferenceUIDReferencedFrameOfReferenceUID并相应地采取行动。

var dcm = DICOMFileReader.Read(file);
var sel = new DICOMSelector(dcm);

var refFOR = sel.ReferencedFrameOfReferenceUID.Data;

This las line throws an error when a file does not contain the tag FrameOfReferenceUID .当文件不包含标签FrameOfReferenceUID时,此 las 行会引发错误。 Need to check if it exists first, can't seem to figure out how to do this.需要先检查它是否存在,似乎无法弄清楚如何做到这一点。

var dcm = DICOMObject.Read(@"MyDICOMFile.dcm");
var genericName = dcm.FindFirst(TagHelper.PATIENT_NAME) as AbstractElement<string>;
if(genericName != null)
    var genValue = genericName.Data;

Above code is copied from here .上面的代码是从这里复制的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM