你好,源代码中有个方法可以从DicomDataSet转XML, 如下面的代码,同时从还有个 GetDicomJSON的方法,请问有没有现成的方法直接从DicomDataSet中获取JSON
1.DicomDataSet转XML
public static void ToXml(this DicomDataSet ds, XmlWriter xmlWriter)
{
xmlWriter.WriteStartElement("dataset");
DicomElement element = ds.GetFirstElement(null, true, true);
while (element != null)
{
SaveXmlElement(ds, xmlWriter, element);
element = ds.GetNextElement(element, true, true);
}
xmlWriter.WriteEndElement();
}
2.GetDicomJSON的方法
public string GetDicomJSON(string referencedFile)
{
if (!string.IsNullOrEmpty(referencedFile))
{
using (var dicomSourceProxy = new DicomSourceProxy(DataCache))
{
var query = new ViewImageQuery() { FileName = referencedFile, Meta = "json" };
try
{
using (var result = dicomSourceProxy.LoadMeta(query))
{
return (string)result.Meta;
}
}
catch
{
}
}
}
return string.Empty;
}
|
|