本文整理汇总了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);
}
}
}
示例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);
}
}