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


C# DicomAttributeCollection.TryGetAttribute方法代码示例

本文整理汇总了C#中DicomAttributeCollection.TryGetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# DicomAttributeCollection.TryGetAttribute方法的具体用法?C# DicomAttributeCollection.TryGetAttribute怎么用?C# DicomAttributeCollection.TryGetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DicomAttributeCollection的用法示例。


在下文中一共展示了DicomAttributeCollection.TryGetAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BaseInstanceXml

		/// <summary>
		/// Creates an instance of <see cref="BaseInstanceXml"/> based on the specified <see cref="DicomAttributeCollection"/>.
		/// </summary>
		/// <param name="collect1"></param>
		/// <param name="collect2"></param>
		public BaseInstanceXml(DicomAttributeCollection collect1, DicomAttributeCollection collect2)
			: this()
		{
			Platform.CheckForNullReference(collect1, "collect1");
			Platform.CheckForNullReference(collect2, "collect2");

			foreach (DicomAttribute attrib1 in collect1)
			{
				DicomAttribute attrib2;
				if ((attrib1 is DicomAttributeOB)
					|| (attrib1 is DicomAttributeOW)
					|| (attrib1 is DicomAttributeOF)
					|| (attrib1 is DicomAttributeOD)
					|| (attrib1 is DicomFragmentSequence))
				{
					if (collect2.TryGetAttribute(attrib1.Tag, out attrib2))
						((IPrivateInstanceXmlDicomAttributeCollection)Collection).ExcludedTagsHelper.Add(attrib1.Tag);
					continue;
				}

				if (collect2.TryGetAttribute(attrib1.Tag, out attrib2))
				{
					if (!attrib1.IsEmpty && attrib1.Equals(attrib2)) //don't store empty tags in the base collection.
					{
						Collection[attrib1.Tag] = attrib1.Copy();
					}
				}
			}

			if (collect1 is IInstanceXmlDicomAttributeCollection && collect2 is IInstanceXmlDicomAttributeCollection)
			{
				IInstanceXmlDicomAttributeCollection collection2 = (IInstanceXmlDicomAttributeCollection) collect2;
				foreach (DicomTag tag in ((IInstanceXmlDicomAttributeCollection)collect1).ExcludedTags)
				{
					if (collection2.ExcludedTags.Contains(tag))
						PrivateCollection.ExcludedTagsHelper.Add(tag);
				}
			}
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:44,代码来源:BaseInstanceXml.cs

示例2: ScanCollection

		private void ScanCollection(DicomAttributeCollection collection, string[] tagArray, int startIndex, List<DicomAttribute> attributeList)
		{
			if (startIndex >= tagArray.Length)
				return;

			DicomTag tag = DicomTagDictionary.GetDicomTag(tagArray[startIndex].Substring(1));
			if (tag == null)
			{
				throw new NoSuchDicomTagException(tagArray[startIndex].Substring(1));
			}

			DicomAttribute attrib;
			if (collection.TryGetAttribute(tag, out attrib))
			{
				if (attrib.Tag.VR.Equals(DicomVr.SQvr))
				{
					var sequences = attrib.Values as DicomSequenceItem[];
					if (sequences != null)
					{
						foreach (var sq in sequences)
						{
							ScanCollection(sq, tagArray, startIndex + 1, attributeList);
						}
					}
				}
				else
					attributeList.Add(attrib);
			}
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:29,代码来源:DicomExpression.cs


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