Python reads an instance of the Dicom header file

Source: Internet
Author: User
This article mainly introduces the Python read the dicom header file instance, has a certain reference value, now share to everyone, the need for friends can refer to

Open dicom image with Dicompyler software, header file:

Of course, you can read it directly:

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 U ID ui:ct Image Storage (0008, 0018) SOP Instance UID ui:2.16.840.1.113662.2.0.105002416.1489146183.501.0 (0008, 0 020) Study Date da: ' 20170310 ' (0008, 0021) Series date da: ' 20170310 ' (0008, 0023) Content date da: ' 20060 505 ' (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: ' COR Vus 6.4 ' (0010, 0010) Patient ' s Name PN: ' *m32-2^chenjun^ ^^ ' (0010, 0020) Patient ID LO: ' 21662 ' (0010, 0030) Pati Ent ' s Birth Date DA: ' (0010, 0040) Patient ' s Sex CS: ' (0018, 0050) Slice Thickness ds: ' 4.75 ' (0018, 0060) KVP ds: ' 0 ' (0018, 102     0) 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.10500241 6.1489146183.501 (0020, 0010) Study ID SH: ' 63071 ' (0020, 0011) Series number is: ' 0 ' (0020, 0012) acquisition Num ber is: ' 0 ' (0020, 0013) Instance number is: ' 0 ' (0020, 0020) Patient Orientation CS: [' L ', ' P '] (0020, 0032) Im Age 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) Lat Erality CS: ' (0020, 1040) Position Reference Indicator LO: ' (0020, 1041) Slice location DS: ' 3.25 ' (0028, 000     2) Samples per PixelUs: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) B Its Stored us:12 (0028, 0102) high Bit us:11 (0028, 0103) Pixel representation us:0 (0028, 1052) Rescale in Tercept ds: ' -1024 ' (0028, 1053) rescale Slope DS: ' 1 ' (7fe0, 0010) Pixel Data

It is found that the first and last slice thickness of a set of graphs are often different from the values of the middle tier.

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

Read header file information method:

Slices. The Name column in the header file.

It is important to note that the name is the same case, minus the space and removing the symbol, such as parentheses.

Example:

Origin = slices. Softwareversionsprint Origin>>corvus 6.4

spacing = slices[1]. Pixelspacingprint spacing>>[' 0.734375 ', ' 0.734375 ']

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.