繁体   English   中英

如何使用fo-dicom获取dicom项目的完整字符串元素?

[英]How to get the full string element of a dicom item with fo-dicom?

我正在尝试使用fo-dicom在dicom文件中获取一串放射治疗计划。 对于您来说似乎并不那么难,但由于无法找到正确的命令,我一直处于困境。

我正在过滤计划,例如“ Leaf/Jaw Positions VS调试模式中显示的字符串值为“ -35 // 35” ,我也可以在DICOM编辑器中找到它。 但是输出仅给我值-35 我的代码就像

var Leaf = file.Dataset.Get<Dicom.DicomSequence>(Dicom.DicomTag.BeamSequence).Items[0].
            Get<Dicom.DicomSequence>(Dicom.DicomTag.ControlPointSequence).Items[0].
            Get<Dicom.DicomSequence>(Dicom.DicomTag.BeamLimitingDevicePositionSequence).Items[0].
            Get<string>(Dicom.DicomTag.LeafJawPositions);

因此,我只能得到提到的第一个值。 通过将最后一个Get<string>()更改为Get<Dicom.DicomElement>()或调试监视工具中的其他内容,我可以再次看到整个字符串,但无法打印出来。

当我在这里查找时, C#将字符串拆分为另一个字符串,或者是在.NET中的换行符上拆分字符串的最简单方法? 我尝试通过编辑代码来

string Leaf = file.Dataset.Get<Dicom.DicomSequence>(Dicom.DicomTag.BeamSequence).Items[0].
            Get<Dicom.DicomSequence>(Dicom.DicomTag.ControlPointSequence).Items[0].
            Get<Dicom.DicomSequence>(Dicom.DicomTag.BeamLimitingDevicePositionSequence).Items[0].
            Get<Dicom.DicomElement>(Dicom.DicomTag.LeafJawPositions);

但是string无法接受Dicom.DicomElement作为字符串,并且在最后一行中使用Get<string>()只能再次获得剪切的字符串。

希望您能找到我做错了什么以及如何获得此项的完整字符串。

他们从https://github.com/fo-dicom/fo-dicom/issues/491使用新的API修复了该问题,但是假设您使用的是旧版本,

string Leaf = String.Join(@"\",
              ...
              Get<string[]>(Dicom.DicomTag.LeafJawPositions));

应该返回您的期望。

PS我对Join使用string扩展方法:

public static string Join(this IEnumerable<string> strings, string sep) => String.Join(sep, strings.ToArray());
public static string Join(this IEnumerable<string> strings, char sep) => String.Join(sep.ToString(), strings.ToArray());

暂无
暂无

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

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