c# - JSON 输出中的 DICOM RetrieveURL 标记为空
问题描述
我正在使用 aDicomDataSet
添加标签及其值,如下所示:
....
var ds = new DicomDataSet();
ds.Initialize(DicomClassType.StudyRootQueryStudy, DicomDataSetInitializeFlags.None);
ds.InsertElementAndSetValue(DicomTag.QueryRetrieveLevel, "STUDY");
ds.InsertElementAndSetValue(DicomTag.SpecificCharacterSet, "ISO_IR192");
ds.InsertElementAndSetValue(DicomTag.RetrieveURL, "http://localhost/Service/api/wado-rs/studies/" + row.StudyInstanceUID);
....
当我json
按照这个链接ds
制作时,我看不到00081190
类似json
的价值。
制作json
文件截断代码:
string jsonFileNameOut = Path.Combine(@"C:\Study", $"{DateTime.Now.Ticks}.json");
// Save as JSON with no binary data
// For the demo, keep the json output file size small by skipping the pixel data
const DicomDataSetSaveJsonFlags jsonFlags = DicomDataSetSaveJsonFlags.IgnoreBinaryData |
DicomDataSetSaveJsonFlags.TrimWhiteSpace;
ds.SaveJson(jsonFileNameOut, jsonFlags);
为什么RetrieveUrl( ) 标记的vr
值表示是(未知),输出如下所示:81190
UN
[{
"00080005" : {
"vr" : "CS",
"Value" : [
"ISO_IR 192"
]
},
"00080052" : {
"vr" : "CS",
"Value" : [
"STUDY"
]
},
"00081190" : {
"vr" : "UN"
}
}]
解决方案
I finally got the solution after reading many articles I decide post the solution here for those that don't know this like me.
So in DICOM protocol there are some private tags that vr
(Value Representation) for them is UN
by default after parsing to json
or xml
so they won't present in out put.
So we should make private tag to public and set vr
manually for them like what I do below:
DicomElement dm = ds.InsertElement(null, false, DicomTag.RetrieveURL, DicomVRType.UT, false, 1);
if (dm != null)
{
ds.FreeElementValue(dm);
ds.SetStringValue(dm, url, DicomCharacterSetType.UnicodeInUtf8);
}
the problem resolved by InsertElement
and SetStringValue
.
推荐阅读
- c++ - 将类型为“int”的临时转换为引用安全吗?
- java - 连接数据集并重命名一列
- javascript - 带有一个输入字段的 HTML 表单提交返回:未捕获的类型错误:将循环结构转换为 JSON
- git - 如何在不使用远程的情况下连接多个本地 git 存储库?
- android - 领域无法在新线程中执行 executeTransaction
- c++ - 带有模板类和动态调度的 C++ shared_pointer
- java - WiFi getSSID() 总是返回“
" - java - 子类调用时Java获取超类方法以使用子类实例方法
- python - 获取 Python 列表中当前元素的索引
- python - Doc2Vec:获取标签的文本