本文整理汇总了C#中Dicom.Data.DcmDataset.GetLO方法的典型用法代码示例。如果您正苦于以下问题:C# DcmDataset.GetLO方法的具体用法?C# DcmDataset.GetLO怎么用?C# DcmDataset.GetLO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dicom.Data.DcmDataset
的用法示例。
在下文中一共展示了DcmDataset.GetLO方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromDataset
public static WindowLevel[] FromDataset(DcmDataset dataset)
{
List<WindowLevel> settings = new List<WindowLevel>();
if (dataset.Contains(DicomTags.WindowCenter) && dataset.Contains(DicomTags.WindowWidth)) {
string[] wc = dataset.GetDS(DicomTags.WindowCenter).GetValues();
string[] ww = dataset.GetDS(DicomTags.WindowWidth).GetValues();
if (wc.Length != ww.Length)
throw new DicomImagingException("Window Center count does not match Window Width count");
string[] desc = null;
if (dataset.Contains(DicomTags.WindowCenterWidthExplanation)) {
desc = dataset.GetLO(DicomTags.WindowCenterWidthExplanation).GetValues();
}
for (int i = 0; i < wc.Length; i++) {
double window;
double level;
if (!Double.TryParse(ww[i], out window) &&
!Double.TryParse(ww[i], System.Globalization.NumberStyles.Float,
System.Globalization.CultureInfo.InvariantCulture, out window))
throw new DicomImagingException("Unable to parse Window/Level [ww: {0}]", ww[i]);
if (!Double.TryParse(wc[i], out level) &&
!Double.TryParse(wc[i], System.Globalization.NumberStyles.Float,
System.Globalization.CultureInfo.InvariantCulture, out level))
throw new DicomImagingException("Unable to parse Window/Level [wc: {0}]", wc[i]);
string description = String.Empty;
if (desc != null && i < desc.Length)
description = desc[i];
settings.Add(new WindowLevel(description, window, level));
}
}
return settings.ToArray();
}