Main Content


Read metadata from DICOM message



info = dicominfo(filename) reads the metadata from the compliant Digital Imaging and Communications in Medicine (DICOM) file or Digital Imaging and Communication in Security (DICOS) file, filename.

info = dicominfo(filename,"dictionary",D) reads the DICOM message by using the data dictionary file, D.

info = dicominfo(___,Name=Value) specifies options using one or more name-value arguments in addition to any combination of input arguments from previous syntaxes.


collapse all

Read metadata from a DICOM message.

info = dicominfo("CT-MONO2-16-ankle.dcm")
info = struct with fields:
                          Filename: 'B:\matlab\toolbox\images\imdata\CT-MONO2-16-ankle.dcm'
                       FileModDate: '18-Dec-2000 12:06:43'
                          FileSize: 525436
                            Format: 'DICOM'
                     FormatVersion: 3
                             Width: 512
                            Height: 512
                          BitDepth: 16
                         ColorType: 'grayscale'
    FileMetaInformationGroupLength: 192
        FileMetaInformationVersion: [2×1 uint8]
           MediaStorageSOPClassUID: '1.2.840.10008.'
        MediaStorageSOPInstanceUID: '1.2.840.113619.2.1.2411.1031152382.365.1.736169244'
                 TransferSyntaxUID: '1.2.840.10008.1.2'
            ImplementationClassUID: '1.2.840.113619.6.5'
         ImplementationVersionName: '1_2_5'
      SourceApplicationEntityTitle: 'CTN_STORAGE'
            IdentifyingGroupLength: 414
                         ImageType: 'DERIVED\SECONDARY\3D'
                       SOPClassUID: '1.2.840.10008.'
                    SOPInstanceUID: '1.2.840.113619.2.1.2411.1031152382.365.1.736169244'
                         StudyDate: '1993.04.30'
                        SeriesDate: '1993.04.30'
                       ContentDate: '1993.04.30'
                         StudyTime: '11:27:24'
                        SeriesTime: '11:27:24'
                       ContentTime: '11:27:24'
                          Modality: 'CT'
                    ConversionType: 'WSD'
                      Manufacturer: 'GE MEDICAL SYSTEMS'
                   InstitutionName: 'JFK IMAGING CENTER'
            ReferringPhysicianName: [1×1 struct]
                       StationName: 'CT01OC0'
                  StudyDescription: 'RT ANKLE'
      NameOfPhysiciansReadingStudy: [1×1 struct]
                     OperatorsName: [1×1 struct]
             ManufacturerModelName: 'GENESIS_ZEUS'
                PatientGroupLength: 18
                       PatientName: [1×1 struct]
            AcquisitionGroupLength: 10
                  SoftwareVersions: '03'
           RelationshipGroupLength: 134
                  StudyInstanceUID: '1.2.840.113619.'
                 SeriesInstanceUID: '1.2.840.113619.2.1.2411.1031152382.365.736169244'
                      SeriesNumber: 365
                    InstanceNumber: 1
      ImagePresentationGroupLength: 168
                   SamplesPerPixel: 1
         PhotometricInterpretation: 'MONOCHROME2'
                              Rows: 512
                           Columns: 512
                     BitsAllocated: 16
                        BitsStored: 16
                           HighBit: 15
               PixelRepresentation: 1
           SmallestImagePixelValue: 0
                 PixelPaddingValue: 0
                      WindowCenter: 1024
                       WindowWidth: 4095
                  RescaleIntercept: -1024
                      RescaleSlope: 1
                       RescaleType: 'US'
              PixelDataGroupLength: 524296

Input Arguments

collapse all

Name of the DICOM file, specified as a character vector or string scalar.

Data Types: char | string

Data dictionary file, specified as a character vector or string scalar. The file in D must be on the MATLAB® search path.

Data Types: char | string

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: dicominfo("CT-MONO2-16-ankle.dcm",UseVRHeuristic=false) reads the metadata from the DICOM file without using a heuristic.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: dicominfo("CT-MONO2-16-ankle.dcm","UseVRHeuristic",false) reads the metadata from the DICOM file without using a heuristic.

Read noncompliant DICOM files that switch value representation (VR) modes incorrectly, specified as a logical 1 (true) or 0 (false).

When set to true, dicominfo uses a heuristic to help read certain noncompliant DICOM files that switch VR modes incorrectly. dicominfo displays a warning if it uses this heuristic. If this heuristic is enabled, a small number of compliant files are not read correctly. Set UseVRHeuristic to false to read these compliant files.

Data Types: logical

Conform data types to the data dictionary, specified as a logical 0 (false) or 1 (true). If this argument is specified as true, the info output structure uses the data types in the data dictionary, regardless of what information is present in the file. If specified as false, the info output uses the VR codes of the file, even if they differ from the data dictionary. Because the file contents and the data dictionary almost always agree, specifying this argument as true is usually unnecessary.

However, if the file and the data dictionary disagree and UseDictionaryVR is set to false, then dicominfo issues a warning, and you can experience errors when passing info to dicomwrite. To resolve these errors, specify UseDictionaryVR as true to use the VR codes from the data dictionary.

Data Types: logical

Output Arguments

collapse all

DICOM metadata, returned as a structure.

Version History

Introduced before R2006a

See Also

| | | | | | | (Medical Imaging Toolbox) | (Medical Imaging Toolbox) | (Medical Imaging Toolbox)