问题描述
我正在使用openDicom.net读取dicom标签,如下所示:
I'm reading dicom tags using openDicom.net like this:
string tag = "";
string description = "";
string val_rep = "";
foreach (DataElement elementy in sq)
{
tag = elementy.Tag.ToString();
description = elementy.VR.Tag.GetDictionaryEntry().Description;
val_rep = elementy.VR.ToString();
}
如何读取dicom标签值?
How can I read dicom tag values?
推荐答案
我假设sq是一个序列...
I'm assuming that sq is a Sequence...
我没有使用过openDicom,但我很确定您在做什么不会得到想要的结果。
I've not worked with openDicom, but I'm pretty sure what you're doing there isn't going to yield the results you want.
您只有一个标签,说明和val_rep变量,但是您使用foreach来填充它们,这意味着Sequence中的最后一个DataElement将是您检索的唯一值。您将使用以下方法达到相同的效果:
You have a single tag, description, and val_rep variable, but you're filling them using a foreach, meaning the last DataElement in the Sequence will be the only values you retrieve. You would achieve the same effect by using:
string tag = sq[sq.Count - 1].Tag.ToString();
string description = sq[sq.Count -1].VR.Tag.GetDictionaryEntry().Description;
string val_rep = sq[sq.Count - 1].VR.ToString();
因此从序列中检索最后一组值。我相信您会发现,如果逐步执行foreach,它将加载DICOM文件中包含的所有不同DataElement。
Thus retrieving the last set of values from the Sequence. I believe you'll find that if you step through the foreach as it executes, it will be loading all the different DataElements contained in your DICOM file.
随意返回如果我离这里远了,在您的原始帖子中发表评论或发布更多信息。
Feel free to return a comment or post more information in your original post if I'm way off base here.
这篇关于如何在C#中使用openDicom.net读取dicom标签值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!