/DICOM/DicomItem.cs

https://github.com/petnet/fo-dicom · C# · 39 lines · 29 code · 7 blank · 3 comment · 3 complexity · 34c30bade94a0041e44a6bfe63506cc1 MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Dicom.IO;
  6. namespace Dicom {
  7. public abstract class DicomItem : IComparable<DicomItem>, IComparable {
  8. protected DicomItem(DicomTag tag) {
  9. Tag = tag;
  10. //DicomDictionaryEntry entry = DicomDictionary.Default[Tag];
  11. //if (entry != null && !entry.ValueRepresentations.Contains(ValueRepresentation))
  12. // throw new DicomDataException("{0} is not a valid value representation for {1}", ValueRepresentation, Tag);
  13. }
  14. public DicomTag Tag {
  15. get;
  16. protected set;
  17. }
  18. public abstract DicomVR ValueRepresentation {
  19. get;
  20. }
  21. public int CompareTo(DicomItem other) {
  22. return Tag.CompareTo(other.Tag);
  23. }
  24. public int CompareTo(object obj) {
  25. if (obj == null)
  26. throw new ArgumentNullException("obj");
  27. if (!(obj is DicomItem))
  28. throw new ArgumentException("Passed non-DicomItem to comparer", "obj");
  29. return CompareTo(obj as DicomItem);
  30. }
  31. }
  32. }