我正试着把放射治疗计划和file放在一个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# Split A String By Another String或Easiest way to split a string on newlines in .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>(),我只能再次得到剪切字符串。
希望你能帮我找出我哪里做错了什么,以及如何得到这个项目的完整字符串。
发布于 2017-10-13 19:38:22
通过https://github.com/fo-dicom/fo-dicom/issues/491,他们用一个新的API来解决这个问题,但是假设您使用的是旧版本,
string Leaf = String.Join(@"\",
...
Get<string[]>(Dicom.DicomTag.LeafJawPositions));应该还你想要的。
我使用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());https://stackoverflow.com/questions/46728914
复制相似问题