/// <summary>
		/// Method for dumping the contents of the attribute to a string.
		/// </summary>
		/// <param name="sb">The StringBuilder to write the attribute to.</param>
		/// <param name="prefix">A prefix to place before the value.</param>
		/// <param name="options">The <see cref="DicomDumpOptions"/> to use for the output string.</param>
		public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
		{
			int ValueWidth = 40 - prefix.Length;
			int SbLength = sb.Length;

			sb.Append(prefix);
			sb.AppendFormat("({0:x4},{1:x4}) {2} ", Tag.Group, Tag.Element, Tag.VR.Name);
			long length = 0;
			foreach (DicomFragment frag in Fragments)
			{
				length += frag.Length;
			}

			String value = string.Format("{0} encapsulated fragment{1} of {2} bytes", Fragments.Count, Fragments.Count > 1 ? "s" : "", length);
			sb.Append(value.PadRight(ValueWidth, ' '));

			sb.AppendFormat(" # {0,4} {2} {1}", StreamLength, Tag.VM, Tag.Name.Replace("&apos;", "'"));

			if (Flags.IsSet(options, DicomDumpOptions.Restrict80CharactersPerLine))
			{
				if (sb.Length > (SbLength + 79))
				{
					sb.Length = SbLength + 79;
					//sb.Append(">");
				}
			}
		}
Esempio n. 2
0
        /// <summary>
        /// Dump the contents of the message to a string.
        /// </summary>
        /// <param name="prefix"></param>
        /// <param name="options"></param>
        /// <returns>The dump of the message.</returns>
        public string Dump(string prefix, DicomDumpOptions options)
        {
            var sb = new StringBuilder();

            Dump(sb, prefix, options);
            return(sb.ToString());
        }
Esempio n. 3
0
 public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
 {
     sb.Append(prefix);
     sb.AppendFormat("{0} {1} {2} {3}", Tag.ToString(), VR.VR, Tag.Entry.Name, HasOffsetTable ? "/w Offset Table" : "");
     for (int i = 0; i < _fragments.Count; i++)
     {
         sb.AppendLine().Append(prefix).AppendFormat(" Fragment {0}:  {1} bytes", i, _fragments[i].Length);
     }
 }
Esempio n. 4
0
 public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
 {
     sb.Append(prefix);
     sb.AppendFormat("{0} {1} {2}", Tag.ToString(), VR.VR, Tag.Entry.Name);
     foreach (DcmItemSequenceItem item in SequenceItems)
     {
         item.Dump(sb, prefix, options);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Dump the contents of the message to a StringBuilder.
 /// </summary>
 /// <param name="sb"></param>
 /// <param name="prefix"></param>
 /// <param name="options"></param>
 public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
 {
     if (sb == null)
     {
         throw new NullReferenceException("sb");
     }
     sb.Append(prefix).Append("Command Elements:").AppendLine();
     MetaInfo.Dump(sb, prefix, options);
     sb.AppendLine().Append(prefix).Append("Data Set:").AppendLine();
     DataSet.Dump(sb, prefix, options);
     sb.AppendLine();
 }
Esempio n. 6
0
 /// <summary>
 /// Method to dump the contents of a file to a StringBuilder object.
 /// </summary>
 /// <param name="sb"></param>
 /// <param name="prefix"></param>
 /// <param name="options">The dump options.</param>
 public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
 {
     if (sb == null)
     {
         throw new NullReferenceException("sb");
     }
     sb.Append(prefix).AppendLine("File: " + Filename).AppendLine();
     sb.Append(prefix).Append("MetaInfo:").AppendLine();
     _metaInfo.Dump(sb, prefix, options);
     sb.AppendLine().Append(prefix).Append("DataSet:").AppendLine();
     _dataSet.Dump(sb, prefix, options);
     sb.AppendLine();
 }
Esempio n. 7
0
 public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
 {
     sb.Append(prefix);
     sb.AppendFormat("({0:x4},{1:x4}) {2} {3}", Tag.Group, Tag.Element, Tag.VR.Name, Tag.Name);
     if (_values == null)
     {
         sb.AppendLine();
     }
     else
     {
         foreach (DicomSequenceItem item in _values)
         {
             sb.AppendLine().Append(prefix).Append(" Item:").AppendLine();
             item.Dump(sb, prefix + "  > ", options);
             sb.Length = sb.Length - 1;
         }
     }
 }
Esempio n. 8
0
 static bool ParseArgs(string[] args)
 {
     foreach (String arg in args)
     {
         if (arg.ToLower().Equals("-h"))
         {
             PrintCommandLine();
             return false;
         }
         else if (arg.ToLower().Equals("-g"))
         {
             _options &= ~DicomDumpOptions.KeepGroupLengthElements;
         }
         else if (arg.ToLower().Equals("-c"))
         {
             _options &= ~DicomDumpOptions.Restrict80CharactersPerLine;
         }
         else if (arg.ToLower().Equals("-l"))
         {
             _options &= ~DicomDumpOptions.ShortenLongValues;
         }
     }
     return true;
 }
Esempio n. 9
0
 static bool ParseArgs(string[] args)
 {
     foreach (String arg in args)
     {
         if (arg.ToLower().Equals("-h"))
         {
             PrintCommandLine();
             return(false);
         }
         else if (arg.ToLower().Equals("-g"))
         {
             _options &= ~DicomDumpOptions.KeepGroupLengthElements;
         }
         else if (arg.ToLower().Equals("-c"))
         {
             _options &= ~DicomDumpOptions.Restrict80CharactersPerLine;
         }
         else if (arg.ToLower().Equals("-l"))
         {
             _options &= ~DicomDumpOptions.ShortenLongValues;
         }
     }
     return(true);
 }
Esempio n. 10
0
 /// <summary>
 /// Method to dump the contents of a file to a StringBuilder object.
 /// </summary>
 /// <param name="sb"></param>
 /// <param name="prefix"></param>
 /// <param name="options">The dump options.</param>
 public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
 {
     if (sb == null) throw new NullReferenceException("sb");
     sb.Append(prefix).AppendLine("File: " + Filename).AppendLine();
     sb.Append(prefix).Append("MetaInfo:").AppendLine();
     MetaInfo.Dump(sb, prefix, options);
     sb.AppendLine().Append(prefix).Append("DataSet:").AppendLine();
     DataSet.Dump(sb, prefix, options);
     sb.AppendLine();
 }
Esempio n. 11
0
        /// <summary>
        /// Method for dumping the contents of the attribute to a string.
        /// </summary>
        /// <param name="sb">The StringBuilder to write the attribute to.</param>
        /// <param name="prefix">A prefix to place before the value.</param>
        /// <param name="options">The <see cref="DicomDumpOptions"/> to use for the output string.</param>
        public virtual void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
        {
            int ValueWidth = 40 - prefix.Length;
            int SbLength = sb.Length;

            sb.Append(prefix);
            sb.AppendFormat("({0:x4},{1:x4}) {2} ", Tag.Group, Tag.Element, Tag.VR.Name);
            if (Count == 0)
            {
                String value = "(no value available)";
                sb.Append(value.PadRight(ValueWidth, ' '));
            }
            else
            {
                if (Tag.VR.IsTextVR)
                {
                    String value;
                    if (Tag.VR == DicomVr.UIvr)
                    {
                        DicomAttributeUI ui = this as DicomAttributeUI;

                        DicomUid uid;
                        bool ok = ui.TryGetUid(0, out uid);

                        if (ok && uid.Type != UidType.Unknown)
                        {
                            value = "=" + uid.Description;
                            if (Flags.IsSet(options, DicomDumpOptions.ShortenLongValues))
                            {
                                if (value.Length > ValueWidth)
                                {
                                    value = value.Substring(0, ValueWidth - 3);
                                }
                            }
                        }
                        else
                        {
                            value = "[" + ToString() + "]";
                            if (Flags.IsSet(options, DicomDumpOptions.ShortenLongValues))
                            {
                                if (value.Length > ValueWidth)
                                {
                                    value = value.Substring(0, ValueWidth - 4) + "...]";
                                }
                            }
                        }
                    }
                    else
                    {
                        value = "[" + ToString() + "]";
                        if (Flags.IsSet(options, DicomDumpOptions.ShortenLongValues))
                        {
                            if (value.Length > ValueWidth)
                            {
                                value = value.Substring(0, ValueWidth - 4) + "...]";
                            }
                        }
                    }
                    sb.Append(value.PadRight(ValueWidth, ' '));
                }
                else
                {
                    String value = ToString();
                    if (Flags.IsSet(options, DicomDumpOptions.ShortenLongValues))
                    {
                        if (value.Length > ValueWidth)
                        {
                            value = value.Substring(0, ValueWidth - 3) + "...";
                        }
                    }
                    sb.Append(value.PadRight(ValueWidth, ' '));
                }
            }
            sb.AppendFormat(" # {0,4} {2} {1}", StreamLength, Tag.VM, Tag.Name.Replace("&apos;", "'"));

            if (Flags.IsSet(options, DicomDumpOptions.Restrict80CharactersPerLine))
            {
                if (sb.Length > (SbLength + 79))
                {
                    sb.Length = SbLength + 79;
                    //sb.Append(">");
                }
            }
        }
Esempio n. 12
0
 /// <summary>
 /// Dumps the contents of the dicomDirFile.
 /// </summary>
 /// <param name="prefix">The prefix.</param>
 /// <param name="options">The dump options.</param>
 /// <returns></returns>
 public string Dump(string prefix, DicomDumpOptions options)
 {
     return _dicomDirFile.Dump(prefix, options);
 }
Esempio n. 13
0
 public void Dump(StringBuilder sb, String prefix, DicomDumpOptions options)
 {
     foreach (DcmItem item in _items.Values) {
         item.Dump(sb, prefix, options);
         sb.AppendLine();
     }
 }
Esempio n. 14
0
 public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
 {
     sb.Append(prefix);
 	sb.AppendFormat("({0:x4},{1:x4}) {2} {3}", Tag.Group, Tag.Element, Tag.VR.Name, Tag.Name);
     if (_values == null)
     {
         sb.AppendLine();
     }
     else
     {
         foreach (DicomSequenceItem item in _values)
         {
             sb.AppendLine().Append(prefix).Append(" Item:").AppendLine();
             item.Dump(sb, prefix + "  > ", options);
             sb.Length = sb.Length - 1;
         }
     }
 }
Esempio n. 15
0
 public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
 {
     sb.AppendLine().Append(prefix).Append(" Item:").AppendLine();
     Dataset.Dump(sb, prefix + "  > ", options);
     sb.Length = sb.Length - 1;
 }
Esempio n. 16
0
        /// <summary>
        /// Method for dumping the contents of the attribute to a string.
        /// </summary>
        /// <param name="sb">The StringBuilder to write the attribute to.</param>
        /// <param name="prefix">A prefix to place before the value.</param>
        /// <param name="options">The <see cref="DicomDumpOptions"/> to use for the output string.</param>
        public virtual void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
        {
            int ValueWidth = 40 - prefix.Length;
            int SbLength   = sb.Length;

            sb.Append(prefix);
            sb.AppendFormat("({0:x4},{1:x4}) {2} ", Tag.Group, Tag.Element, Tag.VR.Name);
            if (Count == 0)
            {
                String value = "(no value available)";
                sb.Append(value.PadRight(ValueWidth, ' '));
            }
            else
            {
                if (Tag.VR.IsTextVR)
                {
                    String value;
                    if (Tag.VR == DicomVr.UIvr)
                    {
                        DicomAttributeUI ui = this as DicomAttributeUI;

                        DicomUid uid;
                        bool     ok = ui.TryGetUid(0, out uid);

                        if (ok && uid.Type != UidType.Unknown)
                        {
                            value = "=" + uid.Description;
                            if (Flags.IsSet(options, DicomDumpOptions.ShortenLongValues))
                            {
                                if (value.Length > ValueWidth)
                                {
                                    value = value.Substring(0, ValueWidth - 3);
                                }
                            }
                        }
                        else
                        {
                            value = "[" + ToString() + "]";
                            if (Flags.IsSet(options, DicomDumpOptions.ShortenLongValues))
                            {
                                if (value.Length > ValueWidth)
                                {
                                    value = value.Substring(0, ValueWidth - 4) + "...]";
                                }
                            }
                        }
                    }
                    else
                    {
                        value = "[" + ToString() + "]";
                        if (Flags.IsSet(options, DicomDumpOptions.ShortenLongValues))
                        {
                            if (value.Length > ValueWidth)
                            {
                                value = value.Substring(0, ValueWidth - 4) + "...]";
                            }
                        }
                    }
                    sb.Append(value.PadRight(ValueWidth, ' '));
                }
                else
                {
                    String value = ToString();
                    if (Flags.IsSet(options, DicomDumpOptions.ShortenLongValues))
                    {
                        if (value.Length > ValueWidth)
                        {
                            value = value.Substring(0, ValueWidth - 3) + "...";
                        }
                    }
                    sb.Append(value.PadRight(ValueWidth, ' '));
                }
            }
            sb.AppendFormat(" # {0,4} {2} {1}", StreamLength, Tag.VM, Tag.Name.Replace("&apos;", "'"));

            if (Flags.IsSet(options, DicomDumpOptions.Restrict80CharactersPerLine))
            {
                if (sb.Length > (SbLength + 79))
                {
                    sb.Length = SbLength + 79;
                    //sb.Append(">");
                }
            }
        }
Esempio n. 17
0
 public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
 {
     sb.Append(prefix);
     sb.AppendFormat("{0} {1} {2} {3}", Tag.ToString(), VR.VR, Tag.Entry.Name, HasOffsetTable ? "/w Offset Table" : "");
     for (int i = 0; i < _fragments.Count; i++)
     {
         sb.AppendLine().Append(prefix).AppendFormat(" Fragment {0}:  {1} bytes", i, _fragments[i].Length);
     }
 }
Esempio n. 18
0
 public static bool IsSet(DicomDumpOptions options, DicomDumpOptions flag)
 {
     return (options & flag) == flag;
 }
Esempio n. 19
0
		public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options) {
			sb.Append(prefix);
			sb.AppendFormat("{0} {1} {2}", Tag.ToString(), VR.VR, Tag.Entry.Name);
			foreach (DcmItemSequenceItem item in SequenceItems) {
				item.Dump(sb, prefix, options);
			}
		}
Esempio n. 20
0
 public virtual void Dump(StringBuilder sb, String prefix,  DicomDumpOptions options)
 {
     sb.Append(prefix).AppendLine(_tag.Entry.ToString());
 }
Esempio n. 21
0
 /// <summary>
 /// Dump the contents of the message to a StringBuilder.
 /// </summary>
 /// <param name="sb"></param>
 /// <param name="prefix"></param>
 /// <param name="options"></param>
 public abstract void Dump(StringBuilder sb, string prefix, DicomDumpOptions options);
Esempio n. 22
0
 public virtual void Dump(StringBuilder sb, String prefix, DicomDumpOptions options)
 {
     sb.Append(prefix).AppendLine(_tag.Entry.ToString());
 }
Esempio n. 23
0
 /// <summary>
 /// Dump the contents of the message to a string.
 /// </summary>
 /// <param name="prefix"></param>
 /// <param name="options"></param>
 /// <returns>The dump of the message.</returns>
 public string Dump(string prefix, DicomDumpOptions options)
 {
     StringBuilder sb = new StringBuilder();
     Dump(sb, prefix, options);
     return sb.ToString();
 }
Esempio n. 24
0
 /// <summary>
 /// Dump the contents of the message to a StringBuilder.
 /// </summary>
 /// <param name="sb"></param>
 /// <param name="prefix"></param>
 /// <param name="options"></param>
 public abstract void Dump(StringBuilder sb, string prefix, DicomDumpOptions options);
Esempio n. 25
0
		public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options) {
			sb.AppendLine().Append(prefix).Append(" Item:").AppendLine();
			Dataset.Dump(sb, prefix + "  > ", options);
			sb.Length = sb.Length - 1;
		}
Esempio n. 26
0
 public static bool IsSet(DicomDumpOptions options, DicomDumpOptions flag)
 {
     return((options & flag) == flag);
 }
Esempio n. 27
0
 /// <summary>
 /// Dump the contents of the message to a StringBuilder.
 /// </summary>
 /// <param name="sb"></param>
 /// <param name="prefix"></param>
 /// <param name="options"></param>
 public override void Dump(StringBuilder sb, string prefix, DicomDumpOptions options)
 {
     if (sb == null) throw new NullReferenceException("sb");
     sb.Append(prefix).Append("Command Elements:").AppendLine();
     _metaInfo.Dump(sb, prefix, options);
     sb.AppendLine().Append(prefix).Append("Data Set:").AppendLine();
     _dataSet.Dump(sb, prefix, options);
     sb.AppendLine();
 }