예제 #1
0
        /// <summary>
        /// Create the SopClass.cs file.
        /// </summary>
        /// <param name="sopsFile"></param>
        public void WriteSqlInsert(String sopsFile)
        {
            StreamWriter writer = new StreamWriter(sopsFile);

            WriterHeader(writer);

            IEnumerator iter = _sopList.GetEnumerator();

            while (iter.MoveNext())
            {
                SopClass sopClass = (SopClass)((DictionaryEntry)iter.Current).Value;


                writer.WriteLine("INSERT INTO [ImageServer].[dbo].[SopClass] ([GUID],[SopClassUid],[Description],[NonImage])");
                if (sopClass.name.ToLower().Contains("image"))
                {
                    writer.WriteLine("VALUES (newid(), '" + sopClass.uid + "', '" + sopClass.name + "', 0);");
                }
                else
                {
                    writer.WriteLine("VALUES (newid(), '" + sopClass.uid + "', '" + sopClass.name + "', 1);");
                }
                writer.WriteLine("");
            }


            writer.Close();
        }
예제 #2
0
        public void GetSopClassDetails(SopClass sopClass, out string category)
        {
            //I started out using an xml document to store this information, but it wasn't worth it.
            //As it turns out, there's a fairly reliable formula based on SOP class names.
            if (sopClass.IsImage)
            {
                category = "SopClassCategory.Image";
            }
            else if (sopClass.IsStorage)
            {
                category = "SopClassCategory.Storage";
            }
            else
            {
                category = "SopClassCategory.Uncategorized";
            }

            /*
             * XmlNode sopClassNode = _sopClassDoc.FirstChild;
             *
             * sopClassNode = sopClassNode.NextSibling;
             * sopClassNode = sopClassNode.FirstChild;
             *
             * while (sopClassNode != null)
             * {
             *      if (sopClassNode.Name.Equals("SopClass"))
             *      {
             *              String xmlUid = sopClassNode.Attributes["uid"].Value;
             *
             *              if (xmlUid.Equals(uid))
             *              {
             *                      isImage = sopClassNode.Attributes["isImage"].Value;
             *                      return;
             *              }
             *      }
             *      sopClassNode = sopClassNode.NextSibling;
             * }
             *
             * if (name.ToLower().Contains("Image Storage"))
             *      isImage = "true";
             */
        }
예제 #3
0
        public void ParseFile(String filename)
        {
            TextReader tReader = new StreamReader(filename);
            var settings = new XmlReaderSettings
                               {
                                   CheckCharacters = false,
                                   ValidationType = ValidationType.None,
                                   ConformanceLevel = ConformanceLevel.Fragment,
                                   IgnoreProcessingInstructions = true
                               };
            XmlReader reader = XmlReader.Create(tReader, settings);
            var columnArray = new String[10];
            int colCount = -1;
            bool isTag = true;
            bool isUid = true;
            try
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        bool isFirst = true;
                        if (reader.Name == "w:tbl")
                        {
                            while (reader.Read())
                            {
                                if (reader.IsStartElement())
                                {
                                    if (reader.Name == "w:tc")
                                    {
                                        colCount++;
                                    }
                                    else if (reader.Name == "w:t")
                                    {
                                        String val = reader.ReadString();
                                        //if (val != "(")
                                        if (columnArray[colCount] == null)
                                            columnArray[colCount] = val;
                                        else
                                            columnArray[colCount] += val;
                                    }
                                }
                                if ((reader.NodeType == XmlNodeType.EndElement)
                                    && (reader.Name == "w:tr"))
                                {
                                    if (isFirst)
                                    {
                                        if (columnArray[0] == "Tag")
                                        {
                                            isTag = true;
                                            isUid = false;
                                        }
                                        else
                                        {
                                            isTag = false;
                                            isUid = true;
                                        }

                                        isFirst = false;
                                    }
                                    else
                                    {
                                        if (isTag)
                                        {
                                            var thisTag = new Tag();
                                            if (columnArray[0] != null && columnArray[0] != "Tag")
                                            {
                                                thisTag.tag = columnArray[0];
                                                thisTag.name = columnArray[1];
                                                thisTag.dicomVarName = columnArray[2];
                                                if (columnArray[3] != null)
                                                    thisTag.vr = columnArray[3].Trim();
                                                if (columnArray[4] != null)
                                                    thisTag.vm = columnArray[4].Trim();
                                                thisTag.retired = columnArray[5];

                                                // Handle repeating groups
                                                if (thisTag.tag[3] == 'x')
                                                    thisTag.tag = thisTag.tag.Replace("xx", "00");

                                                var charSeparators = new[] { '(', ')', ',', ' ' };

                                                String[] nodes = thisTag.tag.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
                                                UInt32 group, element; 
                                                if (UInt32.TryParse(nodes[0],NumberStyles.HexNumber,null, out group)
                                                 && UInt32.TryParse(nodes[1], NumberStyles.HexNumber,null, out element)
                                                    && thisTag.name != null)
                                                {
                                                    thisTag.nTag = element | group << 16;

                                                    CreateNames(ref thisTag);

                                                    if (!thisTag.varName.Equals("Item")
                                                     && !thisTag.varName.Equals("ItemDelimitationItem")
                                                     && !thisTag.varName.Equals("SequenceDelimitationItem")
                                                     && !thisTag.varName.Equals("GroupLength"))
                                                        Tags.Add(thisTag.nTag, thisTag);
                                                }
                                            }
                                        }
                                        else if (isUid)
                                        {

                                            if (columnArray[0] != null)
                                            {
                                                var thisUid = new SopClass
                                                                  {
                                                                      Uid = columnArray[0] ?? string.Empty,
                                                                      Name = columnArray[1] ?? string.Empty,
                                                                      Type = columnArray[2] ?? string.Empty
                                                                  };


                                                thisUid.VarName = CreateVariableName(thisUid.Name);

                                                // Take out the invalid chars in the name, and replace with escape characters.
                                                thisUid.Name = SecurityElement.Escape(thisUid.Name);

                                                if (thisUid.Type == "SOP Class")
                                                {
                                                    // Handling leading digits in names
                                                    if (thisUid.VarName.Length > 0 && char.IsDigit(thisUid.VarName[0]))
                                                        thisUid.VarName = "Sop" + thisUid.VarName;
                                                    SopClasses.Add(thisUid.Name, thisUid);
                                                }
                                                else if (thisUid.Type == "Transfer Syntax")
                                                {
                                                    int index = thisUid.VarName.IndexOf(':');
                                                    if (index != -1)
                                                        thisUid.VarName = thisUid.VarName.Remove(index);

                                                    TranferSyntaxes.Add(thisUid.Name, thisUid);
                                                }
                                                else if (thisUid.Type == "Meta SOP Class")
                                                {
                                                    // Handling leading digits in names
                                                    if (thisUid.VarName.Length > 0 && char.IsDigit(thisUid.VarName[0]))
                                                        thisUid.VarName = "Sop" + thisUid.VarName;
                                                    MetaSopClasses.Add(thisUid.Name, thisUid);
                                                }
                                            }
                                        }
                                    }

                                    colCount = -1;
                                    for (int i = 0; i < columnArray.Length; i++)
                                        columnArray[i] = null;
                                }

                                if ((reader.NodeType == XmlNodeType.EndElement)
                                 && (reader.Name == "w:tbl"))
                                    break; // end of table
                            }
                        }
                    }
                }
            }
            catch (XmlException)
            {

            }
            catch (Exception e)
            {
                Console.WriteLine(string.Format("Unexpected exception: {0}", e.Message));
            }
        }
예제 #4
0
		public void GetSopClassDetails(SopClass sopClass, out string category)
		{
			//I started out using an xml document to store this information, but it wasn't worth it.
			//As it turns out, there's a fairly reliable formula based on SOP class names.
			if (sopClass.IsImage)
				category = "SopClassCategory.Image";
			else if (sopClass.IsStorage)
				category = "SopClassCategory.Storage";
			else
				category = "SopClassCategory.Uncategorized";
			
			/*
			XmlNode sopClassNode = _sopClassDoc.FirstChild;

			sopClassNode = sopClassNode.NextSibling;
			sopClassNode = sopClassNode.FirstChild;

			while (sopClassNode != null)
			{
				if (sopClassNode.Name.Equals("SopClass"))
				{
					String xmlUid = sopClassNode.Attributes["uid"].Value;

					if (xmlUid.Equals(uid))
					{
						isImage = sopClassNode.Attributes["isImage"].Value;
						return;
					}
				}
				sopClassNode = sopClassNode.NextSibling;
			}

			if (name.ToLower().Contains("Image Storage"))
				isImage = "true";
		*/
		}
예제 #5
0
        public void ParseFile(String filename)
        {
            TextReader        tReader  = new StreamReader(filename);
            XmlReaderSettings settings = new XmlReaderSettings();

            settings.CheckCharacters              = false;
            settings.ValidationType               = ValidationType.None;
            settings.ConformanceLevel             = ConformanceLevel.Fragment;
            settings.IgnoreProcessingInstructions = true;
            XmlReader reader = XmlReader.Create(tReader, settings);

            String[] columnArray = new String[10];
            int      colCount    = -1;
            bool     isFirst     = true;
            bool     isTag       = true;
            bool     isUid       = true;

            try
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        isFirst = true;
                        if (reader.Name == "w:tbl")
                        {
                            while (reader.Read())
                            {
                                if (reader.IsStartElement())
                                {
                                    if (reader.Name == "w:tc")
                                    {
                                        colCount++;
                                    }
                                    else if (reader.Name == "w:t")
                                    {
                                        String val = reader.ReadString();
                                        //if (val != "(")
                                        if (columnArray[colCount] == null)
                                        {
                                            columnArray[colCount] = val;
                                        }
                                        else
                                        {
                                            columnArray[colCount] += val;
                                        }
                                    }
                                }
                                if ((reader.NodeType == XmlNodeType.EndElement) &&
                                    (reader.Name == "w:tr"))
                                {
                                    if (isFirst)
                                    {
                                        if (columnArray[0] == "Tag")
                                        {
                                            isTag = true;
                                            isUid = false;
                                        }
                                        else
                                        {
                                            isTag = false;
                                            isUid = true;
                                        }

                                        isFirst = false;
                                    }
                                    else
                                    {
                                        if (isTag)
                                        {
                                            Tag thisTag = new Tag();
                                            if (columnArray[0] != null && columnArray[0] != "Tag")
                                            {
                                                thisTag.tag  = columnArray[0];
                                                thisTag.name = columnArray[1];
                                                if (columnArray[2] != null)
                                                {
                                                    thisTag.vr = columnArray[2].Trim();
                                                }
                                                if (columnArray[3] != null)
                                                {
                                                    thisTag.vm = columnArray[3].Trim();
                                                }
                                                thisTag.retired = columnArray[4];

                                                // Handle repeating groups
                                                if (thisTag.tag[3] == 'x')
                                                {
                                                    thisTag.tag = thisTag.tag.Replace("xx", "00");
                                                }

                                                char[] charSeparators = new char[] { '(', ')', ',', ' ' };

                                                String[] nodes = thisTag.tag.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
                                                UInt32   group, element;
                                                if (UInt32.TryParse(nodes[0], NumberStyles.HexNumber, null, out group) &&
                                                    UInt32.TryParse(nodes[1], NumberStyles.HexNumber, null, out element) &&
                                                    thisTag.name != null)
                                                {
                                                    thisTag.nTag = element | group << 16;

                                                    CreateNames(ref thisTag);

                                                    if (!thisTag.varName.Equals("Item") &&
                                                        !thisTag.varName.Equals("ItemDelimitationItem") &&
                                                        !thisTag.varName.Equals("SequenceDelimitationItem") &&
                                                        !thisTag.varName.Equals("GroupLength"))
                                                    {
                                                        _tags.Add(thisTag.nTag, thisTag);
                                                    }
                                                }
                                            }
                                        }
                                        else if (isUid)
                                        {
                                            if (columnArray[0] != null)
                                            {
                                                SopClass thisUid = new SopClass();

                                                thisUid.uid  = columnArray[0];
                                                thisUid.name = columnArray[1];
                                                thisUid.type = columnArray[2];

                                                thisUid.varName = CreateVariableName(thisUid.name);

                                                // Take out the invalid chars in the name, and replace with escape characters.
                                                thisUid.name = SecurityElement.Escape(thisUid.name);

                                                if (thisUid.type == "SOP Class")
                                                {
                                                    // Handling leading digits in names
                                                    if (thisUid.varName.Length > 0 && char.IsDigit(thisUid.varName[0]))
                                                    {
                                                        thisUid.varName = "Sop" + thisUid.varName;
                                                    }
                                                    _sopClasses.Add(thisUid.name, thisUid);
                                                }
                                                else if (thisUid.type == "Transfer Syntax")
                                                {
                                                    int index = thisUid.varName.IndexOf(':');
                                                    if (index != -1)
                                                    {
                                                        thisUid.varName = thisUid.varName.Remove(index);
                                                    }

                                                    _tranferSyntaxes.Add(thisUid.name, thisUid);
                                                }
                                                else if (thisUid.type == "Meta SOP Class")
                                                {
                                                    // Handling leading digits in names
                                                    if (thisUid.varName.Length > 0 && char.IsDigit(thisUid.varName[0]))
                                                    {
                                                        thisUid.varName = "Sop" + thisUid.varName;
                                                    }
                                                    _metaSopClasses.Add(thisUid.name, thisUid);
                                                }
                                            }
                                        }
                                    }

                                    colCount = -1;
                                    for (int i = 0; i < columnArray.Length; i++)
                                    {
                                        columnArray[i] = null;
                                    }
                                }

                                if ((reader.NodeType == XmlNodeType.EndElement) &&
                                    (reader.Name == "w:tbl"))
                                {
                                    break; // end of table
                                }
                            }
                        }
                    }
                }
            }
            catch (XmlException)
            {
            }
        }
예제 #6
0
        /// <summary>
        /// Create the SopClass.cs file.
        /// </summary>
        /// <param name="sopsFile"></param>
        public void WriteSopClasses(String sopsFile)
        {
            StreamWriter writer = new StreamWriter(sopsFile);

            WriterHeader(writer);

            writer.WriteLine("    /// <summary>");
            writer.WriteLine("    /// This class contains defines for all DICOM SOP Classes.");
            writer.WriteLine("    /// </summary>");
            writer.WriteLine("    public class SopClass");
            writer.WriteLine("    {");

            IEnumerator iter = _sopList.GetEnumerator();

            while (iter.MoveNext())
            {
                SopClass sopClass = (SopClass)((DictionaryEntry)iter.Current).Value;

                writer.WriteLine("        /// <summary>");
                writer.WriteLine("        /// <para>" + sopClass.name + "</para>");
                writer.WriteLine("        /// <para>UID: " + sopClass.uid + "</para>");
                writer.WriteLine("        /// </summary>");
                writer.WriteLine("        public static readonly String " + sopClass.varName + "Uid = \"" + sopClass.uid + "\";");
                writer.WriteLine("");
                writer.WriteLine("        /// <summary>SopClass for");
                writer.WriteLine("        /// <para>" + sopClass.name + "</para>");
                writer.WriteLine("        /// <para>UID: " + sopClass.uid + "</para>");
                writer.WriteLine("        /// </summary>");
                writer.WriteLine("        public static readonly SopClass " + sopClass.varName + " =");
                writer.WriteLine("                             new SopClass(\"" + sopClass.name + "\", ");
                writer.WriteLine("                                          " + sopClass.varName + "Uid, ");
                writer.WriteLine("                                          false);");
                writer.WriteLine("");
            }

            iter = _metaSopList.GetEnumerator();

            while (iter.MoveNext())
            {
                SopClass sopClass = (SopClass)((DictionaryEntry)iter.Current).Value;

                writer.WriteLine("        /// <summary>String UID for");
                writer.WriteLine("        /// <para>" + sopClass.name + "</para>");
                writer.WriteLine("        /// <para>UID: " + sopClass.uid + "</para>");
                writer.WriteLine("        /// </summary>");
                writer.WriteLine("        public static readonly String " + sopClass.varName + "Uid = \"" + sopClass.uid + "\";");
                writer.WriteLine("");
                writer.WriteLine("        /// <summary>SopClass for");
                writer.WriteLine("        /// <para>" + sopClass.name + "</para>");
                writer.WriteLine("        /// <para>UID: " + sopClass.uid + "</para>");
                writer.WriteLine("        /// </summary>");
                writer.WriteLine("        public static readonly SopClass " + sopClass.varName + " =");
                writer.WriteLine("                             new SopClass(\"" + sopClass.name + "\", ");
                writer.WriteLine("                                          " + sopClass.varName + "Uid, ");
                writer.WriteLine("                                          true);");
            }


            /*
             * Now, write out the constructor and the actual class
             */
            writer.WriteLine("");
            writer.WriteLine("        private readonly String _sopName;");
            writer.WriteLine("        private readonly String _sopUid;");
            writer.WriteLine("        private readonly bool _bIsMeta;");
            writer.WriteLine("");
            writer.WriteLine("        /// <summary> Property that represents the Name of the SOP Class. </summary>");
            writer.WriteLine("        public String Name");
            writer.WriteLine("        {");
            writer.WriteLine("            get { return _sopName; }");
            writer.WriteLine("        }");
            writer.WriteLine("        /// <summary> Property that represents the Uid for the SOP Class. </summary>");
            writer.WriteLine("        public String Uid");
            writer.WriteLine("        {");
            writer.WriteLine("            get { return _sopUid; }");
            writer.WriteLine("        }");
            writer.WriteLine("        /// <summary> Property that returns a DicomUid that represents the SOP Class. </summary>");
            writer.WriteLine("        public DicomUid DicomUid");
            writer.WriteLine("        {");
            writer.WriteLine("            get { return new DicomUid(_sopUid,_sopName,_bIsMeta ? UidType.MetaSOPClass : UidType.SOPClass); }");
            writer.WriteLine("        }");
            writer.WriteLine("        /// <summary> Property that represents the Uid for the SOP Class. </summary>");
            writer.WriteLine("        public bool Meta");
            writer.WriteLine("        {");
            writer.WriteLine("            get { return _bIsMeta; }");
            writer.WriteLine("        }");
            writer.WriteLine("        /// <summary> Constructor to create SopClass object. </summary>");
            writer.WriteLine("        public SopClass(String name,");
            writer.WriteLine("                           String uid,");
            writer.WriteLine("                           bool isMeta)");
            writer.WriteLine("        {");
            writer.WriteLine("            _sopName = name;");
            writer.WriteLine("            _sopUid = uid;");
            writer.WriteLine("            _bIsMeta = isMeta;");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        private static Dictionary<String,SopClass> _sopList = new Dictionary<String,SopClass>();");
            writer.WriteLine("");
            writer.WriteLine("        /// <summary>Override that displays the name of the SOP Class.</summary>");
            writer.WriteLine("        public override string ToString()");
            writer.WriteLine("        {");
            writer.WriteLine("            return this.Name;");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        /// <summary>Retrieve a SopClass object associated with the Uid.</summary>");
            writer.WriteLine("        public static SopClass GetSopClass(String uid)");
            writer.WriteLine("        {");
            writer.WriteLine("            SopClass theSop;");
            writer.WriteLine("            if (!_sopList.TryGetValue(uid, out theSop))");
            writer.WriteLine("                return null;");
            writer.WriteLine("");
            writer.WriteLine("            return theSop;");
            writer.WriteLine("        }");

            writer.WriteLine("        static SopClass()");
            writer.WriteLine("        {");

            // Standard Sops
            iter = _sopList.GetEnumerator();

            while (iter.MoveNext())
            {
                SopClass sopClass = (SopClass)((DictionaryEntry)iter.Current).Value;

                writer.WriteLine("            _sopList.Add(" + sopClass.varName + "Uid, ");
                writer.WriteLine("                         " + sopClass.varName + ");");
                writer.WriteLine("");
            }

            // Now, Meta Sops
            iter = _metaSopList.GetEnumerator();

            while (iter.MoveNext())
            {
                SopClass sopClass = (SopClass)((DictionaryEntry)iter.Current).Value;

                writer.WriteLine("            _sopList.Add(" + sopClass.varName + "Uid, ");
                writer.WriteLine("                         " + sopClass.varName + ");");
                writer.WriteLine("");
            }
            writer.WriteLine("        }");
            writer.WriteLine("");

            writer.WriteLine("    }");
            WriterFooter(writer);

            writer.Close();
        }
예제 #7
0
        /// <summary>
        /// Create the TransferSyntax.cs file.
        /// </summary>
        /// <param name="syntaxFile"></param>
        public void WriteTransferSyntaxes(String syntaxFile)
        {
            StreamWriter writer = new StreamWriter(syntaxFile);

            WriterHeader(writer);
            writer.WriteLine("    /// <summary>");
            writer.WriteLine("    /// Enumerated value to differentiate between little and big endian.");
            writer.WriteLine("    /// </summary>");
            writer.WriteLine("    public enum Endian");
            writer.WriteLine("    {");
            writer.WriteLine("        Little,");
            writer.WriteLine("        Big");
            writer.WriteLine("    }");
            writer.WriteLine("");

            writer.WriteLine("    /// <summary>");
            writer.WriteLine("    /// This class contains transfer syntax definitions.");
            writer.WriteLine("    /// </summary>");
            writer.WriteLine("    public class TransferSyntax");
            writer.WriteLine("    {");

            IEnumerator iter = _tSyntaxList.GetEnumerator();

            while (iter.MoveNext())
            {
                SopClass tSyntax = (SopClass)((DictionaryEntry)iter.Current).Value;

                writer.WriteLine("        /// <summary>String representing");
                writer.WriteLine("        /// <para>" + tSyntax.name + "</para>");
                writer.WriteLine("        /// <para>UID: " + tSyntax.uid + "</para>");
                writer.WriteLine("        /// </summary>");
                writer.WriteLine("        public static readonly String " + tSyntax.varName + "Uid = \"" + tSyntax.uid + "\";");
                writer.WriteLine("");

                String littleEndian = "";
                String encapsulated = "";
                String explicitVR   = "";
                String deflated     = "";
                String lossless     = "";
                string lossy        = "";

                GetTransferSyntaxDetails(tSyntax.uid, ref littleEndian, ref encapsulated, ref explicitVR, ref deflated, ref lossy, ref lossless);

                writer.WriteLine("        /// <summary>TransferSyntax object representing");
                writer.WriteLine("        /// <para>" + tSyntax.name + "</para>");
                writer.WriteLine("        /// <para>UID: " + tSyntax.uid + "</para>");
                writer.WriteLine("        /// </summary>");
                writer.WriteLine("        public static readonly TransferSyntax " + tSyntax.varName + " =");
                writer.WriteLine("                    new TransferSyntax(\"" + tSyntax.name + "\",");
                writer.WriteLine("                                 " + tSyntax.varName + "Uid,");
                writer.WriteLine("                                 " + littleEndian + ", // Little Endian?");
                writer.WriteLine("                                 " + encapsulated + ", // Encapsulated?");
                writer.WriteLine("                                 " + explicitVR + ", // Explicit VR?");
                writer.WriteLine("                                 " + deflated + ", // Deflated?");
                writer.WriteLine("                                 " + lossy + ", // lossy?");
                writer.WriteLine("                                 " + lossless + " // lossless?");
                writer.WriteLine("                                 );");
                writer.WriteLine("");
            }

            writer.WriteLine("        // Internal members");
            writer.WriteLine("        private static readonly Dictionary<String,TransferSyntax> _transferSyntaxes = new Dictionary<String,TransferSyntax>();");
            writer.WriteLine("        private readonly bool _littleEndian;");
            writer.WriteLine("        private readonly bool _encapsulated;");
            writer.WriteLine("        private readonly bool _explicitVr;");
            writer.WriteLine("        private readonly bool _deflate;");
            writer.WriteLine("        private readonly bool _lossless;");
            writer.WriteLine("        private readonly bool _lossy;");
            writer.WriteLine("        private readonly String _name;");
            writer.WriteLine("        private readonly String _uid;");
            writer.WriteLine("");
            writer.WriteLine("        ///<summary>");
            writer.WriteLine("        /// Constructor for transfer syntax objects");
            writer.WriteLine("        ///</summary>");
            writer.WriteLine("        public TransferSyntax(String name, String uid, bool bLittleEndian, bool bEncapsulated, bool bExplicitVr, bool bDeflate, bool bLossy, bool bLossless)");
            writer.WriteLine("        {");
            writer.WriteLine("            _uid = uid;");
            writer.WriteLine("            _name = name;");
            writer.WriteLine("            _littleEndian = bLittleEndian;");
            writer.WriteLine("            _encapsulated = bEncapsulated;");
            writer.WriteLine("            _explicitVr = bExplicitVr;");
            writer.WriteLine("            _deflate = bDeflate;");
            writer.WriteLine("            _lossy = bLossy;");
            writer.WriteLine("            _lossless = bLossless;");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        ///<summary>Override to the ToString() method, returns the name of the transfer syntax.</summary>");
            writer.WriteLine("        public override String ToString()");
            writer.WriteLine("        {");
            writer.WriteLine("            return _name;");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        ///<summary>Property representing the UID string of transfer syntax.</summary>");
            writer.WriteLine("        public String UidString");
            writer.WriteLine("        {");
            writer.WriteLine("            get { return _uid; }");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        ///<summary>Property representing the DicomUid of the transfer syntax.</summary>");
            writer.WriteLine("        public DicomUid DicomUid");
            writer.WriteLine("        {");
            writer.WriteLine("            get");
            writer.WriteLine("            {");
            writer.WriteLine("                return new DicomUid(_uid, _name, UidType.TransferSyntax);");
            writer.WriteLine("            }");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        ///<summary>Property representing the name of the transfer syntax.</summary>");
            writer.WriteLine("        public String Name");
            writer.WriteLine("        {");
            writer.WriteLine("            get { return _name; }");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        ///<summary>Property representing if the transfer syntax is encoded as little endian.</summary>");
            writer.WriteLine("        public bool LittleEndian");
            writer.WriteLine("        {");
            writer.WriteLine("            get { return _littleEndian; }");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        ///<summary>Property representing the Endian enumerated value for the transfer syntax.</summary>");
            writer.WriteLine("        public Endian Endian");
            writer.WriteLine("        {");
            writer.WriteLine("            get");
            writer.WriteLine("            {");
            writer.WriteLine("                if (_littleEndian)");
            writer.WriteLine("                    return Endian.Little;");
            writer.WriteLine("");
            writer.WriteLine("                return Endian.Big;");
            writer.WriteLine("            }");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        ///<summary>Property representing if the transfer syntax is encoded as encapsulated.</summary>");
            writer.WriteLine("        public bool Encapsulated");
            writer.WriteLine("        {");
            writer.WriteLine("            get { return _encapsulated; }");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        ///<summary>Property representing if the transfer syntax is a lossy compression syntax.</summary>");
            writer.WriteLine("        public bool LossyCompressed");
            writer.WriteLine("        {");
            writer.WriteLine("            get { return _lossy; }");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        ///<summary>Property representing if the transfer syntax is a lossless compression syntax.</summary>");
            writer.WriteLine("        public bool LosslessCompressed");
            writer.WriteLine("        {");
            writer.WriteLine("            get { return _lossless; }");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        ///<summary>Property representing if the transfer syntax is encoded as explicit Value Representation.</summary>");
            writer.WriteLine("        public bool ExplicitVr");
            writer.WriteLine("        {");
            writer.WriteLine("            get { return _explicitVr; }");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        ///<summary>Property representing if the transfer syntax is encoded in deflate format.</summary>");
            writer.WriteLine("        public bool Deflate");
            writer.WriteLine("        {");
            writer.WriteLine("            get { return _deflate; }");
            writer.WriteLine("        }");
            writer.WriteLine("");
            writer.WriteLine("        /// <summary>");
            writer.WriteLine("        /// Get a TransferSyntax object for a specific transfer syntax UID.");
            writer.WriteLine("        /// </summary>");
            writer.WriteLine("        public static TransferSyntax GetTransferSyntax(String uid)");
            writer.WriteLine("        {");
            writer.WriteLine("            TransferSyntax theSyntax;");
            writer.WriteLine("            if (!_transferSyntaxes.TryGetValue(uid, out theSyntax))");
            writer.WriteLine("                return null;");
            writer.WriteLine("");
            writer.WriteLine("            return theSyntax;");
            writer.WriteLine("        }");
            writer.WriteLine("");

            writer.WriteLine("        static TransferSyntax()");
            writer.WriteLine("        {");

            iter = _tSyntaxList.GetEnumerator();

            while (iter.MoveNext())
            {
                SopClass tSyntax = (SopClass)((DictionaryEntry)iter.Current).Value;

                writer.WriteLine("            _transferSyntaxes.Add(" + tSyntax.varName + "Uid,");
                writer.WriteLine("                                  " + tSyntax.varName + ");");
                writer.WriteLine("");
            }

            writer.WriteLine("        }");

            writer.WriteLine("    }");
            WriterFooter(writer);

            writer.Close();
        }