++ed by:

1 PAUSE user

Baoshe Zhang
and 1 contributors


DicomReader - A module to read Dicom Files


    use DicomPack::IO::DicomReader;
    my $dicomFile = "your dicom file";

    # get a DicomReader object
    my $reader = DicomPack::IO::DicomReader->new($dicomFile);

    # show the content of the Dicom file to std.

    # get patient name
    my $patientName = $reader->getValue("PatientName");

    # get the value of a complex structure. Return value is a sub Dicom field.
    my $aDicomField = $reader->getValue("300a,0230/0/300a,0280/2/1001,01ff");

    # show the above dicom structure to std.
    $reader->showDicomField(2, $aDicomField);

    # get the root Dicom field structure.
    my $rootDicomField = $reader->getDicomField();


This module reads a Dicom file.



Returns a new DicomReader object.

Input Parameter:
  1. A path to a dicom file.


Get the value of a specified dicom field.

Input Parameters:
  1. Dicom tag path. Format: "TagID or TagName/SequenceNumber/TagID or TagName/SequenceNumber", e.g.,"300a,0230/0/300a,0280/2/1001,01ff/0/MaterialID".

  2. mode (optional). When mode is 'native', the return value is in the native binary format prefixed 'vr:' (where vr is the VR value, e.g., 'UI').

Return Value:

The value of the specified dicom field or a hash ref or an array ref.


Get a hash ref pointing to the root structure of the dicom fields.

Return Value:

A hash ref pointing to the root structure of the dicom fields.


Display the structure of a dicom field structure.

Input Parameter(s):
  1. Verbose level. Available values: 0, 1, 2. Default value: 0.

  2. A dicom field structure (optional). If no dicom field structure is specified, use the root dicom field structure.


Parse a string containing a Dicom binary field. The whole content of a Dicom file can be used as an input string.

Input Parameter(s):
  1. A string containing a dicom field.

Return Value:

A Dicom field structure.


Check the endianness of the current Dicom field structure.

Return Value:

When true, little endianness; otherwise, big endianness.


Check if the current Dicom field structure is implicitly VRed.

Return Value:

When true, implicit VR; otherwise, explicit VR.


Baoshe Zhang, MCV Medical School, Virginia Commonwealth University