/// <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); }
/// <summary> /// VisitEnter method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="sopClass">The SopClass 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 VisitEnterSopClass(SopClass sopClass) { stringBuilder.Append("Stringdump using SopClassStringDumpVisitor2\n"); stringBuilder.Append(prefix + "SOP Class:\n"); stringBuilder.Append(prefix + " Path: \"" + sopClass.Path + "\"\n"); stringBuilder.Append(prefix + " System name: " + sopClass.SystemName + "\n"); stringBuilder.Append(prefix + " System version: " + sopClass.SystemVersion + "\n"); stringBuilder.Append(prefix + " Name: " + sopClass.Name + "\n"); stringBuilder.Append(prefix + " UID: " + sopClass.Uid + "\n"); stringBuilder.Append(prefix + " DimseDataSetsPairs\n"); this.prefix += " "; return(true); }
/// <summary> /// VisitLeave method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="sopClass">The SopClass 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 VisitLeaveSopClass(SopClass sopClass) { this.prefix = this.prefix.Substring(0, this.prefix.Length - 4); return(true); }
/// <summary> /// VisitEnter method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="sopClass">The SopClass 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 VisitEnterSopClass(SopClass sopClass) { return (true); }
/// <summary> /// VisitLeave method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="sopClass">The SopClass 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 virtual bool VisitLeaveSopClass(SopClass sopClass) { return (true); }
/// <summary> /// Constructor. /// </summary> /// <param name="parent">The parent SOP Class that contains this instance.</param> private DimseDataSetPair(SopClass parent) { this.parent = parent; this.dataSet = new DataSet(this); }
/// <summary> /// VisitEnter method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="sopClass">The SopClass 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 VisitEnterSopClass(SopClass sopClass) { return(true); }
/// <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); }
/// <summary> /// VisitLeave method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="sopClass">The SopClass 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 virtual bool VisitLeaveSopClass(SopClass sopClass) { return(true); }
/// <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); }
/// <summary> /// VisitLeave method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="sopClass">The SopClass 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 VisitLeaveSopClass(SopClass sopClass) { this.prefix = this.prefix.Substring(0, this.prefix.Length - 4); return (true); }
/// <summary> /// VisitEnter method in the context of the "Hierarchical Visitor Pattern". /// See "DVTk_Library\Documentation\Design\Hierarchical Visitor Pattern.htm". /// </summary> /// <param name="sopClass">The SopClass 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 VisitEnterSopClass(SopClass sopClass) { stringBuilder.Append("Stringdump using SopClassStringDumpVisitor2\n"); stringBuilder.Append(prefix + "SOP Class:\n"); stringBuilder.Append(prefix + " Path: \"" + sopClass.Path + "\"\n"); stringBuilder.Append(prefix + " System name: " + sopClass.SystemName + "\n"); stringBuilder.Append(prefix + " System version: " + sopClass.SystemVersion + "\n"); stringBuilder.Append(prefix + " Name: " + sopClass.Name + "\n"); stringBuilder.Append(prefix + " UID: " + sopClass.Uid + "\n"); stringBuilder.Append(prefix + " DimseDataSetsPairs\n"); this.prefix += " "; return (true); }
/// <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); }