Permalink
Browse files

final fix for matching private tags

  • Loading branch information...
rcd committed Mar 13, 2013
1 parent 7f5fee3 commit f28c0899ae3d503cea8b22f5115bedcfe4fb495f
Showing with 20 additions and 13 deletions.
  1. +2 −1 DICOM/DicomDictionary.cs
  2. +18 −12 DICOM/DicomTag.cs
View
@@ -135,7 +135,8 @@ public partial class DicomDictionary : IEnumerable<DicomDictionaryEntry> {
}
if (entry.MaskTag == null) {
_entries.Add(entry.Tag, entry);
// allow overwriting of existing entries
_entries[entry.Tag] = entry;
} else {
_masked.Add(entry);
_sortMasked = true;
View
@@ -61,19 +61,25 @@ public sealed partial class DicomTag : IFormattable, IEquatable<DicomTag>, IComp
}
switch (format) {
case "g": {
if (PrivateCreator != null)
return String.Format("{0:x4},{1:x4}:{2}", Group, Element, PrivateCreator.Creator);
else
return String.Format("{0:x4},{1:x4}", Group, Element);
}
case "G":
default: {
case "X": {
if (PrivateCreator != null)
return String.Format("({0:x4},xx{1:x2}:{2})", Group, Element & 0xff, PrivateCreator.Creator);
else
return String.Format("({0:x4},{1:x4})", Group, Element);
}
case "g": {
if (PrivateCreator != null)
return String.Format("({0:x4},{1:x4}:{2})", Group, Element, PrivateCreator.Creator);
return String.Format("{0:x4},{1:x4}:{2}", Group, Element, PrivateCreator.Creator);
else
return String.Format("({0:x4},{1:x4})", Group, Element);
}
return String.Format("{0:x4},{1:x4}", Group, Element);
}
case "G":
default: {
if (PrivateCreator != null)
return String.Format("({0:x4},{1:x4}:{2})", Group, Element, PrivateCreator.Creator);
else
return String.Format("({0:x4},{1:x4})", Group, Element);
}
}
}
@@ -138,7 +144,7 @@ public sealed partial class DicomTag : IFormattable, IEquatable<DicomTag>, IComp
public override int GetHashCode() {
if (_hash == 0)
_hash = ToString().GetHashCode();
_hash = ToString("X", null).GetHashCode();
return _hash;
}

0 comments on commit f28c089

Please sign in to comment.