comparison OrthancFramework/Resources/Graveyard/FromDcmtkBridge.cpp @ 4044:d25f4c0fa160 framework

splitting code into OrthancFramework and OrthancServer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 20:30:34 +0200
parents Resources/Graveyard/FromDcmtkBridge.cpp@4922bdd046dd
children 304842a0d152
comparison
equal deleted inserted replaced
4043:6c6239aec462 4044:d25f4c0fa160
1 DcmElement* FromDcmtkBridge::CreateElementForTag(const DicomTag& tag)
2 {
3 DcmTag key(tag.GetGroup(), tag.GetElement());
4
5 if (tag.IsPrivate())
6 {
7 // This raises BitBucket issue 140 (Modifying private tags with
8 // REST API changes VR from LO to UN)
9 // https://bitbucket.org/sjodogne/orthanc/issues/140
10 LOG(WARNING) << "You are using DCMTK < 3.6.1: All the private tags "
11 "are considered as having a binary value representation";
12 return new DcmOtherByteOtherWord(key);
13 }
14 else if (IsBinaryTag(key))
15 {
16 return new DcmOtherByteOtherWord(key);
17 }
18
19 switch (key.getEVR())
20 {
21 // http://support.dcmtk.org/docs/dcvr_8h-source.html
22
23 /**
24 * Binary types, handled above
25 **/
26
27 #if DCMTK_VERSION_NUMBER >= 361
28 case EVR_OD:
29 #endif
30
31 #if DCMTK_VERSION_NUMBER >= 362
32 case EVR_OL:
33 #endif
34
35 case EVR_OB: // other byte
36 case EVR_OF: // other float
37 case EVR_OW: // other word
38 case EVR_UN: // unknown value representation
39 case EVR_ox: // OB or OW depending on context
40 throw OrthancException(ErrorCode_InternalError);
41
42
43 /**
44 * String types.
45 * http://support.dcmtk.org/docs/classDcmByteString.html
46 **/
47
48 case EVR_AS: // age string
49 return new DcmAgeString(key);
50
51 case EVR_AE: // application entity title
52 return new DcmApplicationEntity(key);
53
54 case EVR_CS: // code string
55 return new DcmCodeString(key);
56
57 case EVR_DA: // date string
58 return new DcmDate(key);
59
60 case EVR_DT: // date time string
61 return new DcmDateTime(key);
62
63 case EVR_DS: // decimal string
64 return new DcmDecimalString(key);
65
66 case EVR_IS: // integer string
67 return new DcmIntegerString(key);
68
69 case EVR_TM: // time string
70 return new DcmTime(key);
71
72 case EVR_UI: // unique identifier
73 return new DcmUniqueIdentifier(key);
74
75 case EVR_ST: // short text
76 return new DcmShortText(key);
77
78 case EVR_LO: // long string
79 return new DcmLongString(key);
80
81 case EVR_LT: // long text
82 return new DcmLongText(key);
83
84 case EVR_UT: // unlimited text
85 return new DcmUnlimitedText(key);
86
87 case EVR_SH: // short string
88 return new DcmShortString(key);
89
90 case EVR_PN: // person name
91 return new DcmPersonName(key);
92
93 #if DCMTK_VERSION_NUMBER >= 361
94 case EVR_UC: // unlimited characters
95 return new DcmUnlimitedCharacters(key);
96 #endif
97
98 #if DCMTK_VERSION_NUMBER >= 361
99 case EVR_UR: // URI/URL
100 return new DcmUniversalResourceIdentifierOrLocator(key);
101 #endif
102
103
104 /**
105 * Numerical types
106 **/
107
108 case EVR_SL: // signed long
109 return new DcmSignedLong(key);
110
111 case EVR_SS: // signed short
112 return new DcmSignedShort(key);
113
114 case EVR_UL: // unsigned long
115 return new DcmUnsignedLong(key);
116
117 case EVR_US: // unsigned short
118 return new DcmUnsignedShort(key);
119
120 case EVR_FL: // float single-precision
121 return new DcmFloatingPointSingle(key);
122
123 case EVR_FD: // float double-precision
124 return new DcmFloatingPointDouble(key);
125
126
127 /**
128 * Sequence types, should never occur at this point.
129 **/
130
131 case EVR_SQ: // sequence of items
132 throw OrthancException(ErrorCode_ParameterOutOfRange);
133
134
135 /**
136 * TODO
137 **/
138
139 case EVR_AT: // attribute tag
140 throw OrthancException(ErrorCode_NotImplemented);
141
142
143 /**
144 * Internal to DCMTK.
145 **/
146
147 case EVR_xs: // SS or US depending on context
148 case EVR_lt: // US, SS or OW depending on context, used for LUT Data (thus the name)
149 case EVR_na: // na="not applicable", for data which has no VR
150 case EVR_up: // up="unsigned pointer", used internally for DICOMDIR suppor
151 case EVR_item: // used internally for items
152 case EVR_metainfo: // used internally for meta info datasets
153 case EVR_dataset: // used internally for datasets
154 case EVR_fileFormat: // used internally for DICOM files
155 case EVR_dicomDir: // used internally for DICOMDIR objects
156 case EVR_dirRecord: // used internally for DICOMDIR records
157 case EVR_pixelSQ: // used internally for pixel sequences in a compressed image
158 case EVR_pixelItem: // used internally for pixel items in a compressed image
159 case EVR_UNKNOWN: // used internally for elements with unknown VR (encoded with 4-byte length field in explicit VR)
160 case EVR_PixelData: // used internally for uncompressed pixeld data
161 case EVR_OverlayData: // used internally for overlay data
162 case EVR_UNKNOWN2B: // used internally for elements with unknown VR with 2-byte length field in explicit VR
163 default:
164 break;
165 }
166
167 throw OrthancException(ErrorCode_InternalError);
168 }