本文整理汇总了C#中Dicom.Data.DicomTag.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DicomTag.ToString方法的具体用法?C# DicomTag.ToString怎么用?C# DicomTag.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dicom.Data.DicomTag
的用法示例。
在下文中一共展示了DicomTag.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetStringArray
public string[] GetStringArray(DicomTag tag, string[] deflt)
{
DcmElement elem = GetElement(tag);
if (elem is DcmMultiStringElement)
return (elem as DcmMultiStringElement).GetValues();
if (elem is DcmStringElement)
return new string[] { (elem as DcmStringElement).GetValue() };
if (elem != null)
throw new DicomDataException("Tried to access element " + tag.ToString() + " with incorrect VR");
return deflt;
}
示例2: GetInt32
public int GetInt32(DicomTag tag, int deflt)
{
DcmElement elem = GetElement(tag);
if (elem != null && elem.Length > 0) {
if (elem.VR == DicomVR.IS)
return (elem as DcmIntegerString).GetInt32();
else if (elem.VR == DicomVR.SL)
return (elem as DcmSignedLong).GetValue();
else
throw new DicomDataException("Tried to access element " + tag.ToString() + " with incorrect VR");
}
return deflt;
}
示例3: GetString
public string GetString(DicomTag tag, int index, string deflt)
{
DcmElement elem = GetElement(tag);
if (elem is DcmStringElement)
return (elem as DcmStringElement).GetValue(index);
if (elem is DcmMultiStringElement)
return (elem as DcmMultiStringElement).GetValue(index);
if (elem != null)
throw new DicomDataException("Tried to access element " + tag.ToString() + " with incorrect VR");
return deflt;
}
示例4: GetFloat
public float GetFloat(DicomTag tag, float deflt)
{
DcmElement elem = GetElement(tag);
if (elem != null && elem.Length > 0) {
if (elem.VR == DicomVR.FL)
return (elem as DcmFloatingPointSingle).GetValue();
else if (elem.VR == DicomVR.DS)
return (elem as DcmDecimalString).GetFloat();
else
throw new DicomDataException("Tried to access element " + tag.ToString() + " with incorrect VR");
}
return deflt;
}
示例5: GetDateTime
public DateTime GetDateTime(DicomTag tag, int index, DateTime deflt)
{
DcmElement elem = GetElement(tag);
if (elem is DcmDate || elem is DcmTime || elem is DcmDateTime) {
try {
if (elem is DcmDate)
return (elem as DcmDate).GetDateTime(index);
if (elem is DcmTime)
return (elem as DcmTime).GetDateTime(index);
if (elem is DcmDateTime)
return (elem as DcmDateTime).GetDateTime(index);
}
catch {
return deflt;
}
}
if (elem != null)
throw new DicomDataException("Tried to access element " + tag.ToString() + " with incorrect VR");
return deflt;
}
示例6: SetStringArray
public void SetStringArray(DicomTag tag, string[] values)
{
DcmElement elem = GetElement(tag);
if (elem is DcmMultiStringElement) {
(elem as DcmMultiStringElement).SetValues(values);
return;
}
if (elem != null)
throw new DicomDataException("Tried to access element " + tag.ToString() + " with incorrect VR");
throw new DicomDataException("Element " + tag.ToString() + " does not exist in Dataset");
}
示例7: GetDouble
public double GetDouble(DicomTag tag, double deflt)
{
DcmElement elem = GetElement(tag);
if (elem != null && elem.Length > 0)
{
if (elem.VR == DicomVR.FD)
return (elem as DcmFloatingPointDouble).GetValue();
else if (elem.VR == DicomVR.DS)
return (elem as DcmDecimalString).GetDouble();
else if (elem.VR == DicomVR.OB || elem.VR == DicomVR.UN)
{
var bytes = elem.ByteBuffer.ToBytes();
return BitConverter.ToDouble(bytes, 0);
}
else
throw new DicomDataException("Tried to access element " + tag.ToString() + " with incorrect VR");
}
return deflt;
}
示例8: ToString
public void ToString()
{
var t = new DicomTag(0x0028, 0x9145);
Assert.AreEqual("(0028,9145)", t.ToString());
}