# Read Image Meta-Data Dictionary and Print¶

## Overview¶

Reading an entire image potentially is memory and time intensive operation when the image is large or many files must be read. The image information and meta-data dictionary can be read without the bulk data by using the ImageFilerReader’s object oriented interface, with use of the ImageFileReader::ReadImageInformation method.

While all file formats support loading image information such as size, pixel type, origin, and spacing many image types do not have a meta-data dictionary. The most common case for images with a dictionary is DICOM, but also the fields from TIFF, NIFTI, MetaIO and other file formats maybe loaded into the meta-data dictionary.

For efficiency, the default DICOM reader settings will only load public tags (even group numbers). In the example we explicitly set the reader to also load private tags (odd group numbers). For further information on DICOM data elements see the standard part 5, Data Structures and Encoding.

## Code¶

#!/usr/bin/env python

import SimpleITK as sitk
import sys

if len(sys.argv) < 2:
print("Usage: DicomImagePrintTags <input_file>")
sys.exit(1)

print(f"({k}) = = \"{v}\"")