Howto: Load File Meta-Header
Here's an example that shows how to load the File Meta Information Header of a DICOMfile without reading the dataset. This could be useful if you are e.g. only interested in theSOP Class UID and Transfer Syntax UID of the file.
There are three different approaches:
Use the loadFile() method of the DcmMetaInfo class.
Use the loadFile() method of the DcmFileFormat class with read mode ERM_metaOnly.
Use the read() method of the DcmFileFormat class in order to successively load the meta-header and the dataset.
The third approach allows for reading the dataset only if certain criteria (based on the data elements in the meta-header) are met. Please note that in this case the same input stream is used and that the meta-header is only read once.
Source Code
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dctk.h"