validate
Checks a DICOM file against what its SOP class requires: the IOD's modules and their attributes, as PS3.3 lists them, and prints each finding as an error, a warning, or "not checked".
When to use it
Use validate on a file you wrote, or one a device sent, to find missing
Type 1 and Type 2 attributes, values outside Enumerated Values or Defined
Terms, a wrong value multiplicity, sequences with the wrong number of items,
and, for enhanced multi-frame images, functional group macros that are
missing or misplaced. The rules are generated from the standard; the
edition is printed with each result.
It does not check context groups (PS3.16), rules that tie one attribute to another, attributes the IOD does not name, or the bytes of Pixel Data (only its presence and length). A condition PS3.3 states in prose is reported as "not checked", never as passed.
dcmtk has no such tool; the closest is dciodvfy from dicom3tools.
Examples
A clean file
go-dicom validate ct.dcmct.dcm: 1.2.840.10008.5.1.4.1.1.2, checked as the CT Image IOD (PS3.3 A.3, 2026d)
not checked Single-Frame CT Series: Usage C: absent; whether it is required was not checked: Required if the SOP Class UID of this instance is 1.2.840.10008.5.1.4.1.1.2.3 (CT Image Storage - For Processing). May be present otherwise. [Single-Frame CT Series; PS3.3 A.3 Table A.3-1]
…
0 error(s), 0 warning(s), 34 not checkedExit status 0: no error and no warning. The "not checked" lines are the conditions a person has to judge.
Missing attributes
go-dicom modify -delete Modality -delete StudyDate ct.dcm broken.dcm
go-dicom validate broken.dcmbroken.dcm: 1.2.840.10008.5.1.4.1.1.2, checked as the CT Image IOD (PS3.3 A.3, 2026d)
error (0008,0020) Study Date: Type 2: absent; a Type 2 attribute is required [General Study; PS3.3 C.7.2.1 (General Study Module Attributes)]
error (0008,0060) Modality: Type 1: absent; a Type 1 attribute is required [General Series; PS3.3 C.7.3.1 (General Series Module Attributes)]
…
2 error(s), 0 warning(s), 34 not checked
Error: validate: broken.dcm: 2 error(s), 0 warning(s)Exit status 3. Each finding names the attribute, the rule it breaks, and the module and PS3.3 section it comes from.
Enumerated Values and Defined Terms
go-dicom validate odd.dcm error (0010,0040) Patient's Sex: Enumerated Values: the value is "X"; the Enumerated Values are M, F, O [Patient; PS3.3 C.7.1.1 (Patient Module Attributes)]go-dicom validate odd2.dcm warning (0018,5100) Patient Position: Defined Terms: the value is "SIDEWAYS"; the Defined Terms are HFP, HFS, HFDR, … [General Series; PS3.3 C.7.3.1.1.2]
Error: validate: odd2.dcm: 1 warning(s)A value outside Enumerated Values is an error; one outside Defined Terms is a warning (exit status 2), since Defined Terms may be extended.
As JSON
go-dicom validate --json broken.dcm{
"file": "broken.dcm",
"sopClassUID": "1.2.840.10008.5.1.4.1.1.2",
"iod": "CT Image",
"iodSection": "A.3",
"edition": "2026d",
"findings": [
…
{
"severity": "error",
"tag": "(0008,0020)",
"path": "(0008,0020)",
"name": "Study Date",
"module": "General Study",
"reference": "PS3.3 C.7.2.1 (General Study Module Attributes)",
"rule": "Type 2",
"message": "absent; a Type 2 attribute is required"
},
…
],
"counts": { … }
}severity is error, warning or not checked; path locates the
attribute, into sequences.
Notes
Tip
In a script, send standard output to /dev/null and read the exit status:
go-dicom validate broken.dcm > /dev/null || echo "needs a look".
- Exit status: 0 no error or warning, 1 the file could not be checked (not DICOM, or no SOP Class UID), 2 warnings and no error, 3 errors.
- Each module the IOD makes Mandatory, or that is present, is checked. A Type 1C or 2C attribute or a Conditional module whose condition PS3.3 states in a fixed form naming one attribute is evaluated, both ways.
- Each overlay group (6000 to 601E) is checked against the Overlay Plane module on its own.
- See CONFORMANCE.md, Validation against the IOD.
See also
Options
Check a file against what its SOP class requires
USAGE:
go-dicom validate [--json] <file>
The file's SOP Class UID names its IOD (PS3.4 Table B.5-1), and the IOD
its modules (PS3.3 Annex A). Each module that is Mandatory, or that is
present, is checked attribute by attribute against its table (PS3.3 Annex
C), into sequences:
Type 1 present, with a value Type 2 present
Value Multiplicity, from the dictionary (PS3.6)
Enumerated Values (an error) and Defined Terms (a warning) where the
table, or the section it names for the attribute, lists them
how many items a sequence holds, where its description says
An enhanced multi-frame image's Shared and Per-Frame Functional Groups
are checked against the IOD's Functional Group Macros table: each macro
the IOD requires is there for every frame, none is in both or where the
table forbids it, and each is checked like a module.
Each overlay group (6000 to 601E, even) is checked against the Overlay
Plane module on its own, and what it lacks is reported by its tag in that
group: an overlay with no Overlay Rows is an error for (6002,0010).
The rules are generated from the standard (the edition is printed), not
written by hand. Pixel Data and other bulk values are left in the file:
their presence and length are checked, not their bytes.
A condition PS3.3 states in a fixed form naming one attribute ("Required
if Pixel Data Provider URL (0028,7FE0) is not present", "... is present",
"... has a Value of YES") is evaluated: a Type 1C or 2C attribute, or a
Conditional module, absent where its condition holds is an error, and so
is one present where it does not, unless PS3.3 says "May be present
otherwise".
A condition PS3.3 states in a fixed form naming one attribute ("Required
if Pixel Data Provider URL (0028,7FE0) is not present", "... is present",
"... has a Value of YES") is evaluated: a Type 1C or 2C attribute, or a
Conditional module, absent where its condition holds is an error, and so
is one present where it does not, unless PS3.3 says "May be present
otherwise".
A condition PS3.3 states in a fixed form naming one attribute ("Required
if Pixel Data Provider URL (0028,7FE0) is not present", "... is present",
"... has a Value of YES") is evaluated: a Type 1C or 2C attribute, or a
Conditional module, absent where its condition holds is an error, and so
is one present where it does not, unless PS3.3 says "May be present
otherwise".
NOT CHECKED:
A condition PS3.3 states in prose is reported as "not checked", never
passed. Also not checked: context groups (PS3.16), rules that tie one
attribute to another, and attributes the IOD does not name.
OPTIONS:
--json Print the findings as JSON
-h, -help Show this help message
EXIT STATUS:
0 no error or warning 2 warnings, no error
1 the file could not be checked 3 errors
EXAMPLES:
go-dicom validate ct.dcm
go-dicom validate --json ct.dcm