本文整理汇总了C#中ClearCanvas.Dicom.DicomAttribute.GetValueType方法的典型用法代码示例。如果您正苦于以下问题:C# DicomAttribute.GetValueType方法的具体用法?C# DicomAttribute.GetValueType怎么用?C# DicomAttribute.GetValueType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClearCanvas.Dicom.DicomAttribute
的用法示例。
在下文中一共展示了DicomAttribute.GetValueType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static ImageProperty Create(DicomAttribute attribute, string category, string name, string description, string separator)
{
// always use the hex value as the identifier, so that private and unknown tags aren't all mapped to the same identifier
string identifier = attribute.Tag.HexString;
if (category == null)
category = string.Empty;
if (string.IsNullOrEmpty(name))
name = GetTagName(attribute.Tag);
if (string.IsNullOrEmpty(description))
description = GetTagDescription(attribute.Tag);
if (attribute.IsNull || attribute.IsEmpty)
return new ImageProperty(identifier, category, name, description, string.Empty);
if (String.IsNullOrEmpty(separator))
separator = ", ";
object value;
if (attribute.Tag.VR.Name == DicomVr.DAvr.Name)
{
value = StringUtilities.Combine(attribute.Values as string[], separator,
delegate(string dateString)
{
DateTime? date = DateParser.Parse(dateString);
if (!date.HasValue)
return null;
else
return Format.Date(date.Value);
}, true);
}
else if (attribute.Tag.VR.Name == DicomVr.TMvr.Name)
{
value = StringUtilities.Combine(attribute.Values as string[], separator,
delegate(string timeString)
{
DateTime? time = TimeParser.Parse(timeString);
if (!time.HasValue)
return null;
else
return Format.Time(time.Value);
}, true);
}
else if (attribute.Tag.VR.Name == DicomVr.DTvr.Name)
{
value = StringUtilities.Combine(attribute.Values as string[], separator,
delegate(string dateTimeString)
{
DateTime? dateTime = DateTimeParser.Parse(dateTimeString);
if (!dateTime.HasValue)
return null;
else
return Format.Time(dateTime.Value);
}, true);
}
else if (attribute.Tag.VR.Name == DicomVr.PNvr.Name)
{
value = StringUtilities.Combine(attribute.Values as string[], separator,
delegate(string nameString)
{
PersonName personName = new PersonName(nameString ?? "");
return personName.FormattedName;
}, true);
}
else if (attribute.Tag.VR == DicomVr.SQvr)
{
value = string.Empty;
var values = attribute.Values as DicomSequenceItem[];
if (values != null && values.Length > 0)
{
// handle simple use case by listing only the attributes of the first sequence item
// since user can always use DICOM editor for more complex use cases
var subproperties = new List<IImageProperty>();
foreach (var subattribute in values[0])
subproperties.Add(Create(subattribute, string.Empty, null, null, null));
subproperties.Sort((x, y) => string.Compare(x.Name, y.Name, StringComparison.CurrentCultureIgnoreCase));
value = subproperties.ToArray();
}
}
else if (attribute.Tag.VR.IsTextVR && attribute.GetValueType() == typeof(string[]))
{
value = StringUtilities.Combine(attribute.Values as string[], separator, true);
}
else
{
value = attribute.ToString();
}
return new ImageProperty(identifier, category, name, description, value);
}