DICOM tag相關,參考這個文章:http://www.jianshu.com/p/c4e9e18195eb ,或者 http://zhwhong.ml/2017/03/27/LIDC-Dicom-data-and-XML-annotation-parse/
下文摘自:http://blog.csdn.net/wenzhi20102321/article/details/75127101
dicom文件tag詳解
Dicom全稱是醫學數字圖像與通訊,這里講diocm格式文件的tag標記做詳細解讀。
dicom中文協議文檔:http://download.csdn.net/download/wenzhi20102321/9897014
dicom文件結構:

dicom文件,整體結構先是128字節所謂的導言部分,跳過就是了,然后是dataElement元素依次排列的方式, 就是一個dataElement接一個dataElement的方式排到文件結尾.我們要讀取dicom里面的各種數據就是在各個數據元素中。通俗的講dataElement就是指tag,就是破Dicom標准里定義的數據字典,每個dataElement中的tag決定自身或整個文件的某些數據類型或自身dataElement內容類別。
標記tag(2字節UInt16分組號和2字節UInt16元素號);
tag是4個字節表示的 前兩字節是組號后兩字節是元素號 比如0008(組號) 0018(元素號)。
我們獲取dicom里面的數據,就是根據tag,來知道這個dataElement里面是否是我們需要的數據,然后讀取該dataElement里面的數據。
一般我們獲取dataElement中的數據的主要組號
0002組描述設備通訊,0008組描述特征參數,0010組描述患者信息,0028組描述圖像信息參數
根據這些組號,我們大概就知道這個組的tag里面存放什么數據了吧!
還是有很多其他組號的,但是里面的數據不常用到,tag總共大約有2000個,但是我們常用的數據就那么幾個!
dicom文件數據中所有dataElement從前到后按tag又可簡單分段:文件元tag,普通tag,像素tag。
1.文件元tag(組號+0000):不受傳輸語法影響,總是以顯示VR方式表示,因為它里面就定義了傳輸語法;文件元tag的dataElement,並沒有多大的意義,它的VF數值是整個組所有dataElement的字節長度,一個dicom中可以只有一個文件元tag,也可以有多個文件元tag。
2.普通tag:除了文件元tag和像素tag,其余的都是普tag數據。包括:圖像寬,高,數據傳輸格式,病人姓名,病人生日,病歷醫院,病歷科室,病情的描述等等數據;
3.像素tag(7fe0,0010):表示dataElement存儲的是病歷的圖像數據。
上面這段話,信息量其實是很多的,比如什么是顯示VR、隱式VR,傳輸語法又是怎么回事?
最關鍵的兩個tag:
1.tag:0002,0010,決定普通tag的讀取方式 little字節序還是big字節序,隱式VR還是顯示VR。由它的值決定
2.tag:7fe0,0010,像素數據開始處
使用工具snate DICOM打開dicom文件,查看數據效果:
工具下載地址,下載后直接用:http://download.csdn.net/download/wenzhi20102321/9895616
上面圖片每一行數據就是一個dataElement數據,可以看到tag值,VR值,VL值,VF值。
但是一般工具也是看不到圖像的tag數據,因為他的VF數據有幾萬個字節,怎么顯示!
上面可以看到tag的組號和元素號,都是按照順序從小到大的順序排列的,dicom中dataElement也是這樣排列的。
所以dicom文件都是前面先讀取到很多數據,最后面再讀取圖像的字節數據。
下面是一部分重要的tag展示:
Patient Tag
| Group(組號) | Element(元素號) | Tag Description | 中文解釋 | VR |
|---|---|---|---|---|
| 0010 | 0010 | Patient’s Name | 患者姓名 | PN |
| 0010 | 0020 | P1atient | ID患者ID | LO |
| 0010 | 0030 | Patient’s Birth Date | 患者出生日期 | DA |
| 0010 | 0032 | Patient’s Birth Time | 患者出生時間 | TM |
| 0010 | 0040 | Patient’s Sex | 患者性別 | CS |
| 0010 | 1030 | Patient’s Weight | 患者體重 | DS |
| 0010 | 21C0 | Pregnancy Status | 懷孕狀態 | US |
Study Tag
| Group | Elemen | Tag Description | 中文解釋 | VR |
|---|---|---|---|---|
| 0008 | 0050 | Accession Number:A RIS generated number that identifies the order for the Study. | 檢查號:RIS的生成序號,用以標識做檢查的次序. | SH |
| 0020 | 0010 | Study ID | 檢查ID. | SH |
| 0020 | 000D | Study Instance UID: Unique identifier for the Study. | 檢查實例號:唯一標記不同檢查的號碼. | UI |
| 0008 | 0020 | Study Date: Date the Study started. | 檢查日期:檢查開始的日期. | DA |
| 0008 | 0030 | Study Time:Time the Study started. | 檢查時間:檢查開始的時間. | TM |
| 0008 | 0061 | Modalities in Study | 一個檢查中含有的不同檢查類型. | CS |
| 0008 | 0015 | Body Part Examined | 檢查的部位. | CS |
| 0008 | 1030 | Study Description | 檢查的描述. | LO |
| 0010 | 1010 | Patient’s Age | 做檢查時刻的患者年齡,而不是此刻患者的真實年齡. | AS |
Series Tag
| Group | Element | Tag Description | 中文解釋 | VR |
|---|---|---|---|---|
| 0020 | 0011 | Series Number:A number that identifies this Series. | 序列號:識別不同檢查的號. | IS |
| 0020 | 000E | Series Instance UID:Unique identifier for the Series. | 序列實例號:唯一標記不同序列的號碼. | UI |
| 0008 | 0060 | Modality | 檢查模態(MRI/CT/CR/DR) | CS |
| 0008 | 103E | Series Description | 檢查描述和說明 | LO |
| 0008 | 0021 | Series Date | 檢查日期 | DA |
| 0008 | 0031 | Series Time | 檢查時間 | TM |
| 0020 | 0032 | Image Position (Patient):The x, y and z coordinates of the upper left hand corner of the image, in mm. | 圖像位置:圖像的左上角在空間坐標系中的x,y,z坐標,單位是毫米.如果在檢查中,則指該序列中第一張影像左上角的坐標. | DS |
| 0020 | 0037 | Image Orientation (Patient):The direction cosines of the first row and the first column with respect to the patient. | 圖像方位 | DS |
| 0018 | 0050 | Slice Thickness:Nominal slice thickness, in mm. | 層厚. | DS |
| 0018 | 0088 | Spacing Between Slices | 層與層之間的間距,單位為mm | DS |
| 0020 | 1041 | Slice Location:Relative position of exposure expressed in mm. | 實際的相對位置,單位為mm. | DS |
| 0018 | 0023 | MR Acquisition | 收購者 | CS |
| 0018 | 0015 | Body Part Examined | 身體部位. | CS |
Image Tag
| Group | Element | Tag Description | 中文解釋 | VR |
|---|---|---|---|---|
| 0008 | 0008 | Image Type:Image identification characteristics. | 。 | CS |
| 0008 | 0018 | SOP Instance UID | SOP實例 | UID. |
| 0008 | 0023 | Content Date:The date the image pixel data creation started. | 影像拍攝的日期. | DA |
| 0008 | 0033 | Content Time | 影像拍攝的時間. | TM |
| 0020 | 0013 | Image/Instance Number:A number that identifies this image. | 圖像碼:辨識圖像的號碼. | IS |
| 0028 | 0002 | Samples Per Pixel:Number of samples (planes) in this image. | 圖像上的采樣率. | US |
| 0028 | 0004 | Photometric Interpretation:Specifies the intended interpretation of the pixel data. | 光度計的解釋,對於CT圖像,用兩個枚舉值MONOCHROME1,MONOCHROME2.用來判斷圖像是否是彩色的,MONOCHROME1/2是灰度圖, RGB則是真彩色圖,還有其他. | CS |
| 0028 | 0010 | Rows: Number of rows in the image. | 圖像的總行數,行分辨率. | US |
| 0028 | 0011 | Columns: Number of columns in the image. | 圖像的總列數,列分辨率. | US |
| 0028 | 0030 | Pixel Spacing:Physical distance in the patient between the center of each pixel. | 像素間距.像素中心之間的物理間距. | DS |
| 0028 | 0100 | Bits Allocated:Number of bits allocated for each pixel sample. Each sample shall have the same number of bits allocated. | 分配的位數:存儲每一個像素值時分配的位數,每一個樣本應該擁有相同的這個值. | US |
| 0028 | 0101 | Bits Stored:Number of bits stored for each pixel sample. Each sample shall have the same number of bits stored | 存儲的位數:有12到16列舉值.存儲每一個像素用的位數.每一個樣本應該有相同值. | US |
| 0028 | 0102 | High Bit:Most significant bit for pixel sample data. Each sample shall have the same high bit. | 高位. | US |
| 0028 | 0103 | Pixel Representation:Data representation of the pixel samples. Each sample shall have the same pixel representation.Enum: 0000H=unsigned integer,0001H=2’s omplement. | 像素數據的表現類型:這是一個枚舉值,分別為十六進制數0000和0001.0000H = 無符號整數,0001H = 2的補碼. | US |
| 0028 | 1050 | Window Center | 窗位. | DS |
| 0028 | 1051 | Window Width | 窗寬. | DS |
| 0028 | 1052 | Rescale Intercept:The value b in relationship between stored values (SV) and the output units.Output units = m*SV + b.Required if Modality LUT Sequence (0028, 0030) is not present. | 截距:如果表明不同模態的LUT顏色對應表不存在時,則使用方程Units = m*SV + b,計算真實的像素值到呈現像素值。其中這個值為表達式中的b。 | DS |
| 0028 | 1053 | Rescale Slope:m in the equation specified by Rescale Intercept (0028,1052).Required if Rescale Intercept is present. | 斜率.這個值為表達式中的m。 | DS |
| 0028 | 1054 | Rescale Type:Specifies the output units of Rescale Slope (0028,1053) and Rescale Intercept (0028,1052).Enum: US=Unspecified Requried if Photometric Interpretation is MONOCHROME2, and Bits Stored is greater than 1.This specifies an identity Modality LUT transformation. | 輸出值的單位.這是一個枚舉值, | LO |
所有dicom的tag列表(英文版):http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/DICOM.html
看了這些tag,應該對dicom文件有了更多了了解吧。
關於VR的詳細知識,可以看我詳細介紹VR的博客頁面。
其實這些數據用得並不多,一般就用到病人的姓名,病人ID,醫院,科室,還有設置圖像要用到圖形的窗位和窗寬。
dicom傳輸的相關知識也只能介紹到這里,很多知識還沒有理解透徹,只是把這些知識羅列出來,給大家參考一下!
dicom文件解析知識的其他地址:
1.dicom文件詳解
http://blog.csdn.net/wenzhi20102321/article/details/75127362
2.dicom文件的值類型VR詳解
http://blog.csdn.net/wenzhi20102321/article/details/75127140
3.dicom文件tag詳解
http://blog.csdn.net/wenzhi20102321/article/details/75127101
4.android 解析並顯示dicom文件的數據和圖像
http://blog.csdn.net/wenzhi20102321/article/details/75040225
5.java代碼使用ImageJ解析dicom文件成圖片
http://blog.csdn.net/wenzhi20102321/article/details/74995084
前面5個是我自己寫的,后面是一些我自己看過的相關資料:
6.Dicom文件解析
http://blog.csdn.net/leaf6094189/article/details/8510325
7.使用dcm4che3獲取Dicom的bmp格式縮略圖
http://blog.csdn.net/Kerrigeng/article/details/60866656
8.使用dcm4che3解析DICOM中,中文亂碼問題
http://blog.csdn.net/Kerrigeng/article/details/53942846
9.使用dcm4che3對jpeg壓縮的dcm文件進行解壓
http://blog.csdn.net/Kerrigeng/article/details/62215647
10.DICOM的常用Tag分類和說明
http://www.cnblogs.com/stephen2014/p/4579443.html
11.dicom的大牛zssure的博客,幾十篇文章
http://blog.csdn.net/zssureqh/article/category/1389985
12.dicom協議中文文檔下載
http://download.csdn.net/detail/wenzhi20102321/9897014
