Skip to content

Instantly share code, notes, and snippets.

@OmarAlkousa
Last active December 31, 2022 15:22
Show Gist options
  • Save OmarAlkousa/53b35934cd3fac3d381f0448b8e27073 to your computer and use it in GitHub Desktop.
Save OmarAlkousa/53b35934cd3fac3d381f0448b8e27073 to your computer and use it in GitHub Desktop.
These GitHub gists are meant to explain the output of the dcmread() function from PyDicom Package. You can see the DICOM dataset on Kaggle following the link: https://www.kaggle.com/datasets/dmisky/dlwptvolumetricdicomlung
# Install and import the package
!pip install pydicom
import pydicom
# Reading a DICOM file from a specific path
dcm_data = pydicom.dcmread('/content/drive/MyDrive/Datasets/Kaggle/DICOM/dicom_lung/000000.dcm')
dcm_data
Dataset.file_meta -------------------------------
(0002, 0000) File Meta Information Group Length UL: 196
(0002, 0001) File Meta Information Version OB: b'\x00\x01'
(0002, 0002) Media Storage SOP Class UID UI: CT Image Storage
(0002, 0003) Media Storage SOP Instance UID UI: 1.3.6.1.4.1.14519.5.2.1.7085.2626.214140401149739061368142942055
(0002, 0010) Transfer Syntax UID UI: Explicit VR Little Endian
(0002, 0012) Implementation Class UID UI: 1.2.40.0.13.1.1.1
(0002, 0013) Implementation Version Name SH: 'dcm4che-1.4.35'
-------------------------------------------------
(0008, 0005) Specific Character Set CS: 'ISO_IR 100'
(0008, 0008) Image Type CS: ['ORIGINAL', 'PRIMARY', 'AXIAL', 'CT_SOM5 SPI']
(0008, 0016) SOP Class UID UI: CT Image Storage
(0008, 0018) SOP Instance UID UI: 1.3.6.1.4.1.14519.5.2.1.7085.2626.214140401149739061368142942055
(0008, 0020) Study Date DA: '20100227'
(0008, 0021) Series Date DA: '20100227'
(0008, 0022) Acquisition Date DA: '20100227'
(0008, 0023) Content Date DA: '20100227'
(0008, 0030) Study Time TM: '161937.171'
(0008, 0031) Series Time TM: '162536.14'
(0008, 0032) Acquisition Time TM: '162203.028699'
(0008, 0033) Content Time TM: '162203.028699'
(0008, 0050) Accession Number SH: '1598252606449858'
(0008, 0060) Modality CS: 'CT'
(0008, 0070) Manufacturer LO: 'SIEMENS'
(0008, 0090) Referring Physician's Name PN: ''
(0008, 1030) Study Description LO: 'CT CHEST W IV CONTRAST'
(0008, 103e) Series Description LO: 'LUNG 3.0 B70f'
(0008, 1090) Manufacturer's Model Name LO: 'Sensation 16'
(0008, 1110) Referenced Study Sequence 1 item(s) ----
(0008, 1150) Referenced SOP Class UID UI: Detached Study Management SOP Class
(0008, 1155) Referenced SOP Instance UID UI: 1.3.6.1.4.1.14519.5.2.1.7085.2626.369429505691935722415265978954
---------
(0008, 1140) Referenced Image Sequence 1 item(s) ----
(0008, 1150) Referenced SOP Class UID UI: CT Image Storage
(0008, 1155) Referenced SOP Instance UID UI: 1.3.6.1.4.1.14519.5.2.1.7085.2626.205235983215257790411718232367
---------
(0008, 2112) Source Image Sequence 1 item(s) ----
(0008, 1150) Referenced SOP Class UID UI: 1.3.12.2.1107.5.9.1
(0008, 1155) Referenced SOP Instance UID UI: 1.3.6.1.4.1.14519.5.2.1.7085.2626.311297831929978695651149773236
---------
(0009, 0010) Private Creator LO: 'SIEMENS CT VA1 DUMMY'
(0010, 0010) Patient's Name PN: 'C3N-00247'
(0010, 0020) Patient ID LO: 'C3N-00247'
(0010, 0030) Patient's Birth Date DA: ''
(0010, 0040) Patient's Sex CS: 'F'
(0010, 1010) Patient's Age AS: '077Y'
(0010, 2160) Ethnic Group SH: '8'
(0012, 0050) Clinical Trial Time Point ID LO: '97'
(0012, 0051) Clinical Trial Time Point Descripti ST: 'Days offset from diagnosis'
(0012, 0062) Patient Identity Removed CS: 'YES'
(0012, 0063) De-identification Method LO: 'Per DICOM PS 3.15 AnnexE. Details in 0012,0064'
(0012, 0064) De-identification Method Code Sequence 8 item(s) ----
(0008, 0100) Code Value SH: '113100'
(0008, 0102) Coding Scheme Designator SH: 'DCM'
(0008, 0104) Code Meaning LO: 'Basic Application Confidentiality Profile'
---------
(0008, 0100) Code Value SH: '113101'
(0008, 0102) Coding Scheme Designator SH: 'DCM'
(0008, 0104) Code Meaning LO: 'Clean Pixel Data Option'
---------
(0008, 0100) Code Value SH: '113104'
(0008, 0102) Coding Scheme Designator SH: 'DCM'
(0008, 0104) Code Meaning LO: 'Clean Structured Content Option'
---------
(0008, 0100) Code Value SH: '113105'
(0008, 0102) Coding Scheme Designator SH: 'DCM'
(0008, 0104) Code Meaning LO: 'Clean Descriptors Option'
---------
(0008, 0100) Code Value SH: '113107'
(0008, 0102) Coding Scheme Designator SH: 'DCM'
(0008, 0104) Code Meaning LO: 'Retain Longitudinal Temporal Information Modified Dates Option'
---------
(0008, 0100) Code Value SH: '113108'
(0008, 0102) Coding Scheme Designator SH: 'DCM'
(0008, 0104) Code Meaning LO: 'Retain Patient Characteristics Option'
---------
(0008, 0100) Code Value SH: '113109'
(0008, 0102) Coding Scheme Designator SH: 'DCM'
(0008, 0104) Code Meaning LO: 'Retain Device Identity Option'
---------
(0008, 0100) Code Value SH: '113111'
(0008, 0102) Coding Scheme Designator SH: 'DCM'
(0008, 0104) Code Meaning LO: 'Retain Safe Private Option'
---------
(0013, 0010) Private Creator LO: 'CTP'
(0013, 1010) Private tag data LO: 'CPTAC-LSCC'
(0013, 1013) Private tag data LO: '70852626'
(0018, 0015) Body Part Examined CS: 'CHEST'
(0018, 0050) Slice Thickness DS: '3.0'
(0018, 0060) KVP DS: '100.0'
(0018, 0090) Data Collection Diameter DS: '500.0'
(0018, 1020) Software Versions LO: 'syngo CT 2014A'
(0018, 1030) Protocol Name LO: 'CHEST_ROUTINE_SMALL'
(0018, 1100) Reconstruction Diameter DS: '289.0'
(0018, 1110) Distance Source to Detector DS: '1040.0'
(0018, 1111) Distance Source to Patient DS: '570.0'
(0018, 1120) Gantry/Detector Tilt DS: '0.0'
(0018, 1130) Table Height DS: '137.0'
(0018, 1140) Rotation Direction CS: 'CW'
(0018, 1150) Exposure Time IS: '500'
(0018, 1151) X-Ray Tube Current IS: '237'
(0018, 1152) Exposure IS: '131'
(0018, 1160) Filter Type SH: '0'
(0018, 1170) Generator Power IS: '35'
(0018, 1190) Focal Spot(s) DS: '1.2'
(0018, 1200) Date of Last Calibration DA: '20100227'
(0018, 1201) Time of Last Calibration TM: '061404'
(0018, 1210) Convolution Kernel SH: 'B70f'
(0018, 5100) Patient Position CS: 'HFS'
(0018, 9306) Single Collimation Width FD: 1.5
(0018, 9307) Total Collimation Width FD: 24.0
(0018, 9309) Table Speed FD: 43.0
(0018, 9310) Table Feed per Rotation FD: 21.6
(0018, 9311) Spiral Pitch Factor FD: 0.9
(0018, 9323) Exposure Modulation Type CS: 'XYZ_EC'
(0018, 9324) Estimated Dose Saving FD: 29.4
(0018, 9345) CTDIvol FD: 5.924999999999999
(0019, 0010) Private Creator LO: 'SIEMENS CT VA0 COAD'
(0019, 10b0) [Feed per Rotation] DS: '21.6'
(0020, 000d) Study Instance UID UI: 1.3.6.1.4.1.14519.5.2.1.7085.2626.258626612405225511766549337110
(0020, 000e) Series Instance UID UI: 1.3.6.1.4.1.14519.5.2.1.7085.2626.242193282649561899185427104083
(0020, 0010) Study ID SH: ''
(0020, 0011) Series Number IS: '2'
(0020, 0012) Acquisition Number IS: '2'
(0020, 0013) Instance Number IS: '75'
(0020, 0032) Image Position (Patient) DS: [-143.2177734375, -287.2177734375, -216]
(0020, 0037) Image Orientation (Patient) DS: [1, 0, 0, 0, 1, 0]
(0020, 0052) Frame of Reference UID UI: 1.3.6.1.4.1.14519.5.2.1.7085.2626.118309119521421997707953128381
(0020, 1040) Position Reference Indicator LO: ''
(0020, 1041) Slice Location DS: '-216.0'
(0020, 4000) Image Comments LT: '\nPOST CONTRAST'
(0021, 0010) Private Creator LO: 'SIEMENS MED'
(0021, 1011) [Target] DS: [1, -6]
(0028, 0002) Samples per Pixel US: 1
(0028, 0004) Photometric Interpretation CS: 'MONOCHROME2'
(0028, 0010) Rows US: 512
(0028, 0011) Columns US: 512
(0028, 0030) Pixel Spacing DS: [0.564453125, 0.564453125]
(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, 0106) Smallest Image Pixel Value US: 0
(0028, 0107) Largest Image Pixel Value US: 4095
(0028, 0303) Longitudinal Temporal Information M CS: 'MODIFIED'
(0028, 1050) Window Center DS: [-500, 40]
(0028, 1051) Window Width DS: [1500, 400]
(0028, 1052) Rescale Intercept DS: '-1024.0'
(0028, 1053) Rescale Slope DS: '1.0'
(0028, 1055) Window Center & Width Explanation LO: ['WINDOW1', 'WINDOW2']
(0029, 0010) Private Creator LO: 'SIEMENS CSA HEADER'
(0029, 0011) Private Creator LO: 'SIEMENS MEDCOM HEADER'
(0029, 0012) Private Creator LO: 'MITRA PRESENTATION 1.0'
(0031, 0010) Private Creator LO: 'AGFA PACS Archive Mirroring 1.0'
(0032, 000a) Study Status ID CS: 'READ'
(0032, 000c) Study Priority ID CS: 'LOW'
(0032, 1030) Reason for Study LO: 'Malignant neoplasm of lower lobe, right bronchus or lung, RLL bi'
(0032, 1060) Requested Procedure Description LO: 'CT CHEST W IV CONTRAST'
(0032, 4000) Study Comments LT: ''
(0033, 0010) Private Creator LO: 'MITRA OBJECT UTF8 ATTRIBUTES 1.0'
(0040, 0244) Performed Procedure Step Start Date DA: '20100227'
(0040, 0245) Performed Procedure Step Start Time TM: '161937.171'
(7fe0, 0010) Pixel Data OW: Array of 524288 elements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment