本文记录了我对
DICOM
3.0标准中,关于DICOM
文件格式的浅薄理解
参考文章
http://dicom.nema.org/medical/dicom/current/output/pdf/part05.pdf
http://dicom.nema.org/medical/dicom/current/output/pdf/part06.pdf
http://dicom.nema.org/medical/dicom/current/output/pdf/part10.pdf
File Meta Info
The File Meta Information includes identifying information on the encapsulated Data Set. This header consists of a 128 byte
FilePreamble
, followed by a 4 byteDICOM
prefix, followed by the File Meta Elements shown in Table 7.1-1. This header shall be present in everyDICOM
file
文件信息头包含了一些特征信息,这些信息用于识别后续的存放像素数据的Data Set。
文件头由三个部分构成
-
128字节的前导序码,或者叫序言,一般固定不变的
-
4字节的标识符,标志这是个
DICOM
文件,如果校验失败,直接拒绝读取 -
不确定长度的File Meta Elements
序言
The File Preamble is available for use as defined by Application Profiles or specific implementations. This Part of the
DICOM
Standard does not require any structure for this fixed size Preamble. It is not required to be structured as aDICOM
Data Element with a Tag and a Length. It is intended to facilitate access to the images and other data in theDICOM
file by providing compatibility with a number of commonly used computer image file formats. Whether or not the File Preamble contains information, theDICOM
File content shall conform to the requirements of this Part and the Data Set shall conform to the SOP Class specified in the File Meta Information.If the File Preamble is not used by an Application Profile or a specific implementation, all 128 bytes shall be set to
00H
. This is intended to facilitate the recognition that the Preamble is used when all 128 bytes are not set as specified above.The File Preamble may for example contain information enabling a multi-media application to randomly access images stored in a
DICOM
Data Set. The same file can be accessed in two ways: by a multi-media application using the preamble and by aDICOM
Application that ignores the preamble.
翻译成人话就是:
-
本标准没有对序言部分做任何限制,即便这128个字节里全是乱码,也不应该影响后续的Data Set。之所以预留这128个字节,是为了开发者新增功能时对其他图片格式的兼容,或者是一些应用的特定配置要求。
-
如果你没有用这128个字节做一些特别的功能,务必把它们全设成
00H
。这样便于程序识别 -
举个使用的例子:我希望用自己开发的一款多媒体显示器
LJJ Demo
,去查看一个dcm
文件,但我可能并没有严格实现DICOM
协议的细节,但我又想强行打开。那么我可以在序言里加入一些字段声明该dcm
文件允许LJJ Demo
查看
标识符
The four byte
DICOM
Prefix shall contain the character string "DICM
" encoded as uppercase characters of the ISO 8859G0
Character Repertoire. This four byte prefix is not structured as aDICOM
Data Element with a Tag and a Length
就是四个大写字母,DCIM
File Meta Elements 文件可变元素集合
注意,前面的序言和标识符其实也是两个element,只不过比较特殊,没有定义到Tag列表中。所以单拿出来讲了
Tag
DICOM
标准对信息有很多层分类,其中有两层是这样的,第一层是Group,第二层是Element
Tag = (Group Number, Element Number) 单位是16进制
标准把所有可能的element都列成表格,配上对应的Tag,这样开发者就不能自定义属性了,所有人必须用Tag访问规定的属性