Get the header information as a matrix

dicom_header_as_matrix(dicom_data, slice_idx = NA)

Arguments

dicom_data

DICOM data returned by read_dicom

slice_idx

1-based slice index. If NA, all slices will be included. Won't work if multiple slices are included in only one image file.

Value

Data frame containing one record for each header attribute. Note that if all slices are included, fields that appear more than once (including tag and name) in a given slice header will be excluded from the values reported for that slice. Each column contains all header attributes for one slice, therefore, values are represented as strings even if they are conceptually numeric.

Examples

data(sample_dicom_img)
dicom_header_as_matrix(sample_dicom_img)
#>    group element                         name code
#> 1   0002    0000                  GroupLength   UL
#> 2   0002    0001   FileMetaInformationVersion   OB
#> 3   0002    0002      MediaStorageSOPClassUID   UI
#> 4   0002    0003   MediaStorageSOPInstanceUID   UI
#> 5   0002    0010            TransferSyntaxUID   UI
#> 6   0002    0012       ImplementationClassUID   UI
#> 7   0002    0013    ImplementationVersionName   SH
#> 8   0002    0016 SourceApplicationEntityTitle   AE
#> 9   0008    0005         SpecificCharacterSet   CS
#> 10  0008    0008                    ImageType   CS
#> 11  0008    0012         InstanceCreationDate   DA
#> 12  0008    0013         InstanceCreationTime   TM
#> 13  0008    0014           InstanceCreatorUID   UI
#> 14  0008    0016                  SOPClassUID   UI
#> 15  0008    0018               SOPInstanceUID   UI
#> 16  0008    0020                    StudyDate   DA
#> 17  0008    0021                   SeriesDate   DA
#> 18  0008    0023                  ContentDate   DA
#> 19  0008    0030                    StudyTime   TM
#> 20  0008    0031                   SeriesTime   TM
#> 21  0008    0033                  ContentTime   TM
#> 22  0008    0050              AccessionNumber   SH
#> 23  0008    0060                     Modality   CS
#> 24  0008    0070                 Manufacturer   LO
#> 25  0008    0090      ReferringPhysiciansName   PN
#> 26  0008    0201        TimezoneOffsetFromUTC   SH
#> 27  0008    1030             StudyDescription   LO
#> 28  0008    103E            SeriesDescription   LO
#> 29  0008    1090       ManufacturersModelName   LO
#> 30  0010    0010                 PatientsName   PN
#> 31  0010    0020                    PatientID   LO
#> 32  0010    0030            PatientsBirthDate   DA
#> 33  0010    0040                  PatientsSex   CS
#> 34  0010    1010                  PatientsAge   AS
#> 35  0010    1030               PatientsWeight   DS
#> 36  0012    0062       PatientIdentityRemoved   CS
#> 37  0012    0063       DeidentificationMethod   LO
#> 38  0018    0010           ContrastBolusAgent   LO
#> 39  0018    0020             ScanningSequence   CS
#> 40  0018    0021              SequenceVariant   CS
#> 41  0018    0022                  ScanOptions   CS
#> 42  0018    0023            MRAcquisitionType   CS
#> 43  0018    0050               SliceThickness   DS
#> 44  0018    0080               RepetitionTime   DS
#> 45  0018    0081                     EchoTime   DS
#> 46  0018    0083             NumberOfAverages   DS
#> 47  0018    0084             ImagingFrequency   DS
#> 48  0018    0087        MagneticFieldStrength   DS
#> 49  0018    0091              EchoTraInLength   IS
#> 50  0018    0094      PercentPhaseFieldOfView   DS
#> 51  0018    1020             SoftwareVersions   LO
#> 52  0018    1030                 ProtocolName   LO
#> 53  0018    1310            AcquisitionMatrix   US
#> 54  0018    1314                    FlipAngle   DS
#> 55  0018    5100              PatientPosition   CS
#> 56  0020    000D             StudyInstanceUID   UI
#> 57  0020    000E            SeriesInstanceUID   UI
#> 58  0020    0010                      StudyID   SH
#> 59  0020    0011                 SeriesNumber   IS
#> 60  0020    0012            AcquisitionNumber   IS
#> 61  0020    0013               InstanceNumber   IS
#> 62  0020    0032         ImagePositionPatient   DS
#> 63  0020    0037      ImageOrientationPatient   DS
#> 64  0020    0052          FrameOfReferenceUID   UI
#> 65  0020    0100   TemporalPositionIdentifier   IS
#> 66  0020    0105    NumberOfTemporalPositions   IS
#> 67  0020    0110           TemporalResolution   DS
#> 68  0020    1002          ImagesInAcquisition   IS
#> 69  0020    1040   PositionReferenceIndicator   LO
#> 70  0020    1041                SliceLocation   DS
#> 71  0028    0002              SamplesperPixel   US
#> 72  0028    0004    PhotometricInterpretation   CS
#> 73  0028    0010                         Rows   US
#> 74  0028    0011                      Columns   US
#> 75  0028    0030                 PixelSpacing   DS
#> 76  0028    0100                BitsAllocated   US
#> 77  0028    0101                   BitsStored   US
#> 78  0028    0102                      HighBit   US
#> 79  0028    0103          PixelRepresentation   US
#> 80  0028    1050                 WindowCenter   DS
#> 81  0028    1051                  WindowWidth   DS
#> 82  7FE0    0010                    PixelData   OB
#>                                                                                                                                              slice_1
#> 1                                                                                                                                                194
#> 2                                                                                                                                               \001
#> 3                                                                                                                          1.2.840.10008.5.1.4.1.1.4
#> 4                                                                                                  1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.476
#> 5                                                                                                                                1.2.840.10008.1.2.1
#> 6                                                                                                                                 1.3.6.1.4.1.5962.2
#> 7                                                                                                                                          DCTOOL100
#> 8                                                                                                                                            CLUNIE1
#> 9                                                                                                                                         ISO_IR 100
#> 10                                                                                                                            ORIGINAL PRIMARY OTHER
#> 11                                                                                                                                          20040624
#> 12                                                                                                                                            020525
#> 13                                                                                                                                1.3.6.1.4.1.5962.3
#> 14                                                                                                                         1.2.840.10008.5.1.4.1.1.4
#> 15                                                                                                 1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.476
#> 16                                                                                                                                          20030505
#> 17                                                                                                                                          20030505
#> 18                                                                                                                                          20030505
#> 19                                                                                                                                            050743
#> 20                                                                                                                                            050814
#> 21                                                                                                                                            050829
#> 22                                                                                                                                               428
#> 23                                                                                                                                                MR
#> 24                                                                                                                     Philips Medical Systems, Inc.
#> 25                                                                                                                                                  
#> 26                                                                                                                                             +0000
#> 27                                                                                                                                          Carotids
#> 28                                                                                                                                    FAST LOCALIZER
#> 29                                                                                                                                      Eclipse 1.5T
#> 30                                                                                                                                         Doe Peter
#> 31                                                                                                                                          98890234
#> 32                                                                                                                                                  
#> 33                                                                                                                                                 M
#> 34                                                                                                                                              045Y
#> 35                                                                                                                                         81.632700
#> 36                                                                                                                                               YES
#> 37 dcanon no identifiers keep descriptions keep manufacturer keep retired keep private no uids keep pet demographics keep dates dcdtchg change dates
#> 38                                                                                                                                                  
#> 39                                                                                                                                                GR
#> 40                                                                                                                                                SS
#> 41                                                                                                                                                  
#> 42                                                                                                                                                  
#> 43                                                                                                                                      1.000000e+01
#> 44                                                                                                                                                16
#> 45                                                                                                                                      3.700000e+00
#> 46                                                                                                                                                 1
#> 47                                                                                                                                       6.36978e+01
#> 48                                                                                                                                               1.5
#> 49                                                                                                                                                 1
#> 50                                                                                                                                               100
#> 51                                                                                                                                            VIA5.2
#> 52                                                                                                                                    FAST LOCALIZER
#> 53                                                                                                                                               256
#> 54                                                                                                                                                20
#> 55                                                                                                                                               HFS
#> 56                                                                                                 1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.427
#> 57                                                                                                 1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.475
#> 58                                                                                                                                               428
#> 59                                                                                                                                                 1
#> 60                                                                                                                                                 2
#> 61                                                                                                                                                 1
#> 62                                                                                                           0.000000e+00 -1.750000e+02 1.750000e+02
#> 63                                                                        0.00000e+00 1.00000e+00 -0.00000e+00 -0.00000e+00 0.00000e+00 -1.00000e+00
#> 64                                                                                                 1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.427
#> 65                                                                                                                                                 1
#> 66                                                                                                                                                 1
#> 67                                                                                                                                              3116
#> 68                                                                                                                                                 1
#> 69                                                                                                                                          Carotids
#> 70                                                                                                                                          0.000000
#> 71                                                                                                                                                 1
#> 72                                                                                                                                       MONOCHROME2
#> 73                                                                                                                                               256
#> 74                                                                                                                                               256
#> 75                                                                                                                         1.367188e+00 1.367188e+00
#> 76                                                                                                                                                16
#> 77                                                                                                                                                16
#> 78                                                                                                                                                15
#> 79                                                                                                                                                 1
#> 80                                                                                                                                               243
#> 81                                                                                                                                               798
#> 82                                                                                                                                         PixelData
#>                                                                                                                                              slice_2
#> 1                                                                                                                                                194
#> 2                                                                                                                                               \001
#> 3                                                                                                                          1.2.840.10008.5.1.4.1.1.4
#> 4                                                                                                  1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.135
#> 5                                                                                                                                1.2.840.10008.1.2.1
#> 6                                                                                                                                 1.3.6.1.4.1.5962.2
#> 7                                                                                                                                          DCTOOL100
#> 8                                                                                                                                            CLUNIE1
#> 9                                                                                                                                         ISO_IR 100
#> 10                                                                                                                            ORIGINAL PRIMARY OTHER
#> 11                                                                                                                                          20040624
#> 12                                                                                                                                            020353
#> 13                                                                                                                                1.3.6.1.4.1.5962.3
#> 14                                                                                                                         1.2.840.10008.5.1.4.1.1.4
#> 15                                                                                                 1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.135
#> 16                                                                                                                                          20030505
#> 17                                                                                                                                          20030505
#> 18                                                                                                                                          20030505
#> 19                                                                                                                                            025109
#> 20                                                                                                                                            025141
#> 21                                                                                                                                            025153
#> 22                                                                                                                                               134
#> 23                                                                                                                                                MR
#> 24                                                                                                                     Philips Medical Systems, Inc.
#> 25                                                                                                                                                  
#> 26                                                                                                                                             +0000
#> 27                                                                                                                                             Brain
#> 28                                                                                                                                    FAST LOCALIZER
#> 29                                                                                                                                      Eclipse 1.5T
#> 30                                                                                                                                         Doe Peter
#> 31                                                                                                                                          98890234
#> 32                                                                                                                                                  
#> 33                                                                                                                                                 M
#> 34                                                                                                                                              045Y
#> 35                                                                                                                                         81.632700
#> 36                                                                                                                                               YES
#> 37 dcanon no identifiers keep descriptions keep manufacturer keep retired keep private no uids keep pet demographics keep dates dcdtchg change dates
#> 38                                                                                                                                                  
#> 39                                                                                                                                                GR
#> 40                                                                                                                                             SS SP
#> 41                                                                                                                                                  
#> 42                                                                                                                                                  
#> 43                                                                                                                                      1.000000e+01
#> 44                                                                                                                                                10
#> 45                                                                                                                                      3.700000e+00
#> 46                                                                                                                                                 1
#> 47                                                                                                                                       6.36978e+01
#> 48                                                                                                                                               1.5
#> 49                                                                                                                                                 1
#> 50                                                                                                                                               100
#> 51                                                                                                                                            VIA5.2
#> 52                                                                                                                                    FAST LOCALIZER
#> 53                                                                                                                                               256
#> 54                                                                                                                                                20
#> 55                                                                                                                                               HFS
#> 56                                                                                                 1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.133
#> 57                                                                                                 1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.134
#> 58                                                                                                                                               134
#> 59                                                                                                                                                 1
#> 60                                                                                                                                                 2
#> 61                                                                                                                                                 1
#> 62                                                                                                           0.000000e+00 -1.750000e+02 1.750000e+02
#> 63                                                                        0.00000e+00 1.00000e+00 -0.00000e+00 -0.00000e+00 0.00000e+00 -1.00000e+00
#> 64                                                                                                 1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.133
#> 65                                                                                                                                                 1
#> 66                                                                                                                                                 1
#> 67                                                                                                                                              2340
#> 68                                                                                                                                                 1
#> 69                                                                                                                                             Brain
#> 70                                                                                                                                          0.000000
#> 71                                                                                                                                                 1
#> 72                                                                                                                                       MONOCHROME2
#> 73                                                                                                                                               256
#> 74                                                                                                                                               256
#> 75                                                                                                                         1.367188e+00 1.367188e+00
#> 76                                                                                                                                                16
#> 77                                                                                                                                                16
#> 78                                                                                                                                                15
#> 79                                                                                                                                                 1
#> 80                                                                                                                                               349
#> 81                                                                                                                                               829
#> 82                                                                                                                                         PixelData
#>                                                                                                                                              slice_3
#> 1                                                                                                                                                192
#> 2                                                                                                                                               \001
#> 3                                                                                                                          1.2.840.10008.5.1.4.1.1.4
#> 4                                                                                                   1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.16
#> 5                                                                                                                                1.2.840.10008.1.2.1
#> 6                                                                                                                                 1.3.6.1.4.1.5962.2
#> 7                                                                                                                                          DCTOOL100
#> 8                                                                                                                                            CLUNIE1
#> 9                                                                                                                                         ISO_IR 100
#> 10                                                                                                                            ORIGINAL PRIMARY OTHER
#> 11                                                                                                                                          20040624
#> 12                                                                                                                                            020321
#> 13                                                                                                                                1.3.6.1.4.1.5962.3
#> 14                                                                                                                         1.2.840.10008.5.1.4.1.1.4
#> 15                                                                                                  1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.16
#> 16                                                                                                                                          20030505
#> 17                                                                                                                                          20030505
#> 18                                                                                                                                          20030505
#> 19                                                                                                                                            045357
#> 20                                                                                                                                            045440
#> 21                                                                                                                                            045455
#> 22                                                                                                                                                 2
#> 23                                                                                                                                                MR
#> 24                                                                                                                     Philips Medical Systems, Inc.
#> 25                                                                                                                                                  
#> 26                                                                                                                                             +0000
#> 27                                                                                                                                         Brain-MRA
#> 28                                                                                                                                    FAST LOCALIZER
#> 29                                                                                                                                      Eclipse 1.5T
#> 30                                                                                                                                         Doe Peter
#> 31                                                                                                                                          98890234
#> 32                                                                                                                                                  
#> 33                                                                                                                                                 M
#> 34                                                                                                                                              045Y
#> 35                                                                                                                                         81.632700
#> 36                                                                                                                                               YES
#> 37 dcanon no identifiers keep descriptions keep manufacturer keep retired keep private no uids keep pet demographics keep dates dcdtchg change dates
#> 38                                                                                                                                                  
#> 39                                                                                                                                                GR
#> 40                                                                                                                                             SS SP
#> 41                                                                                                                                                  
#> 42                                                                                                                                                  
#> 43                                                                                                                                      1.000000e+01
#> 44                                                                                                                                                10
#> 45                                                                                                                                      3.700000e+00
#> 46                                                                                                                                                 1
#> 47                                                                                                                                       6.36978e+01
#> 48                                                                                                                                               1.5
#> 49                                                                                                                                                 1
#> 50                                                                                                                                               100
#> 51                                                                                                                                            VIA5.2
#> 52                                                                                                                                    FAST LOCALIZER
#> 53                                                                                                                                               256
#> 54                                                                                                                                                20
#> 55                                                                                                                                               HFS
#> 56                                                                                                   1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.1
#> 57                                                                                                  1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.15
#> 58                                                                                                                                                 2
#> 59                                                                                                                                                 1
#> 60                                                                                                                                                 2
#> 61                                                                                                                                                 1
#> 62                                                                                                           0.000000e+00 -1.750000e+02 1.750000e+02
#> 63                                                                        0.00000e+00 1.00000e+00 -0.00000e+00 -0.00000e+00 0.00000e+00 -1.00000e+00
#> 64                                                                                                   1.3.6.1.4.1.5962.1.1.0.0.0.1196533885.18148.0.1
#> 65                                                                                                                                                 1
#> 66                                                                                                                                                 1
#> 67                                                                                                                                              2340
#> 68                                                                                                                                                 1
#> 69                                                                                                                                         Brain-MRA
#> 70                                                                                                                                          0.000000
#> 71                                                                                                                                                 1
#> 72                                                                                                                                       MONOCHROME2
#> 73                                                                                                                                               256
#> 74                                                                                                                                               256
#> 75                                                                                                                         1.367188e+00 1.367188e+00
#> 76                                                                                                                                                16
#> 77                                                                                                                                                16
#> 78                                                                                                                                                15
#> 79                                                                                                                                                 1
#> 80                                                                                                                                               282
#> 81                                                                                                                                               782
#> 82                                                                                                                                         PixelData