Working with Data#
Here we present some useful tips & tricks which to help working with data which has been converted using PyDicer. As you will see, working with data in PyDicer is heavily oriented around DataFrames provided by the Pandas library. If you aren’t familiar with Pandas, we recommend working through the Pandas Getting Started Tutorials.
[1]:
try:
    from pydicer import PyDicer
except ImportError:
    !pip install pydicer
    from pydicer import PyDicer
from pathlib import Path
from pydicer.utils import (
    fetch_converted_test_data,
    load_object_metadata,
    determine_dcm_datetime,
    read_simple_itk_image
)
Setup PyDicer#
Here we load the LCTSC data which has already been converted. This is downloaded into the testdata_lctsc directory. We also initialise a PyDicer object.
[2]:
working_directory = fetch_converted_test_data("./testdata_lctsc", dataset="LCTSC")
pydicer = PyDicer(working_directory)
Working directory %s aready exists, won't download test data.
Read Converted Data#
To obtain a DataFrame of the converted data, use the read_converted_data function.
[3]:
df = pydicer.read_converted_data()
df
[3]:
| sop_instance_uid | hashed_uid | modality | patient_id | series_uid | for_uid | referenced_sop_instance_uid | path | |
|---|---|---|---|---|---|---|---|---|
| 0 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.235489581364... | 914d57 | CT | LCTSC-Test-S1-102 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.639871532605... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.408067568497... | NaN | testdata_lctsc/data/LCTSC-Test-S1-102/images/9... | 
| 1 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.110977663386... | 6c6ea4 | RTSTRUCT | LCTSC-Test-S1-102 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.110977663386... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.408067568497... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.235489581364... | testdata_lctsc/data/LCTSC-Test-S1-102/structur... | 
| 2 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.217118546740... | dd0026 | CT | LCTSC-Train-S1-008 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.135073567254... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.243364093992... | NaN | testdata_lctsc/data/LCTSC-Train-S1-008/images/... | 
| 3 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.225487254421... | 48a970 | RTSTRUCT | LCTSC-Train-S1-008 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.225487254421... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.243364093992... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.217118546740... | testdata_lctsc/data/LCTSC-Train-S1-008/structu... | 
| 4 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.168227681755... | 5adf40 | CT | LCTSC-Train-S1-007 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.335375068555... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.187709044743... | NaN | testdata_lctsc/data/LCTSC-Train-S1-007/images/... | 
| 5 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.284338872489... | ed6686 | RTSTRUCT | LCTSC-Train-S1-007 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.284338872489... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.187709044743... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.168227681755... | testdata_lctsc/data/LCTSC-Train-S1-007/structu... | 
| 6 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.159497309342... | 2bf2f9 | CT | LCTSC-Train-S1-003 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.742383887179... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.803594135292... | NaN | testdata_lctsc/data/LCTSC-Train-S1-003/images/... | 
| 7 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.127494043495... | 8e34f9 | RTSTRUCT | LCTSC-Train-S1-003 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.127494043495... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.803594135292... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.159497309342... | testdata_lctsc/data/LCTSC-Train-S1-003/structu... | 
| 8 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.141349678572... | d91c84 | CT | LCTSC-Train-S1-004 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.269433294341... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.313160975008... | NaN | testdata_lctsc/data/LCTSC-Train-S1-004/images/... | 
| 9 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.595315284787... | 61758b | RTSTRUCT | LCTSC-Train-S1-004 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.595315284787... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.313160975008... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.141349678572... | testdata_lctsc/data/LCTSC-Train-S1-004/structu... | 
| 10 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.333558838494... | 666be6 | CT | LCTSC-Test-S1-101 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.106943890850... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.171234424242... | NaN | testdata_lctsc/data/LCTSC-Test-S1-101/images/6... | 
| 11 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.929007819506... | cc682f | RTSTRUCT | LCTSC-Test-S1-101 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.280355341349... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.171234424242... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.333558838494... | testdata_lctsc/data/LCTSC-Test-S1-101/structur... | 
| 12 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.318848546630... | aa38e6 | CT | LCTSC-Train-S1-002 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.234842392725... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.145984743865... | NaN | testdata_lctsc/data/LCTSC-Train-S1-002/images/... | 
| 13 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.291449913947... | f036b8 | RTSTRUCT | LCTSC-Train-S1-002 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.291449913947... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.145984743865... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.318848546630... | testdata_lctsc/data/LCTSC-Train-S1-002/structu... | 
| 14 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.263565217029... | 88c5ef | CT | LCTSC-Train-S1-006 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.770569242984... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.325217978839... | NaN | testdata_lctsc/data/LCTSC-Train-S1-006/images/... | 
| 15 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.161109536301... | ceb111 | RTSTRUCT | LCTSC-Train-S1-006 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.161109536301... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.325217978839... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.263565217029... | testdata_lctsc/data/LCTSC-Train-S1-006/structu... | 
| 16 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.140943693489... | 738c1a | CT | LCTSC-Train-S1-005 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.338518041666... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.964812114328... | NaN | testdata_lctsc/data/LCTSC-Train-S1-005/images/... | 
| 17 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.214803404117... | 68d663 | RTSTRUCT | LCTSC-Train-S1-005 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.214803404117... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.964812114328... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.140943693489... | testdata_lctsc/data/LCTSC-Train-S1-005/structu... | 
| 18 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.188371727865... | 6834c9 | CT | LCTSC-Train-S1-001 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.330486033168... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.109432485688... | NaN | testdata_lctsc/data/LCTSC-Train-S1-001/images/... | 
| 19 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.267594131248... | b5bddb | RTSTRUCT | LCTSC-Train-S1-001 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.267594131248... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.109432485688... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.188371727865... | testdata_lctsc/data/LCTSC-Train-S1-001/structu... | 
Iterating Over Objects#
If you want to perform some operation on (for example) all images in your dataset, you can iterate over each image row like this. Within each loop we load each image as a SimpleITK image (just for demonstration purposes).)
[4]:
for idx, ct_row in df[df.modality=="CT"].iterrows():
    print(f"Loading image with hashed UID: {ct_row.hashed_uid}...", end="")
    img = read_simple_itk_image(ct_row)
    print(" Complete")
Loading image with hashed UID: 914d57... Complete
Loading image with hashed UID: dd0026... Complete
Loading image with hashed UID: 5adf40... Complete
Loading image with hashed UID: 2bf2f9... Complete
Loading image with hashed UID: d91c84... Complete
Loading image with hashed UID: 666be6... Complete
Loading image with hashed UID: aa38e6... Complete
Loading image with hashed UID: 88c5ef... Complete
Loading image with hashed UID: 738c1a... Complete
Loading image with hashed UID: 6834c9... Complete
Loading Object Metadata#
The metadata from the DICOM headers is stored by PyDicer and can be easily loaded using the load_object_metadata function. Simply pass a row from the converted DataFrame into this function to load the metadata for that object.
[5]:
first_row = df.iloc[0]
ds = load_object_metadata(first_row)
ds
[5]:
(0008, 0005) Specific Character Set              CS: 'ISO_IR 100'
(0008, 0008) Image Type                          CS: ['ORIGINAL', 'PRIMARY', 'AXIAL', 'CT_SOM5 SPI']
(0008, 0012) Instance Creation Date              DA: '20050726'
(0008, 0013) Instance Creation Time              TM: '091720.609000'
(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.7014.4598.235489581364823930179693677352
(0008, 0020) Study Date                          DA: '20031104'
(0008, 0021) Series Date                         DA: '20031104'
(0008, 0023) Content Date                        DA: '20031104'
(0008, 0030) Study Time                          TM: '112017.690000'
(0008, 0031) Series Time                         TM: '114545.847000'
(0008, 0033) Content Time                        TM: '114241.493000'
(0008, 0050) Accession Number                    SH: '2356173256177297'
(0008, 0060) Modality                            CS: 'CT'
(0008, 0070) Manufacturer                        LO: 'SIEMENS'
(0008, 0090) Referring Physician's Name          PN: ''
(0008, 1030) Study Description                   LO: 'RT^RCCT_THORAX_8F_High (Adult)'
(0008, 103e) Series Description                  LO: 'CT114545:RespCT  3.0  B30f  50% Ex'
(0008, 1090) Manufacturer's Model Name           LO: 'Sensation Open'
(0010, 0010) Patient's Name                      PN: 'LCTSC-Test-S1-102'
(0010, 0020) Patient ID                          LO: 'LCTSC-Test-S1-102'
(0010, 0030) Patient's Birth Date                DA: ''
(0010, 0040) Patient's Sex                       CS: 'F'
(0012, 0062) Patient Identity Removed            CS: 'YES'
(0012, 0063) De-identification Method            LO: ['Per DICOM PS 3.15 AnnexE. Details in 0012,0064', 'Per DICOM PS 3.15 AnnexE. Details in 0012,0064']
(0012, 0064)  De-identification Method Code Sequence  16 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'
   ---------
   (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: 'LCTSC'
(0013, 1013) Private tag data                    LO: '70144598'
(0018, 0015) Body Part Examined                  CS: 'LUNG'
(0018, 0050) Slice Thickness                     DS: '3.0'
(0018, 0060) KVP                                 DS: '120.0'
(0018, 0090) Data Collection Diameter            DS: '500.0'
(0018, 1100) Reconstruction Diameter             DS: '500.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: '200.0'
(0018, 1140) Rotation Direction                  CS: 'CW'
(0018, 1150) Exposure Time                       IS: '361'
(0018, 1151) X-Ray Tube Current                  IS: '100'
(0018, 1152) Exposure                            IS: '500'
(0018, 1160) Filter Type                         SH: '0'
(0018, 1170) Generator Power                     IS: '12'
(0018, 1190) Focal Spot(s)                       DS: '1.2'
(0018, 1210) Convolution Kernel                  SH: 'B30f'
(0018, 5100) Patient Position                    CS: 'HFS'
(0020, 000d) Study Instance UID                  UI: 1.3.6.1.4.1.14519.5.2.1.7014.4598.238478060677653494401819620444
(0020, 000e) Series Instance UID                 UI: 1.3.6.1.4.1.14519.5.2.1.7014.4598.639871532605224417554459681163
(0020, 0010) Study ID                            SH: ''
(0020, 0011) Series Number                       IS: '0'
(0020, 0012) Acquisition Number                  IS: '2'
(0020, 0013) Instance Number                     IS: '148'
(0020, 0032) Image Position (Patient)            DS: [-249.51171875, -449.51171875, -663.5]
(0020, 0037) Image Orientation (Patient)         DS: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0]
(0020, 0052) Frame of Reference UID              UI: 1.3.6.1.4.1.14519.5.2.1.7014.4598.408067568497667143598295356169
(0020, 1040) Position Reference Indicator        LO: ''
(0020, 1041) Slice Location                      DS: '-663.5'
(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.9765625, 0.9765625]
(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, 0303) Longitudinal Temporal Information M CS: 'MODIFIED'
(0028, 1050) Window Center                       DS: '40.0'
(0028, 1051) Window Width                        DS: '400.0'
(0028, 1052) Rescale Intercept                   DS: '-1024.0'
(0028, 1053) Rescale Slope                       DS: '1.0'
(3253, 0010) Private Creator                     LO: 'Varian Medical Systems VISION 3253'
(7fe0, 0010) Pixel Data                          OW: None
Loading metadata for all data objects#
You can use the Pandas apply function to load metadata for all rows and add it as a column to the converted DataFrame.
[7]:
df["StudyDescription"] = df.apply(lambda row: load_object_metadata(row, keep_tags="StudyDescription").StudyDescription, axis=1)
df
[7]:
| sop_instance_uid | hashed_uid | modality | patient_id | series_uid | for_uid | referenced_sop_instance_uid | path | StudyDescription | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.235489581364... | 914d57 | CT | LCTSC-Test-S1-102 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.639871532605... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.408067568497... | NaN | testdata_lctsc/data/LCTSC-Test-S1-102/images/9... | RT^RCCT_THORAX_8F_High (Adult) | 
| 1 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.110977663386... | 6c6ea4 | RTSTRUCT | LCTSC-Test-S1-102 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.110977663386... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.408067568497... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.235489581364... | testdata_lctsc/data/LCTSC-Test-S1-102/structur... | RT^RCCT_THORAX_8F_High (Adult) | 
| 2 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.217118546740... | dd0026 | CT | LCTSC-Train-S1-008 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.135073567254... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.243364093992... | NaN | testdata_lctsc/data/LCTSC-Train-S1-008/images/... | Specials^RCCTPET_THORAX_8F (Adult) | 
| 3 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.225487254421... | 48a970 | RTSTRUCT | LCTSC-Train-S1-008 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.225487254421... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.243364093992... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.217118546740... | testdata_lctsc/data/LCTSC-Train-S1-008/structu... | Specials^RCCTPET_THORAX_8F (Adult) | 
| 4 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.168227681755... | 5adf40 | CT | LCTSC-Train-S1-007 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.335375068555... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.187709044743... | NaN | testdata_lctsc/data/LCTSC-Train-S1-007/images/... | RT^RCCT_THORAX_8F_High (Adult) | 
| 5 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.284338872489... | ed6686 | RTSTRUCT | LCTSC-Train-S1-007 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.284338872489... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.187709044743... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.168227681755... | testdata_lctsc/data/LCTSC-Train-S1-007/structu... | RT^RCCT_THORAX_8F_High (Adult) | 
| 6 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.159497309342... | 2bf2f9 | CT | LCTSC-Train-S1-003 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.742383887179... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.803594135292... | NaN | testdata_lctsc/data/LCTSC-Train-S1-003/images/... | RT^RCCT_THORAX_8F_High (Adult) | 
| 7 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.127494043495... | 8e34f9 | RTSTRUCT | LCTSC-Train-S1-003 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.127494043495... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.803594135292... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.159497309342... | testdata_lctsc/data/LCTSC-Train-S1-003/structu... | RT^RCCT_THORAX_8F_High (Adult) | 
| 8 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.141349678572... | d91c84 | CT | LCTSC-Train-S1-004 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.269433294341... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.313160975008... | NaN | testdata_lctsc/data/LCTSC-Train-S1-004/images/... | RT^RCCT_THORAX_8F_High_CONTRAST (Adult) | 
| 9 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.595315284787... | 61758b | RTSTRUCT | LCTSC-Train-S1-004 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.595315284787... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.313160975008... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.141349678572... | testdata_lctsc/data/LCTSC-Train-S1-004/structu... | RT^RCCT_THORAX_8F_High_CONTRAST (Adult) | 
| 10 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.333558838494... | 666be6 | CT | LCTSC-Test-S1-101 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.106943890850... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.171234424242... | NaN | testdata_lctsc/data/LCTSC-Test-S1-101/images/6... | |
| 11 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.929007819506... | cc682f | RTSTRUCT | LCTSC-Test-S1-101 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.280355341349... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.171234424242... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.333558838494... | testdata_lctsc/data/LCTSC-Test-S1-101/structur... | |
| 12 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.318848546630... | aa38e6 | CT | LCTSC-Train-S1-002 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.234842392725... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.145984743865... | NaN | testdata_lctsc/data/LCTSC-Train-S1-002/images/... | RT^RCCT_THORAX_8F (Adult) | 
| 13 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.291449913947... | f036b8 | RTSTRUCT | LCTSC-Train-S1-002 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.291449913947... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.145984743865... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.318848546630... | testdata_lctsc/data/LCTSC-Train-S1-002/structu... | RT^RCCT_THORAX_8F (Adult) | 
| 14 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.263565217029... | 88c5ef | CT | LCTSC-Train-S1-006 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.770569242984... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.325217978839... | NaN | testdata_lctsc/data/LCTSC-Train-S1-006/images/... | RT^RCCT_THORAX_8F_High (Adult) | 
| 15 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.161109536301... | ceb111 | RTSTRUCT | LCTSC-Train-S1-006 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.161109536301... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.325217978839... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.263565217029... | testdata_lctsc/data/LCTSC-Train-S1-006/structu... | RT^RCCT_THORAX_8F_High (Adult) | 
| 16 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.140943693489... | 738c1a | CT | LCTSC-Train-S1-005 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.338518041666... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.964812114328... | NaN | testdata_lctsc/data/LCTSC-Train-S1-005/images/... | RT^RCCT_THORAX_8F_High (Adult) | 
| 17 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.214803404117... | 68d663 | RTSTRUCT | LCTSC-Train-S1-005 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.214803404117... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.964812114328... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.140943693489... | testdata_lctsc/data/LCTSC-Train-S1-005/structu... | RT^RCCT_THORAX_8F_High (Adult) | 
| 18 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.188371727865... | 6834c9 | CT | LCTSC-Train-S1-001 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.330486033168... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.109432485688... | NaN | testdata_lctsc/data/LCTSC-Train-S1-001/images/... | RT^RCCT_THORAX_8F_Low (Adult) | 
| 19 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.267594131248... | b5bddb | RTSTRUCT | LCTSC-Train-S1-001 | 1.3.6.1.4.1.14519.5.2.1.7014.4598.267594131248... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.109432485688... | 1.3.6.1.4.1.14519.5.2.1.7014.4598.188371727865... | testdata_lctsc/data/LCTSC-Train-S1-001/structu... | RT^RCCT_THORAX_8F_Low (Adult) | 
Determine Date of Object#
There are several DICOM header tags which could define the date of an object. The DICOM standard doesn’t require all of these to be set within the metadata. PyDicer provides the determine_dcm_datetime function to extract the date from the DICOM header.
[8]:
ds = load_object_metadata(first_row)
obj_datetime = determine_dcm_datetime(ds)
print(obj_datetime)
2003-11-04 11:45:45.847000
[ ]: