Image Processing Toolbox User's Guide |
Reading Metadata from a DICOM File
To read metadata from a DICOM file, use the dicominfo
function.
The metadata in a DICOM files provides information, such as the size, dimensions, and bit depth of the image. In addition, the DICOM specification defines numerous other metadata fields that describe many other characteristics of the data, such as the modality used to create the data, the equipment settings used to capture the image, and information about the study.
In this example, dicominfo
reads the metadata from a file, returning the information in a structure where every field in the structure is a specific piece of DICOM metadata.
info = dicominfo('CT-MONO2-16-ankle.dcm'); info = Filename: [1x47 char] FileModDate: '24-Dec-2000 19:54:47' FileSize: 525436 Format: 'DICOM' FormatVersion: 3 Width: 512 Height: 512 BitDepth: 16 ColorType: 'grayscale' SelectedFrames: [] FileStruct: [1x1 struct] StartOfPixelData: 1140 MetaElementGroupLength: 192 FileMetaInformationVersion: [2x1 double] MediaStorageSOPClassUID: '1.2.840.10008.5.1.4.1.1.7' MediaStorageSOPInstanceUID: [1x50 char] TransferSyntaxUID: '1.2.840.10008.1.2' ImplementationClassUID: '1.2.840.113619.6.5' . . .
You can use the metadata structure returned by dicominfo
to specify the DICOM file you want to read using dicomread
. For example, you can use this code to read metadata from the sample DICOM file and then pass the metadata to dicomread
to read the image from the file.
Reading Image Data from a DICOM File | Writing Image Data or Metadata to a DICOM File |
© 1994-2005 The MathWorks, Inc.