這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)碛嘘P(guān)如何使用python讀取DICOM頭文件,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡(jiǎn)單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名注冊(cè)、網(wǎng)絡(luò)空間、營銷軟件、網(wǎng)站建設(shè)、五華網(wǎng)站維護(hù)、網(wǎng)站推廣。python是什么意思Python是一種跨平臺(tái)的、具有解釋性、編譯性、互動(dòng)性和面向?qū)ο蟮哪_本語言,其最初的設(shè)計(jì)是用于編寫自動(dòng)化腳本,隨著版本的不斷更新和新功能的添加,常用于用于開發(fā)獨(dú)立的項(xiàng)目和大型項(xiàng)目。
用dicompyler軟件打開dicom圖像,頭文件如圖所示:
當(dāng)然也可以直接讀取:
ds = dicom.read_file('H:\Data\data\\21662\\2.16.840.1.113662.2.0.105002416.1489146183.701\CT\\CT#0#21662#E7AB693D.dcm') print ds >> (0008, 0008) Image Type CS: ['ORIGINAL', 'SECONDARY', 'AXIAL'] (0008, 0016) SOP Class UID UI: CT Image Storage (0008, 0018) SOP Instance UID UI: 2.16.840.1.113662.2.0.105002416.1489146183.501.0 (0008, 0020) Study Date DA: '20170310' (0008, 0021) Series Date DA: '20170310' (0008, 0023) Content Date DA: '20060505' (0008, 0030) Study Time TM: '1942' (0008, 0031) Series Time TM: '1942' (0008, 0033) Content Time TM: '' (0008, 0050) Accession Number SH: '63071' (0008, 0060) Modality CS: 'CT' (0008, 0070) Manufacturer LO: 'NOMOS' (0008, 0090) Referring Physician's Name PN: '' (0008, 1010) Station Name SH: '' (0008, 1090) Manufacturer's Model Name LO: 'CORVUS 6.4' (0010, 0010) Patient's Name PN: '*M32-2^CHENJUN^^^' (0010, 0020) Patient ID LO: '21662' (0010, 0030) Patient's Birth Date DA: '' (0010, 0040) Patient's Sex CS: '' (0018, 0050) Slice Thickness DS: '4.75' (0018, 0060) KVP DS: '0' (0018, 1020) Software Version(s) LO: 'CORVUS 6.4' (0018, 5100) Patient Position CS: 'HFS' (0020, 000d) Study Instance UID UI: 2.16.840.1.113662.2.0.105002416.1489146183.701 (0020, 000e) Series Instance UID UI: 2.16.840.1.113662.2.0.105002416.1489146183.501 (0020, 0010) Study ID SH: '63071' (0020, 0011) Series Number IS: '0' (0020, 0012) Acquisition Number IS: '0' (0020, 0013) Instance Number IS: '0' (0020, 0020) Patient Orientation CS: ['L', 'P'] (0020, 0032) Image Position (Patient) DS: ['0.73437356948853', '0', '3.25'] (0020, 0037) Image Orientation (Patient) DS: ['1', '0', '0', '0', '1', '0'] (0020, 0052) Frame of Reference UID UI: 2.16.840.1.113662.2.0.105002416.1489146183.601 (0020, 0060) Laterality CS: '' (0020, 1040) Position Reference Indicator LO: '' (0020, 1041) Slice Location DS: '3.25' (0028, 0002) Samples per Pixel US: 1 (0028, 0004) Photometric Interpretation CS: 'MONOCHROME2' (0028, 0010) Rows US: 330 (0028, 0011) Columns US: 339 (0028, 0030) Pixel Spacing DS: ['0.734375', '0.734375'] (0028, 0100) Bits Allocated US: 16 (0028, 0101) Bits Stored US: 12 (0028, 0102) High Bit US: 11 (0028, 0103) Pixel Representation US: 0 (0028, 1052) Rescale Intercept DS: '-1024' (0028, 1053) Rescale Slope DS: '1' (7fe0, 0010) Pixel Data
發(fā)現(xiàn)一套圖的第一張和最后一張的Slice Thickness往往和中間層的值是不同的。
Path = 'H:\Data\data\\21662\\2.16.840.1.113662.2.0.105002416.1489146183.701\CT\\a.dcm' slices = dicom.read_file(path) spacing = slices.PixelSpacing
讀取頭文件信息方法:
Slices.上圖頭文件中的name列。
這時(shí)要注意的是,name大小寫不變,去掉空格,去掉符號(hào),比如括號(hào)。
舉例:
origin = slices.SoftwareVersions print origin >>CORVUS 6.4
spacing = slices[1].PixelSpacing print spacing >>['0.734375', '0.734375']
上述就是小編為大家分享的如何使用python讀取DICOM頭文件了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。