1 /*
2  *
3  *  Copyright (C) 2015-2019, Open Connections GmbH
4  *  All rights reserved.  See COPYRIGHT file for details.
5  *
6  *  This software and supporting documentation are maintained by
7  *
8  *    OFFIS e.V.
9  *    R&D Division Health
10  *    Escherweg 2
11  *    D-26121 Oldenburg, Germany
12  *
13  *
14  *  Module:  dcmfg
15  *
16  *  Author:  Michael Onken
17  *
18  *  Purpose: Class for managing common functional group types
19  *
20  */
21 
22 #ifndef FGTYPES_H
23 #define FGTYPES_H
24 
25 #include "dcmtk/config/osconfig.h"
26 
27 #include "dcmtk/dcmdata/dctk.h"
28 #include "dcmtk/dcmfg/fgdefine.h"
29 #include "dcmtk/oflog/oflog.h"
30 
31 class FGBase;
32 class FunctionalGroups;
33 
34 /*-----------------------*
35  *  logging              *
36  *-----------------------*/
37 
38 extern DCMTK_DCMFG_EXPORT OFLogger DCM_dcmfgLogger;
39 
40 #define DCMFG_TRACE(msg) OFLOG_TRACE(DCM_dcmfgLogger, msg)
41 #define DCMFG_DEBUG(msg) OFLOG_DEBUG(DCM_dcmfgLogger, msg)
42 #define DCMFG_INFO(msg) OFLOG_INFO(DCM_dcmfgLogger, msg)
43 #define DCMFG_WARN(msg) OFLOG_WARN(DCM_dcmfgLogger, msg)
44 #define DCMFG_ERROR(msg) OFLOG_ERROR(DCM_dcmfgLogger, msg)
45 #define DCMFG_FATAL(msg) OFLOG_FATAL(DCM_dcmfgLogger, msg)
46 
47 // include this file in doxygen documentation
48 
49 /** @file fgtypes.h
50  *  @brief type definitions, constants and helper functions for the dcmfg module
51  */
52 
53 /*-----------------------*
54  *  constant definitions  *
55  *-----------------------*/
56 
57 /* Specific error conditions for module dcmfg.
58  * These error codes can be used in addition to the general purpose
59  * codes defined in module dcmdata.
60  */
61 
62 /// Functional group already exists
63 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_DoubledFG;
64 /// Specified functional group does not exist
65 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_NoSuchGroup;
66 /// Not enough items
67 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_NotEnoughItems;
68 /// Too many Items
69 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_TooManyItems;
70 /// Invalid data
71 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_InvalidData;
72 /// Could not write functional group
73 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_CouldNotWriteFG;
74 /// Could not insert functional group
75 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_CouldNotInsertFG;
76 /// No such shared functional group
77 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_NoSharedFG;
78 /// No such per-frame functional group
79 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_NoPerFrameFG;
80 /// Could not create functional group
81 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_CouldNotCreateFG;
82 /// Could not create functional group
83 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_CouldNotReadSourceImage;
84 /// Could not create functional group
85 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_CouldNotAddFG;
86 /// Not enough frames found
87 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_NotEnoughFrames;
88 /// No stacks specified (but expected)
89 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_NoStacksFound;
90 /// SOP Class does allow Concatenations
91 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_SOPClassForbidsConcatenations;
92 /// Pixel Data is missing
93 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_PixelDataMissing;
94 /// Pixel Data dimensions invalid
95 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_PixelDataDimensionsInvalid;
96 /// Pixel Data element too large
97 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_PixelDataTooLarge;
98 /// Inconsistent Concatenation Data
99 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_InconsistentConcatenationData;
100 /// Concatenation Complete - no more data available
101 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_ConcatenationComplete;
102 /// Unsupported pixel data layout
103 extern DCMTK_DCMFG_EXPORT const OFConditionConst FG_EC_UnsupportedPixelDataLayout;
104 
105 /*---------------------*
106  *  class declaration  *
107  *---------------------*/
108 
109 /** General purpose class hiding global functions, constants and types related
110  *  to functional groups from the global namespace.
111  */
112 class DCMTK_DCMFG_EXPORT DcmFGTypes
113 {
114 
115 public:
116     // --- Type definitions ---
117 
118     /** Functional group types
119      */
120     enum E_FGType
121     {
122         /// Undefined functional group
123         EFG_UNDEFINED,
124         /// Unknown functional group
125         EFG_UNKNOWN,
126         /// Cardiac Synchronization
127         EFG_CARDIACSYNC,
128         /// Contrast/Bolus Usage
129         EFG_CONTRASTBOLUSUSAGE,
130         /// CT Acquisition Details
131         EFG_CTACQUISITIONDETAILS,
132         /// CT Acquisition Type
133         EFG_CTACQUISITIONTYPE,
134         /// CT Additional X-Ray Source
135         EFG_CTADDITIONALXRAYSOURCE,
136         /// CT Exposure
137         EFG_CTEXPOSURE,
138         /// CT Geometry
139         EFG_CTGEOMETRY,
140         /// CT Image Frame Type
141         EFG_CTIMAGEFRAMETYPE,
142         /// CT Position
143         EFG_CTPOSITION,
144         /// CT Reconstruction
145         EFG_CTRECONSTRUCTION,
146         /// CT Table Dynamics
147         EFG_CTTABLEDYNAMICS,
148         /// CT X-Ray Details
149         EFG_CTXRAYDETAILS,
150         /// Derivation Image
151         EFG_DERIVATIONIMAGE,
152         /// Frame Anatomy
153         EFG_FRAMEANATOMY,
154         /// Frame Content
155         EFG_FRAMECONTENT,
156         /// Frame Display Shutter
157         EFG_FRAMEDISPLAYSHUTTER,
158         /// Frame Pixel Shift
159         EFG_FRAMEPIXELSHIFT,
160         /// "Frame VOI LUT" or "Frame VOI LUT with LUT" Macro (share same starting sequence)
161         EFG_FRAMEVOILUTMETA,
162         /// Image Data Type
163         EFG_IMAGEDATATYPE,
164         /// Irradiation Event Identification
165         EFG_IRRADIATIONEVENTIDENT,
166         /// Parametric Map Frame Type
167         EFG_PARAMETRICMAPFRAMETYPE,
168         /// Patient Orientation in Frame
169         EFG_PATIENTORIENTINFRAME,
170         /// Patient Physiological State
171         EFG_PATIENTPHYSIOSTATE,
172         /// Pixel Intensity Relationship LUT
173         EFG_PIXELINTENSITYRELLUT,
174         /// Pixel Measures
175         EFG_PIXELMEASURES,
176         /// "Pixel Value Transformation", "Identity Pixel Value Transformation", or
177         /// "CT Pixel Value Transformation"; all the same sequence and attributes.
178         EFG_PIXELVALUETRANSMETA,
179         /// Plane Orientation (Volume)
180         EFG_PLANEORIENTVOLUME,
181         /// Plane Position (Volume)
182         EFG_PLANEPOSITIONVOLUME,
183         /// Plane Position (Patient)
184         EFG_PLANEPOSPATIENT,
185         /// Plane Orientation (Patient)
186         EFG_PLANEORIENTPATIENT,
187         /// Radiopharmaceutical Usage
188         EFG_RADIOPHARAMAUSAGE,
189         /// Real World Value Mapping
190         EFG_REALWORLDVALUEMAPPING,
191         /// Respiratory Synchronization
192         EFG_RESPIRATORYSYNC,
193         /// Segmentation Macro
194         EFG_SEGMENTATION,
195         /// Temporal Position Macro
196         EFG_TEMPORALPOSITION,
197         /// Unassigned Shared Converted Attributes Macro
198         EFG_UNASSIGNEDSHAREDCONVERTEDATTRIBUTES,
199         /// US Image Description Macro
200         EFG_USIMAGEDESCRIPTION
201     };
202 
203     /** Functional group types
204      */
205     enum E_FGSharedType
206     {
207         /// Unknown
208         EFGS_UNKNOWN,
209         /// Functional Group can be shared or per-frame
210         EFGS_BOTH,
211         /// Functional Group can only be shared (not per-frame)
212         EFGS_ONLYSHARED,
213         /// Functional Group can only be per-frame (not shared)
214         EFGS_ONLYPERFRAME
215     };
216 
217     /** US Image Description Frame Type (first value)
218      */
219     enum E_FGUSFrameType
220     {
221         /// Unknown
222         EFGFT_UNKNOWN,
223         /// ORIGINAL
224         EFGFT_ORIGINAL,
225         /// DERIVED
226         EFGFT_DERIVED
227     };
228 
229     // -- static helpers --
230 
231     /** Returns functional group type based on tag key
232      *  @param  key The key to get the group type for
233      *  @return The functional group type
234      */
235     static E_FGType tagKey2FGType(const DcmTagKey& key);
236 
237     /** Returns the name of the functional group based on the group type
238      *  @param  fgType The functional group type
239      *  @return The name of the functional group
240      */
241     static OFString FGType2OFString(const E_FGType fgType);
242 
243     /** Returns the name of a functional group based on a given tag key
244      *  @param  key The tag key to get the functional group type for
245      *  @return The name of the functional group
246      */
247     static OFString tagKey2FGString(const DcmTagKey& key);
248 };
249 
250 #endif // FGTYPES_H
251