2

我正在尝试使用 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>()在最后一行中我只能再次获得剪切字符串。

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

4

1 回答 1

4

https://github.com/fo-dicom/fo-dicom/issues/491他们正在使用新 API 解决问题,但假设您使用的是旧版本,

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

应该返回你所期望的。

PS我使用string扩展方法Join

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());
于 2017-10-13T19:38:22.483 回答