File: fgtypes.cc

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 (304 lines) | stat: -rw-r--r-- 12,817 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
/*
 *
 *  Copyright (C) 2015-2024, Open Connections GmbH
 *  All rights reserved.  See COPYRIGHT file for details.
 *
 *  This software and supporting documentation are maintained by
 *
 *    OFFIS e.V.
 *    R&D Division Health
 *    Escherweg 2
 *    D-26121 Oldenburg, Germany
 *
 *
 *  Module:  dcmfg
 *
 *  Author:  Michael Onken
 *
 *  Purpose: Class for managing common functional group types
 *
 */

#include "dcmtk/config/osconfig.h"

#include "dcmtk/dcmdata/dcerror.h"
#include "dcmtk/dcmdata/dcdeftag.h"
#include "dcmtk/dcmfg/fgtypes.h"

OFLogger DCM_dcmfgLogger = OFLog::getLogger("dcmtk.dcmfg");

/*---------------------------------*
 *  constant definitions
 *---------------------------------*/

// Error Conditions
makeOFConditionConst(FG_EC_DoubledFG, OFM_dcmfg, 1, OF_error, "Doubled Functional Group");
makeOFConditionConst(FG_EC_NoSuchGroup, OFM_dcmfg, 2, OF_error, "No such Functional Group");
makeOFConditionConst(FG_EC_NotEnoughItems, OFM_dcmfg, 3, OF_error, "Not enough Items in Functional Group");
makeOFConditionConst(FG_EC_TooManyItems, OFM_dcmfg, 4, OF_error, "Too many Items in Functional Group");
makeOFConditionConst(FG_EC_InvalidData, OFM_dcmfg, 5, OF_error, "Invalid data in Functional Group");
makeOFConditionConst(FG_EC_CouldNotWriteFG, OFM_dcmfg, 6, OF_error, "Could not write Functional Group");
makeOFConditionConst(FG_EC_CouldNotInsertFG, OFM_dcmfg, 7, OF_error, "Could not insert Functional Group");
makeOFConditionConst(FG_EC_NoSharedFG, OFM_dcmfg, 8, OF_error, "No shared Functional Groups found");
makeOFConditionConst(FG_EC_NoPerFrameFG, OFM_dcmfg, 9, OF_error, "No Per-Frame Functional Groups found");
makeOFConditionConst(FG_EC_CouldNotCreateFG, OFM_dcmfg, 10, OF_error, "Could not create Functional Group");
makeOFConditionConst(FG_EC_CouldNotReadSourceImage, OFM_dcmfg, 11, OF_error, "Could not read source image");
makeOFConditionConst(FG_EC_CouldNotAddFG, OFM_dcmfg, 12, OF_error, "Could add Functional Group");
makeOFConditionConst(FG_EC_NotEnoughFrames, OFM_dcmfg, 13, OF_error, "Not enough frames");
makeOFConditionConst(FG_EC_NoStacksFound, OFM_dcmfg, 14, OF_error, "No stacks found");
makeOFConditionConst(FG_EC_SOPClassForbidsConcatenations, OFM_dcmfg, 15, OF_error, "SOP Class forbids Concatenations");
makeOFConditionConst(FG_EC_PixelDataMissing, OFM_dcmfg, 16, OF_error, "Pixel Data is missing");
makeOFConditionConst(FG_EC_PixelDataDimensionsInvalid, OFM_dcmfg, 17, OF_error, "Pixel Data dimensions invalid");
makeOFConditionConst(FG_EC_PixelDataTooLarge, OFM_dcmfg, 18, OF_error, "Pixel Data too large");
makeOFConditionConst(FG_EC_InconsistentConcatenationData, OFM_dcmfg, 19, OF_error, "Inconsistent Concatenation Data");
makeOFConditionConst(FG_EC_ConcatenationComplete, OFM_dcmfg, 20, OF_error, "Concatenation Complete - no more data");
makeOFConditionConst(FG_EC_UnsupportedPixelDataLayout, OFM_dcmfg, 21, OF_error, "Unsupported pixel data layout");

OFString DcmFGTypes::FGType2OFString(const DcmFGTypes::E_FGType fgType)
{
    switch (fgType)
    {
        /// Undefined functional group
        case EFG_UNDEFINED:
            return "Undefined Functional Group Macro";
            break;
        /// Unknown functional group
        case EFG_UNKNOWN:
            return "Unknown Functional Group Macro";
            break;
        /// Pixel Measures
        case EFG_PIXELMEASURES:
            return "Pixel Measures Functional Group Macro";
            break;
        /// Frame Content
        case EFG_FRAMECONTENT:
            return "Frame Content Functional Group Macro";
            break;
        /// CT Acquisition Details
        case EFG_CTACQUISITIONDETAILS:
            return "CT Acquisition Details Functional Group Macro";
            break;
        /// CT Acquisition Type
        case EFG_CTACQUISITIONTYPE:
            return "CT Acquisition Type Functional Group Macro";
            break;
        /// CT Additional X-Ray Source
        case EFG_CTADDITIONALXRAYSOURCE:
            return "CT Additional X-Ray Source";
            break;
        /// CT Exposure
        case EFG_CTEXPOSURE:
            return "CT Exposure Functional Group Macro";
            break;
        case EFG_CTGEOMETRY:
            return "CT Geometry Functional Group Macro";
        /// CT Image Frame Type
        case EFG_CTIMAGEFRAMETYPE:
            return "CT Image Frame Type Functional Group Macro";
            break;
        /// CT Position
        case EFG_CTPOSITION:
            return "CT Position Functional Group Macro";
            break;
        /// CT Reconstruction
        case EFG_CTRECONSTRUCTION:
            return "CT Reconstruction Functional Group Macro";
            break;
        /// CT Table Dynamics
        case EFG_CTTABLEDYNAMICS:
            return "CT Table Dynamics Functional Group Macro";
            break;
        /// CT X-Ray Details
        case EFG_CTXRAYDETAILS:
            return "CT X-Ray Details Functional Group Macro";
            break;
        /// Plane Position (Patient)
        case EFG_PLANEPOSPATIENT:
            return "Plane Position (Patient) Functional Group Macro";
            break;
        /// Plane Orientation (Patient)
        case EFG_PLANEORIENTPATIENT:
            return "Plane Orientation (Patient) Functional Group Macro";
            break;
        /// Derivation Image
        case EFG_DERIVATIONIMAGE:
            return "Derivation Image Functional Group Macro";
            break;
        /// Cardiac Synchronization
        case EFG_CARDIACSYNC:
            return "Cardiac Synchronization Functional Group Macro";
            break;
        /// Frame Anatomy
        case EFG_FRAMEANATOMY:
            return "Frame Anatomy Functional Group Macro";
            break;
        /// Pixel Value Transformation or Identity Pixel Value Transformation
        case EFG_PIXELVALUETRANSMETA:
            return "[CT|Identity] Pixel Value Transformation Functional Group Macro";
            break;
        /// Frame VOI LUT or Frame VOI LUT with LUT
        case EFG_FRAMEVOILUTMETA:
            return "Frame VOI LUT / Frame VOI LUT with LUT Macro";
            break;
        /// Real World Value Mapping
        case EFG_REALWORLDVALUEMAPPING:
            return "Real World Value Mapping Functional Group Macro";
            break;
        /// Contrast/Bolus Usage
        case EFG_CONTRASTBOLUSUSAGE:
            return "Contrast/Bolus Usage Group Macro";
            break;
        /// Pixel Intensity Relationship LUT
        case EFG_PIXELINTENSITYRELLUT:
            return "Pixel Intensity Relation LUT Functional Group Macro";
            break;
        /// Frame Pixel Shift
        case EFG_FRAMEPIXELSHIFT:
            return "Frame Pixel Shift Functional Group Macro";
            break;
        /// Patient Orientation in Frame
        case EFG_PATIENTORIENTINFRAME:
            return "Patient Orientation in Frame Functional Group Macro";
            break;
        /// Frame Display Shutter
        case EFG_FRAMEDISPLAYSHUTTER:
            return "Frame Display Shutter Functional Group Macro";
            break;
        /// Respiratory Synchronization
        case EFG_RESPIRATORYSYNC:
            return "Respiratory Synchronization Functional Group Macro";
            break;
        /// Irradiation Event Identification
        case EFG_IRRADIATIONEVENTIDENT:
            return "Irradiation Event Identification Functional Group Macro";
            break;
        /// Radiopharmaceutical Usage
        case EFG_RADIOPHARAMAUSAGE:
            return "Radiopharmaceutical Usage Functional Group Macro";
            break;
        /// Parametric Map Frame Type
        case EFG_PARAMETRICMAPFRAMETYPE:
            return "Parametric Map Frame Type Functional Group Macro";
            break;
        /// Patient Physiological State
        case EFG_PATIENTPHYSIOSTATE:
            return "Patient Physiological State Functional Group Macro";
            break;
        /// Plane Position (Volume)
        case EFG_PLANEPOSITIONVOLUME:
            return "Plane Position (Volume) Functional Group Macro";
            break;
        /// Plane Orientation (Volume)
        case EFG_PLANEORIENTVOLUME:
            return "Plane Orientation (Volume) Functional Group Macro";
            break;
        /// Temporal Position Macro
        case EFG_TEMPORALPOSITION:
            return "Temporal Position Functional Group Macro";
            break;
        /// Image Data Type
        case EFG_IMAGEDATATYPE:
            return "Image Data Type Functional Group Macro";
            break;
        /// Unassigned Shared Converted Attributes Macro
        case EFG_UNASSIGNEDSHAREDCONVERTEDATTRIBUTES:
            return "Unassigned Shared Converted Attributes Macro";
            break;
        /// Segmentation Macro
        case EFG_SEGMENTATION:
            return "Segmentation Functional Group Macro";
            break;
        /// US Image Description Functional Group Macro
        case EFG_USIMAGEDESCRIPTION:
            return "US Image Description Functional Group Macro";
            break;
    }
    return "Unknown Functional Group Macro (internal error)";
}

DcmFGTypes::E_FGType DcmFGTypes::tagKey2FGType(const DcmTagKey& key)
{
    // Note: Use neat value to enum trick from Alexandrescu in order to have switch statement instead?
    if (key == DCM_PixelMeasuresSequence)
        return EFG_PIXELMEASURES;
    else if (key == DCM_FrameContentSequence)
        return EFG_FRAMECONTENT;
    else if (key == DCM_CTAcquisitionDetailsSequence)
        return EFG_CTACQUISITIONDETAILS;
    else if (key == DCM_CTAdditionalXRaySourceSequence)
        return EFG_CTADDITIONALXRAYSOURCE;
    else if (key == DCM_CTAcquisitionTypeSequence)
        return EFG_CTACQUISITIONTYPE;
    else if (key == DCM_CTExposureSequence)
        return EFG_CTEXPOSURE;
    else if (key == DCM_CTGeometrySequence)
        return EFG_CTGEOMETRY;
    else if (key == DCM_CTImageFrameTypeSequence)
        return EFG_CTIMAGEFRAMETYPE;
    else if (key == DCM_CTPositionSequence)
        return EFG_CTPOSITION;
    else if (key == DCM_CTReconstructionSequence)
        return EFG_CTRECONSTRUCTION;
    else if (key == DCM_CTTableDynamicsSequence)
        return EFG_CTTABLEDYNAMICS;
    else if (key == DCM_CTXRayDetailsSequence)
        return EFG_CTXRAYDETAILS;
    else if (key == DCM_PlanePositionSequence)
        return EFG_PLANEPOSPATIENT;
    else if (key == DCM_PlaneOrientationSequence)
        return EFG_PLANEORIENTPATIENT;
    else if (key == DCM_DerivationImageSequence)
        return EFG_DERIVATIONIMAGE;
    else if (key == DCM_CardiacSynchronizationSequence)
        return EFG_CARDIACSYNC;
    else if (key == DCM_FrameAnatomySequence)
        return EFG_FRAMEANATOMY;
    else if (key == DCM_PixelValueTransformationSequence)
        return EFG_PIXELVALUETRANSMETA;
    else if (key == DCM_FrameVOILUTSequence)
        return EFG_FRAMEVOILUTMETA;
    else if (key == DCM_RealWorldValueMappingSequence)
        return EFG_REALWORLDVALUEMAPPING;
    else if (key == DCM_ContrastBolusUsageSequence)
        return EFG_CONTRASTBOLUSUSAGE;
    else if (key == DCM_PixelIntensityRelationshipLUTSequence)
        return EFG_PIXELINTENSITYRELLUT;
    else if (key == DCM_FramePixelShiftSequence)
        return EFG_FRAMEPIXELSHIFT;
    else if (key == DCM_PatientOrientationInFrameSequence)
        return EFG_PATIENTORIENTINFRAME;
    else if (key == DCM_FrameDisplayShutterSequence)
        return EFG_FRAMEDISPLAYSHUTTER;
    else if (key == DCM_RespiratorySynchronizationSequence)
        return EFG_RESPIRATORYSYNC;
    else if (key == DCM_IrradiationEventIdentificationSequence)
        return EFG_IRRADIATIONEVENTIDENT;
    else if (key == DCM_RadiopharmaceuticalUsageSequence)
        return EFG_RADIOPHARAMAUSAGE;
    else if (key == DCM_PatientPhysiologicalStateSequence)
        return EFG_PATIENTPHYSIOSTATE;
    else if (key == DCM_ParametricMapFrameTypeSequence)
        return EFG_PARAMETRICMAPFRAMETYPE;
    else if (key == DCM_PlanePositionVolumeSequence)
        return EFG_PLANEPOSITIONVOLUME;
    else if (key == DCM_PlaneOrientationVolumeSequence)
        return EFG_PLANEORIENTVOLUME;
    else if (key == DCM_TemporalPositionSequence)
        return EFG_TEMPORALPOSITION;
    else if (key == DCM_ImageDataTypeSequence)
        return EFG_IMAGEDATATYPE;
    else if (key == DCM_UnassignedSharedConvertedAttributesSequence)
        return EFG_UNASSIGNEDSHAREDCONVERTEDATTRIBUTES;
    else if (key == DCM_SegmentIdentificationSequence)
        return EFG_SEGMENTATION;
    else if (key == DCM_USImageDescriptionSequence)
        return EFG_USIMAGEDESCRIPTION;
    else
        return EFG_UNKNOWN;
}

OFString DcmFGTypes::tagKey2FGString(const DcmTagKey& key)
{
    E_FGType fgtype = tagKey2FGType(key);
    return FGType2OFString(fgtype);
}