【转】DICOM中几个判断图像方向的tag
轉自:https://www.cnblogs.com/h2zZhou/p/9072967.html
在DICOM標準里,有三個TAG與成像的方向相關。
參考來源:Kitware關于DICOM方向的說明
http://public.kitware.com/IGSTKWIKI/index.php/DICOM_data_orientation
包括
1、Image Position (0020,0032): specifies the x, y, and z coordinates of the upper left hand corner of the image. In other words, this tag specifies the coordinates of the the first voxel transmitted.
圖像位置:指示了圖像左上角的第一個像素的空間坐標(x,y,z)。 也就是DICOM文件傳輸的第一個像素的坐標
2、Image Orientation (0020,0037): specifies the direction cosines of the first row and the first column with respect to the patient. The direction of the axes are defined by the patients orientation to ensure LPS system ( x-axis increasing to the left hand side of the patient, y-axis increasing to the posterior side of the patient and z-axis increasing toward the head of the patient )
圖像方向:指示了圖像第一行和第一列相對于病人的方向cosine。 坐標軸的方向是根據病人的方向來確定的(X軸指向病人的左手邊,y軸指向病人的后面,Z軸指向病人的頭部。
3、Patient position( 0018,5100)?: Patient position descriptor relative to the equipment. Required for CT and MR images. Possible values: HFP= head first-prone, HFS=head first-supine, HFDR= head first-decibitus right, HFDL = head first-decubiturs left, FFP = feet first-prone, FFS, FFDR, FFDL.
病人的位置: ?是描述病人相對于CT或者MR等成像設備的位置。 HFP:頭部在前,俯臥; HFS:頭在前,仰臥
一個例子:
某個切片 m:
0020,0032 ?Image Position (Patient): -99.8046875/-282.8046875/94.25
0020,0037 ?Image Orientation (Patient): 1/0/0/0/1/0?
0018,5100 ?Patient Position: HFS?
另外一個切片n:
0020,0032 ?Image Position (Patient): -99.8046875/-282.8046875/157.5
0020,0037 ?Image Orientation (Patient): 1/0/0/0/1/0?
0018,5100 ?Patient Position: HFS?
我們發現
圖像的位置坐標中,只有Z軸坐標有變化,而且從Z坐標的大小可以看出,m切片是在n切片的下方
知道了圖像的方向,就很容易進行后面的圖像分析了
1.??????Image Orientation:
? ? ? ? 如之前在博文《DICOM中幾個判斷圖像方向的tag》中提到的ImageOrientation(0020,0037)表示的是圖像第一行和第一列相對于病人的方向。而在DICOM坐標系是根據病人的方向來確定的,其中X軸正向指向病人的左側,Y軸正向指向病人的背部,Z軸正向指向病人的頭部。
? ? ? ? 在醫學影像處理軟件中,最常見的是將導入系統的MRI/CT序列以三視圖的形式進行呈現,分別為軸狀位(Transverse/Axisplane)、冠狀位(Coronal/Frontal plane)和矢狀位(Sagittal plane)。以下圖顯示的是這三個方位對應的切面方位,以及在成像過程中對應的坐標系。
?
圖1 成像坐標系
?
圖2 三視圖
2. ? ? Software and Coding
?
?圖3 醫學軟件中標準三視圖與MPR變換后的圖像方位
? ??? ?如圖3所示為某一款醫療影像軟件在載入一個患者頭部MRI序列后,三個不同視圖中所標注的圖像方位圖。可以判斷出這三個視圖依次為軸狀位(AP-LR)、矢狀位(HF-AP)、冠狀位(HF-LR)。
? ? ? ?在網上找到的計算視圖中方位的程序如下:
char *ImageOrientationLayer::ComputeOrientation(Vector3D vector)
{
? ? ? ? char *orientation=new char[4];
? ? ? ? char *optr = orientation;
? ? ? ? *optr='\0';
?
? ? ? ? char orientationX = vector.getX() < 0 ? 'R' : 'L';
? ? ? ? char orientationY = vector.getY() < 0 ? 'A' : 'P';
? ? ? ? char orientationZ = vector.getZ() < 0 ? 'F' : 'H';
?
? ? ? ? double absX = fabs(vector.getX());
? ? ? ? double absY = fabs(vector.getY());
? ? ? ? double absZ = fabs(vector.getZ());
?
? ? ? ? int i;
? ? ? ? for (i=0; i<3; ++i) {
? ? ? ? ? ? ? ? if (absX>.0001 && absX>absY && absX>absZ) {
? ? ? ? ? ? ? ? ? ? ? ? *optr++=orientationX;
? ? ? ? ? ? ? ? ? ? ? ? absX=0;
? ? ? ? ? ? ? ? }
?
? ? ? ? ? ? ? ? else if (absY>.0001 && absY>absX && absY>absZ) {
? ? ? ? ? ? ? ? ? ? ? ? *optr++=orientationY;
? ? ? ? ? ? ? ? ? ? ? ? absY=0;
? ? ? ? ? ? ? ? }
?
? ? ? ? ? ? ? ? else if (absZ>.0001 && absZ>absX && absZ>absY) {
? ? ? ? ? ? ? ? ? ? ? ? *optr++=orientationZ;
? ? ? ? ? ? ? ? ? ? ? ? absZ=0;
? ? ? ? ? ? ? ? }
?
? ? ? ? ? ? ? ? else break;
?
? ? ? ? ? ? ? ? *optr='\0';
? ? ? ? }
?
? ? ? ? return orientation;
}??
結合到軟件開發中,則首先需要在窗口的top,bottom,left,right中間找到四個單位向量,(0,1,0),(0,-1,0),(-1,0,0),(1,0,0),將其對應的窗口坐標點轉化為世界坐標系的點,求出與(0,0,0)所對應的世界坐標原點的四個向量并且歸一化,作為上述ComputeOrientaton函數的參數傳進去,即可得到當前圖像在世界坐標系下的方位。
總結
以上是生活随笔為你收集整理的【转】DICOM中几个判断图像方向的tag的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 现在不买智能车=手机还买老人机:余承东金
- 下一篇: 【转】DCMTK各模块说明!!!!!!!