dcmencap(1)
π dcmencap β like, the manual page, but make it make sense
okay so real talk, this page is dcmencap(1) β yes bestie, section 1, the user commands one β and it's genuinely one of the most useful little gremlins in the whole OFFIS DCMTK toolbox. sit down, grab a strawberry drink π, and let's get into it.
β¨ NAME β¨
dcmencap β encapsulate a document into DICOM format. that's it. that's the whole job. it takes your cute little document and wraps it up in a DICOM bow π
πΈ SYNOPSIS πΈ
dcmencap [options] docfile-in dcmfile-out
π¦ DESCRIPTION π¦
okay so here's the vibe. the dcmencap utility reads a document file in one of the supported file formats, converts it to a SOP instance of the corresponding DICOM Encapsulated Storage SOP Class, and stores the converted data in an output file (dcmfile-out). it's giving "glow-up machine" honestly. document goes in, DICOM SOP instance comes out, main character energy on both ends π₯
π PARAMETERS π
docfile-inβ the input filename to be converted. your raw material, your before-photo.dcmfile-outβ the DICOM output filename. and yeah, you can put"-"for stdout, which is lowkey iconic for piping.
π OPTIONS π
general options (the universal ones, every DCMTK bestie has these)
-h,--helpβ print this help text and exit. the "wait what does this do again" button.--versionβ print version information and exit.--argumentsβ print expanded command line arguments. great for when you're like "what did the shell actually do to my command π"-q,--quietβ quiet mode, print no warnings and errors.-v,--verboseβ verbose mode, print processing details. she's chatty and we love her.-d,--debugβ debug mode, print debug information. full transparency, no secrets.-ll,--log-level[l]evel: string constant β use level l for the logger. valid levels arefatal,error,warn,info,debug,trace. pick your fighter.-lc,--log-config[f]ilename: string β use config file f for the logger. fancy logging era π
input options π§
input file format β tell her what she's dealing with, or just let her figure it out:
+fa,--filetype-autoβ automatically determine file type. this is the default, and honestly? queen behavior.+fp,--filetype-pdfβ expect PDF file.+fc,--filetype-cdaβ expect CDA file.+fs,--filetype-stlβ expect STL file.+fm,--filetype-mtlβ expect MTL file.+fo,--filetype-objβ expect OBJ file.
DICOM document options π
document title
+t,--title[t]itle: string β document title. default: empty.+cn,--concept-name[CSD] [CV] [CM]: string β coded representation of document title, defined by coding scheme designator CSD, code value CV and code meaning CM. default: empty.
patient data
+pn,--patient-name[n]ame: string β patient's name in DICOM PN syntax. yes, the specific syntax. don't freestyle it.+pi,--patient-id[i]d: string β patient identifier.+pb,--patient-birthdate[d]ate: string (YYYYMMDD) β patient's birth date. that exact format, no "March 3rd" energy.+ps,--patient-sex[s]ex: string (M,ForO) β patient's sex. three options, pick one.
device data
+mn,--manufacturer[n]ame: string β manufacturer's name.+mm,--manufacturer-model[n]ame: string β manufacturer's model name.+ds,--device-serial[n]umber: string β device serial number.+sv,--software-versions[v]ersions: string β software versions.
manufacturing 3d model data (STL/MTL/OBJ only, so don't come here with a PDF bestie)
+mu,--measurement-units[CSD] [CV] [CM]: string β measurement units with coding scheme designator CSD, code value CV and code meaning CM. default:UCUM, um, um.
study and series
+sg,--generateβ generate new study and series UIDs. this is the default.+st,--study-from[f]ilename: string β read patient/study data from DICOM file.+se,--series-from[f]ilename: string β read patient/study/series data from DICOM file.
instance number
+i1,--instance-oneβ use instance number 1. default, but not with+se.+ii,--instance-incβ increment instance number. only with+se, so don't try it solo.+is,--instance-set[i]nstance number: integer β use instance number i.
burned-in annotation
+an,--annotation-yesβ document contains patient identifying data. this is the default.-an,--annotation-noβ document does not contain patient identifying data.
processing options π«Ά
CDA processing options
-ov,--no-overrideβ CDA patient and document data must match study, series or manually entered information. default. strict queen.+ov,--overrideβ CDA's data will be overwritten by study, series or manually entered information. she's flexible.
other processing options
-k,--key[k]ey:gggg,eeee="str", path or dictionaryname="str"β add further attribute. yes you can use it more than once, yes we'll talk about that in NOTES.
output options β
output transfer syntax
+te,--write-xfer-littleβ write with explicit VR little endian. default.+tb,--write-xfer-bigβ write with explicit VR big endian TS.+ti,--write-xfer-implicitβ write with implicit VR little endian TS.
group length encoding
-g,--group-length-removeβ write without group length elements. default.+g,--group-length-createβ write with group length elements.
length encoding in sequences and items
+e,--length-explicitβ write with explicit lengths. default.-e,--length-undefinedβ write with undefined lengths.
data set trailing padding (not with --write-dataset)
-p,--padding-offβ no padding. implicit if--write-dataset.+p,--padding-create[f]ile-pad [i]tem-pad: integer β align file on multiple of f bytes and items on multiple of i bytes.
π NOTES π
Attribute Sources
the application may be fed with some additional input for filling mandatory (and optional) attributes in the new DICOM file β like patient, study and series information. here's the rundown:
- The
--keyoption can be used to add further attributes to the DICOM output file. - It is also possible to specify sequences, items and nested attributes using the
--keyoption. in these cases, a special "path" notation has to be used. details on this path notation can be found in the documentation ofdcmodify. iykyk. - The
--keyoption can be present more than once. stack 'em. - The value part (after the
'=') may be absent, causing the attribute to be set with zero length. - Please be advised that the
--keyoption is applied at the very end, just before saving the DICOM file, so there is no value checking whatsoever.
π¨ okay this last one matters: no value checking whatsoever. she does not check your work. she trusts you. do not betray that trust.
π LOGGING π
the level of logging output of the various command line tools and underlying libraries can be specified by the user. by default, only errors and warnings are written to the standard error stream.
using option --verbose also informational messages like processing details are reported. option --debug can be used to get more details on the internal activity, e.g. for debugging purposes. other logging levels can be selected using option --log-level. in --quiet mode only fatal errors are reported β and in such very severe error events, the application will usually terminate. π for more details on the different logging levels, see documentation of module "oflog".
in case the logging output should be written to file (optionally with logfile rotation), to syslog (Unix) or the event log (Windows), option --log-config can be used. this configuration file also allows for directing only certain messages to a particular output stream and for filtering certain messages based on the module or application where they are generated. an example configuration file is provided in <etcdir>/logger.cfg. fancy.
π§ COMMAND LINE π§
all command line tools use the following notation for parameters: square brackets enclose optional values (0-1), three trailing dots indicate that multiple values are allowed (1-n), a combination of both means 0 to n values.
command line options are distinguished from parameters by a leading '+' or '-' sign, respectively. usually, order and position of command line options are arbitrary (i.e. they can appear anywhere). however, if options are mutually exclusive the rightmost appearance is used. this behavior conforms to the standard evaluation rules of common Unix shells. so like, last one wins. periodt.
in addition, one or more command files can be specified using an '@' sign as a prefix to the filename (e.g. @command.txt). such a command argument is replaced by the content of the corresponding text file (multiple whitespaces are treated as a single separator unless they appear between two quotation marks) prior to any further evaluation. please note that a command file cannot contain another command file β no inception, sorry bestie. this simple but effective approach allows one to summarize common combinations of options/parameters and avoids longish and confusing command lines. an example is provided in file <datadir>/dumppat.txt. π«Ά
π EXIT CODES π
the dcmencap utility uses the following exit codes when terminating. this enables the user to check for the reason why the application terminated. so if something went sideways, you can actually find out what.
general
EXITCODE_NO_ERRORβ0
input file errors
EXITCODE_INVALID_INPUT_FILEβ22
output file errors
EXITCODE_CANNOT_WRITE_OUTPUT_FILEβ40
π ENVIRONMENT π
the dcmencap utility will attempt to load DICOM data dictionaries specified in the DCMDICTPATH environment variable. by default, i.e. if the DCMDICTPATH environment variable is not set, the file <datadir>/dicom.dic will be loaded unless the dictionary is built into the application (default for Windows).
the default behavior should be preferred, and the DCMDICTPATH environment variable only used when alternative data dictionaries are required. the DCMDICTPATH environment variable has the same format as the Unix shell PATH variable in that a colon (":") separates entries. on Windows systems, a semicolon (";") is used as a separator. the data dictionary code will attempt to load each file specified in the DCMDICTPATH environment variable. it is an error if no data dictionary can be loaded. like, hard error. no dictionary, no vibes. π
π COPYRIGHT π
Copyright (C) 2018-2026 by OFFIS e.V., Escherweg 2, 26121 Oldenburg, Germany.
okay that's the whole thing, you're officially a dcmencap girlie now π
β¨
this has been Version 3.7.1, dated Sat Oct 17 2026 09:34:01 β go forth and encapsulate, bestie π¦π
π¦ where this page comes from
- arch rolling: dcmtk 3.7.1-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms