当前位置: 首页>>代码示例>>C#>>正文


C# DicomTag.ToString方法代码示例

本文整理汇总了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;
 }
开发者ID:karanbajaj,项目名称:mdcm,代码行数:11,代码来源:DcmDataset.cs

示例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;
 }
开发者ID:karanbajaj,项目名称:mdcm,代码行数:13,代码来源:DcmDataset.cs

示例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;
 }
开发者ID:karanbajaj,项目名称:mdcm,代码行数:11,代码来源:DcmDataset.cs

示例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;
 }
开发者ID:karanbajaj,项目名称:mdcm,代码行数:13,代码来源:DcmDataset.cs

示例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;
 }
开发者ID:karanbajaj,项目名称:mdcm,代码行数:20,代码来源:DcmDataset.cs

示例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");
 }
开发者ID:karanbajaj,项目名称:mdcm,代码行数:11,代码来源:DcmDataset.cs

示例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;
 }
开发者ID:GMZ,项目名称:mdcm,代码行数:19,代码来源:DcmDataset.cs

示例8: ToString

 public void ToString()
 {
     var t = new DicomTag(0x0028, 0x9145);
     Assert.AreEqual("(0028,9145)", t.ToString());
 }
开发者ID:fo-dicom,项目名称:mdcm,代码行数:5,代码来源:DicomTagTest.cs


注:本文中的Dicom.Data.DicomTag.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。