show
Prints the elements of a DICOM file as a table: tag, VR, length and value, one line each, in the order they are stored. file::Element prints one element, whole.
When to use it
Use show to see what a file holds, as it is stored: every element of the
file meta group and the data set, nested sequence items included. With
--json it also says where each element sits in the file, byte by byte.
It does not interpret the file: for the patient, study and image size at a glance use info, for a structured report's content tree use sr, and to compare two files use diff. It changes nothing.
The closest tools are dcmtk's dcmdump and pydicom's pydicom show (or
print(ds)).
Examples
List every element
go-dicom show ct.dcm=== DICOM File: ct.dcm ===
Tag VR Length Value
─────────────────────────────────────────────
0002,0000 UL 4 192
0002,0001 OB 2 <2 bytes>
0002,0002 UI 26 1.2.840.10008.5.1.4.1.1.2
…
0008,0060 CS 2 CT
0008,0070 LO 18 GE MEDICAL SYSTEMS
…
7FE0,0010 OW 32768 <32768 bytes>The elements of a sequence item follow the sequence, indented by two spaces.
Print one element
go-dicom show ct.dcm::PatientName
go-dicom show ct.dcm::0010,0010
go-dicom show "ct.dcm::Patient's Name"0010,0010 PN 22 CompressedSamples^CT1The element is named by its keyword, its tag (0010,0010 or (0010,0010))
or its dictionary name. The value is printed whole, however long it is.
Only the top level, without private tags
go-dicom show ct.dcm --top --exclude-private--top leaves out the items of sequences; --exclude-private leaves out
private elements. On CT_small.dcm the two together cut 273 lines to 90.
A terse listing
go-dicom show ct.dcm --top --quiet0002,0000: 192
0002,0001: <2 bytes>
0002,0002: 1.2.840.10008.5.1.4.1.1.2
…Whole values
go-dicom show ct.dcm --fullThe table prints the first 100 bytes of a value; --full prints every value
whole. Bulk binary such as Pixel Data is still shown as a count of bytes.
Where each element sits in the file
go-dicom show ct.dcm --json{
"schemaVersion": 1,
"file": "ct.dcm",
"size": 39206,
"preamble": true,
"regions": [
{
"name": "preamble",
"offset": 0,
"endOffset": 128
},
…Each element carries the offsets of its tag, VR, length and value, and the items and delimiters of sequences are listed. show --json describes the document and its schema.
Notes
showreads the file and writes to standard output only. It exits 0 on success and 1 when the file is missing, is not DICOM, or the element asked for is not in it (Error: show: element 'NoSuchThing' not found).- Values are shown as stored, padding included: a text value of odd length keeps its trailing space.
- In a deflated data set,
--jsonoffsets count from the start of the inflated data set, not the file; the fieldoffsetsRelativeTosays which.
See also
Options
COMMAND: show - Display DICOM file contents
USAGE:
go-dicom show <file> [options]
DESCRIPTION:
Display all tags and values from a DICOM file. With file::Element, print
that one element, whole. Element is a keyword (PatientName), a tag
(0010,0010 or (0010,0010)) or the dictionary name ("Patient's Name").
OPTIONS:
-h, --help Show help for this command
--exclude-private Exclude private tags
--top Show only top-level elements
--quiet Show minimal output
--full Print whole values. The table prints the first 100
bytes of a value and how long it is; asking for one
element (file::Element) always prints it whole.
Bulk binary such as Pixel Data is a count of bytes
either way.
--json Describe the file as JSON: every element with its
value and where its tag, VR, length and value sit in
the file, nested items and delimiters included, and
the preamble, prefix, file meta and data set regions.
Offsets count from the start of the file, except in a
deflated data set, where they count from the start of
the inflated one; "offsetsRelativeTo" says which.
EXAMPLES:
go-dicom show patient.dcm
go-dicom show patient.dcm --exclude-private
go-dicom show patient.dcm --top --quiet
go-dicom show patient.dcm --json
go-dicom show patient.dcm::ImageComments One element, whole
go-dicom show patient.dcm::PatientName The same, by keyword
go-dicom show patient.dcm::0010,0010 The same, by tag
go-dicom show patient.dcm --full
go-dicom show -h