File: dcmdata.dox

package info (click to toggle)
dcmtk 3.6.9-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 95,648 kB
  • sloc: ansic: 426,874; cpp: 318,177; makefile: 6,401; sh: 4,341; yacc: 1,026; xml: 482; lex: 321; perl: 277
file content (101 lines) | stat: -rw-r--r-- 2,738 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*!

\page mod_dcmdata dcmdata: a data encoding/decoding library and utility apps

This module contains classes to manage DICOM data structures and files. It
also provides support for DICOMDIR files as required for DICOM storage media.

The main interface classes are:
\li \b DcmFileFormat
\li \b DcmDataset
\li \b DcmItem
\li \b DcmElement

Here are some further classes that are of interest:
\li \b DcmTag
\li \b DcmTagKey
\li \b DicomDirInterface

\section Tools

This module contains the following command line tools:
\li \ref cda2dcm
\li \ref dcm2cda
\li \ref dcm2json
\li \ref dcm2pdf
\li \ref dcm2xml
\li \ref dcmconv
\li \ref dcmcrle
\li \ref dcmdrle
\li \ref dcmdump
\li \ref dcmftest
\li \ref dcmgpdir
\li \ref dcmodify
\li \ref dump2dcm
\li \ref img2dcm
\li \ref pdf2dcm
\li \ref stl2dcm
\li \ref xml2dcm

\section Files

The following file provides further documentation:
\li \ref file_datadict

\section Examples

The following example shows how to load a DICOM file and output the patient's name:

\code
DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile("test.dcm");
if (status.good())
{
  OFString patientName;
  if (fileformat.getDataset()->findAndGetOFString(DCM_PatientName, patientName).good())
  {
    cout << "Patient's Name: " << patientName << endl;
  } else
    cerr << "Error: cannot access Patient's Name!" << endl;
} else
  cerr << "Error: cannot read DICOM file (" << status.text() << ")" << endl;
\endcode

The following example shows how to create a DICOM dataset and save it to a file:

\code
char uid[100];
DcmFileFormat fileformat;
DcmDataset *dataset = fileformat.getDataset();
dataset->putAndInsertString(DCM_SOPClassUID, UID_SecondaryCaptureImageStorage);
dataset->putAndInsertString(DCM_SOPInstanceUID, dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT));
dataset->putAndInsertString(DCM_PatientName, "Doe^John");
/* ... */
dataset->putAndInsertUint8Array(DCM_PixelData, pixelData, pixelLength);
OFCondition status = fileformat.saveFile("test.dcm", EXS_LittleEndianExplicit);
if (status.bad())
  cerr << "Error: cannot write DICOM file (" << status.text() << ")" << endl;
\endcode

The following example shows how to create a general purpose DICOMDIR from multiple files:

\code
DicomDirInterface dicomdir;
OFCondition status = dicomdir.createNewDicomDir();
if (status.good())
{
  while ( /* there are files */ )
    dicomdir.addDicomFile( /* current filename */ );
  status = dicomdir.writeDicomDir();
  if (status.bad())
    cerr << "Error: cannot write DICOMDIR (" << status.text() << ")" << endl;
} else
  cerr << "Error: cannot create DICOMDIR (" << status.text() << ")" << endl;
\endcode

*/

/*!
    \page file_datadict datadict.txt file
    \verbinclude datadict.txt
*/