如何将元数据添加到dicom文件? [英] How can I add metadata to a dicom file?

查看:352
本文介绍了如何将元数据添加到dicom文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是其他问题的延续。我正在尝试从jpg图像和我在Java程序中编写的一些元数据获取dicom文件。我有用于添加元数据的代码,但它似乎并不完整,所以我不知道还需要包含什么。



我尝试了一个简单的代码,添加了一些属性

  Attributes attribs = new Attributes();但是我遇到了一些错误,所以我发现有一些强制性标签。 

attribs.setString(Tag.StudyDate,VR.DA, 20110404 );
attribs.setString(Tag.StudyTime,VR.TM, 15);



之后,我尝试了此操作,但我仍然缺少一些属性:

  meta.setInt(Tag.FileMetaInformationGroupLength,VR.UL,data.length); 
meta.setString(Tag.TransferSyntaxUID,VR.UI, 1.2.840.10008.1.2.1);

谢谢

解决方案

根据您提供的信息(请参阅评论),我怀疑存在以下情况:



DICOM文件具有两个主要组成部分:




  • 元标题描述DICOM对象
    的编码(以及其他META方面)

  • DICOM对象(数据集)本身由标题数据
    和像素数据组成(实际上,像素数据只是一个特定属性,
    就是标题数据和像素数据



元头的所有属性都属于组0x0002。错误消息表明您正在尝试写属性



我无法透露更多信息,因为您发布的代码无法说明属性对象所属的位置。 ,您正在某处尝试将属性添加到元。



关于哪些属性是强制性的:很多,这取决于您要创建的对象的类型,即它是否是计算机射线照相术,内窥镜视频…… p>

DICOM第3部分是为特定类型的对象(DICOM称为 SOP类)获取强制性可选属性的参考。


This is in continuation with other question. I am trying to obtained a dicom file from a jpg image and some metadata I writte myself in the java program. I have this code for adding metadata but it seems to be incomplete, so I don´t know what else I need to include.

I tried a simple code adding some attributes but I get some errors, so I found that there are some mandatory tags.

Attributes attribs = new Attributes();

attribs.setString(Tag.StudyDate, VR.DA, "20110404"); attribs.setString(Tag.StudyTime, VR.TM, "15");

After that I tried this but I still missing some attributes:

meta.setInt(Tag.FileMetaInformationGroupLength, VR.UL, data.length);
meta.setString(Tag.TransferSyntaxUID, VR.UI, "1.2.840.10008.1.2.1");

Thank you

解决方案

With the information you are providing (see comment), I suspect that the following situation applies:

DICOM files have two main components:

  • The Meta-Header describing the encoding (and other META aspects) of the DICOM object
  • The DICOM object (dataset) itself consisting of "header data" and "pixel data" (in fact, pixel data is just a particular attribute, so "header data" and "pixel data" is kind of colloquial language.

All attributes of the meta header belong to group 0x0002. The error message says that you are trying to write attributes belonging to the dataset to the metadata which is not allowed.

I cannot tell more because the code you posted does not tell where the "Attributes" object belongs to. But apparently, you are somewhere trying to add "Attributes" to "meta".

About "Which attributes are mandatory": Quite a lot, and this depends on the type of object you are creating, i.e. whether it is Computed Radiography, Endoscopic Video, ...

DICOM Part 3 is your reference to obtain mandatory an optional attribute for a particular type of object which DICOM refers to as "SOP Class".

这篇关于如何将元数据添加到dicom文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆