Exemplo n.º 1
0
        /// <summary>
        /// Create a DimseDataSetPair instance using a raw xml file (that is generated by the ODD).
        /// </summary>
        /// <param name="parent">The parent of the instance to create.</param>
        /// <param name="dimseNode">A Dimse node.</param>
        /// <returns>The created DimseDataSetPair instance.</returns>
        public static DimseDataSetPair Create(SopClass parent, XPathNavigator dimseNode)
        {
            DimseDataSetPair dimseDataSetPair = new DimseDataSetPair(parent);

            dimseDataSetPair.dimseName = dimseNode.GetAttribute("Name", "");

            XPathNodeIterator dataSetNodes = dimseNode.Select("Dataset");

            if (dataSetNodes.MoveNext())
            {
                dimseDataSetPair.dataSetName = dataSetNodes.Current.GetAttribute("Name", "");

                XPathNodeIterator moduleNodes = dataSetNodes.Current.Select("Module");

                foreach (XPathNavigator moduleNode in moduleNodes)
                {
                    Module module = Module.Create(moduleNode);
                    dimseDataSetPair.modules.Add(module);
                }
            }
            else
            {
                dimseDataSetPair = null;
            }

            return(dimseDataSetPair);
        }
Exemplo n.º 2
0
        /// <summary>
        /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="dimseDataSetPair">The DimseDataSetPair instance to visit.</param>
        /// <returns>
        /// true: traverse the children of this instance.
        /// false: do not traverse the children of this instance.
        /// </returns>
        public override bool VisitEnterDimseDataSetPair(DimseDataSetPair dimseDataSetPair)
        {
            stringBuilder.Append(this.prefix + "DimseDataSetPair\n");
            stringBuilder.Append(this.prefix + "  Dimse name: " + dimseDataSetPair.DimseName + "\n");
            stringBuilder.Append(this.prefix + "  DataSet name: " + dimseDataSetPair.DataSetName + "\n");
            stringBuilder.Append(this.prefix + "  Attributes\n");

            this.prefix += "    ";

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="dimseDataSetPair">The DimseDataSetPair instance to visit.</param>
        /// <returns>
        /// true: traverse the children of this instance.
        /// false: do not traverse the children of this instance.
        /// </returns>
        public override bool VisitEnterDimseDataSetPair(DimseDataSetPair dimseDataSetPair)
        {
            stringBuilder.Append(this.prefix + "DimseDataSetPair\n");
            stringBuilder.Append(this.prefix + "  Dimse name: " + dimseDataSetPair.DimseName + "\n");
            stringBuilder.Append(this.prefix + "  DataSet name: " + dimseDataSetPair.DataSetName + "\n");
            stringBuilder.Append(this.prefix + "  Attributes\n");

            this.prefix += "    ";

            return (true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// VisitLeave method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="dimseDataSetPair">The DimseDataSetPair instance to visit.</param>
        /// <returns>
        /// true: continue traversing the siblings of the supplied instance.
        /// false: stop traversing the siblings of the supplied instance.
        /// </returns>
        public override bool VisitLeaveDimseDataSetPair(DimseDataSetPair dimseDataSetPair)
        {
            this.prefix = this.prefix.Substring(0, this.prefix.Length - 4);

            return(true);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="parent">The DimseDataSetPair this instance is part of.</param>
 public DataSet(DimseDataSetPair parent)
 {
     this.parent = parent;
 }
Exemplo n.º 6
0
 // -------------------------------
 // - Begin public methods region -
 // -------------------------------
 /// <summary>
 /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
 /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
 /// </summary>
 /// <param name="dimseDataSetPair">The DimseDataSetPair instance to visit.</param>
 /// <returns>
 /// true: traverse the children of this instance.
 /// false: do not traverse the children of this instance.
 /// </returns>
 public virtual bool VisitEnterDimseDataSetPair(DimseDataSetPair dimseDataSetPair)
 {
     return (true);
 }
Exemplo n.º 7
0
        /// <summary>
        /// Create a DimseDataSetPair instance using a raw xml file (that is generated by the ODD).
        /// </summary>
        /// <param name="parent">The parent of the instance to create.</param>
        /// <param name="dimseNode">A Dimse node.</param>
        /// <returns>The created DimseDataSetPair instance.</returns>
        public static DimseDataSetPair Create(SopClass parent, XPathNavigator dimseNode)
        {
            DimseDataSetPair dimseDataSetPair = new DimseDataSetPair(parent);

            dimseDataSetPair.dimseName = dimseNode.GetAttribute("Name", "");

            XPathNodeIterator dataSetNodes = dimseNode.Select("Dataset");

            if (dataSetNodes.MoveNext())
            {
                dimseDataSetPair.dataSetName = dataSetNodes.Current.GetAttribute("Name", "");

                XPathNodeIterator moduleNodes = dataSetNodes.Current.Select("Module");

                foreach (XPathNavigator moduleNode in moduleNodes)
                {
                    Module module = Module.Create(moduleNode);
                    dimseDataSetPair.modules.Add(module);
                }
            }
            else
            {
                dimseDataSetPair = null;
            }

            return (dimseDataSetPair);
        }
Exemplo n.º 8
0
        // -------------------------------
        // - Begin public methods region -
        // -------------------------------

        /// <summary>
        /// VisitEnter method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="dimseDataSetPair">The DimseDataSetPair instance to visit.</param>
        /// <returns>
        /// true: traverse the children of this instance.
        /// false: do not traverse the children of this instance.
        /// </returns>
        public virtual bool VisitEnterDimseDataSetPair(DimseDataSetPair dimseDataSetPair)
        {
            return(true);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Create a SOP Class instance using a raw xml file (that is generated by the ODD).
        /// </summary>
        /// <param name="path">The file path.</param>
        /// <returns>The created SopClass instance.</returns>
        public static SopClass Create(string path)
        {
            SopClass sopClass = new SopClass();

            try
            {
                XPathNodeIterator systemNodes   = null;
                XPathNodeIterator sopClassNodes = null;
                XPathNodeIterator dimseNodes    = null;

                sopClass.path = path;

                XPathDocument  document  = new XPathDocument(path);
                XPathNavigator navigator = document.CreateNavigator();


                //
                // Determine system name and system version.
                //

                systemNodes = navigator.Select("/System");
                if (systemNodes.MoveNext())
                {
                    sopClass.systemName    = systemNodes.Current.GetAttribute("Name", "");
                    sopClass.systemVersion = systemNodes.Current.GetAttribute("Version", "");

                    if ((sopClass.systemName.Length == 0) || (sopClass.systemVersion.Length == 0))
                    {
                        throw new Exception("System name and/or system version not found.");
                    }
                }
                else
                {
                    throw new Exception("/System node not found in \"" + path + "\"");
                }


                //
                // Determine name and UID.
                //

                if (sopClass != null)
                {
                    sopClassNodes = systemNodes.Current.Select("ApplicationEntity/SOPClass");
                    if (sopClassNodes.MoveNext())
                    {
                        sopClass.name = sopClassNodes.Current.GetAttribute("Name", "");
                        sopClass.uid  = sopClassNodes.Current.GetAttribute("UID", "");

                        if ((sopClass.name.Length == 0) || (sopClass.uid.Length == 0))
                        {
                            throw new Exception("Name and/or uid not found.");
                        }
                    }
                    else
                    {
                        throw new Exception("SOPClass node not found.");
                    }
                }


                //
                // Determine DimseDataSetPairs.
                //

                if (sopClass != null)
                {
                    dimseNodes = sopClassNodes.Current.Select("Dimse");

                    foreach (XPathNavigator dimseNode in dimseNodes)
                    {
                        string dimseName = dimseNode.GetAttribute("Name", "");

                        if (dimseName.Substring(dimseName.Length - 2, 2) == "RQ")
                        {
                            DimseDataSetPair dimseDataSetPair = DimseDataSetPair.Create(sopClass, dimseNode);
                            sopClass.DimseDataSetPairs.Add(dimseDataSetPair);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                throw new Exception("Exception occured while reading file \"" + path + "\".\n" + exception.Message);
            }

            return(sopClass);
        }
Exemplo n.º 10
0
        /// <summary>
        /// VisitLeave method in the context of the "Hierarchical Visitor Pattern".
        /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm".
        /// </summary>
        /// <param name="dimseDataSetPair">The DimseDataSetPair instance to visit.</param>
        /// <returns>
        /// true: continue traversing the siblings of the supplied instance.
        /// false: stop traversing the siblings of the supplied instance.
        /// </returns>
        public override bool VisitLeaveDimseDataSetPair(DimseDataSetPair dimseDataSetPair)
        {
            this.prefix = this.prefix.Substring(0, this.prefix.Length - 4);

            return (true);
        }
Exemplo n.º 11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="parent">The DimseDataSetPair this instance is part of.</param>
 public DataSet(DimseDataSetPair parent)
 {
     this.parent = parent;
 }