1 /*
2  *
3  *  Copyright (C) 2015-2020, J. Riesmeier, Oldenburg, Germany
4  *  All rights reserved.  See COPYRIGHT file for details.
5  *
6  *  Header file for class CID7464_GeneralRegionOfInterestMeasurementModifiers
7  *
8  *  Generated automatically from DICOM PS 3.16-2020e
9  *  File created on 2020-11-25 11:13:12 by J. Riesmeier
10  *
11  */
12 
13 
14 #ifndef CMR_CID7464_H
15 #define CMR_CID7464_H
16 
17 #include "dcmtk/config/osconfig.h"   /* make sure OS specific configuration is included first */
18 
19 #include "dcmtk/dcmsr/dsrctxgr.h"
20 #include "dcmtk/dcmsr/cmr/define.h"
21 
22 #include "dcmtk/ofstd/ofmap.h"
23 
24 
25 /*---------------------*
26  *  class declaration  *
27  *---------------------*/
28 
29 /** Implementation of DCMR Context Group:
30  *  CID 7464 - General Region of Interest Measurement Modifiers.
31  *  (type: extensible, version: 20121101)
32  */
33 class DCMTK_CMR_EXPORT CID7464_GeneralRegionOfInterestMeasurementModifiers
34   : public DSRContextGroup
35 {
36 
37   public:
38 
39     /** types of general region of interest measurement modifiers
40      */
41     enum EnumType
42     {
43         /// (56851009,SCT,"Maximum"), included from CID 3488
44         Maximum,
45         /// (255605001,SCT,"Minimum"), included from CID 3488
46         Minimum,
47         /// (373098007,SCT,"Mean"), included from CID 3488
48         Mean,
49         /// (386136009,SCT,"Standard Deviation")
50         StandardDeviation,
51         /// (255619001,SCT,"Total")
52         Total,
53         /// (373099004,SCT,"Median")
54         Median,
55         /// (373100007,SCT,"Mode")
56         Mode,
57         /// (126031,DCM,"Peak Value Within ROI")
58         PeakValueWithinROI,
59         /// (C0681921,UMLS,"Coefficient of Variance")
60         CoefficientOfVariance,
61         /// (126051,DCM,"Skewness")
62         Skewness,
63         /// (126052,DCM,"Kurtosis")
64         Kurtosis,
65         /// (C1711260,UMLS,"Variance")
66         Variance,
67         /// (C2347976,UMLS,"Root Mean Square")
68         RootMeanSquare
69     };
70 
71     /** (default) constructor
72      ** @param  selectedValue  coded entry to be selected as the current value (optional).
73      *                         Should be a valid code according to the DICOM definitions
74      *                         for this context group, i.e. no checks are performed.
75      *                         Call DSRContextGroup::checkSelectedValue() if needed.
76      */
77     CID7464_GeneralRegionOfInterestMeasurementModifiers(const DSRCodedEntryValue &selectedValue = DSRCodedEntryValue());
78 
79     /** constructor
80      ** @param  selectedValue         type mapped to a coded entry that is selected as the
81      *                                current value
82      ** @param  enhancedEncodingMode  set enhanced encoding mode for coded entry (if enabled)
83      */
84     CID7464_GeneralRegionOfInterestMeasurementModifiers(const EnumType selectedValue,
85                                                         const OFBool enhancedEncodingMode = OFFalse);
86 
87     /** select a coded entry given by its type as the current value
88      ** @param  selectedValue         type mapped to a coded entry that is selected as the
89      *                                current value
90      *  @param  enhancedEncodingMode  set enhanced encoding mode for coded entry (if enabled)
91      ** @return status, EC_Normal if successful, an error code otherwise
92      */
93     virtual OFCondition selectValue(const EnumType selectedValue,
94                                     const OFBool enhancedEncodingMode = OFFalse);
95 
96   // --- static helper functions ---
97 
98     /** initialize this context group explicitly.  Internally, the list of standard coded
99      *  entries is created and initialized by calling getCodes().
100      ** @note This function can be called multiple times but in case of multi-threaded
101      *        applications should be called at least once before any instance of this class
102      *        is actually used.  For single-threaded applications, there is no need to call
103      *        it since the initialization is done implicitly.
104      */
105     static void initialize();
106 
107     /** cleanup this context group, i.e.\ delete the internal list of standard coded entries.
108      *  Usually, there is no need to call this method, but it might be useful in order to
109      *  explicitly free the associated memory, e.g. when checking for memory leaks.  The list
110      *  will be recreated automatically when needed (or when initialize() is called).
111      */
112     static void cleanup();
113 
114     /** map a given type to the associated coded entry
115      ** @param  value                 type that should be mapped to a coded entry
116      *  @param  enhancedEncodingMode  set enhanced encoding mode for coded entry (if enabled)
117      ** @return coded entry that is associated with the given type
118      */
119     static DSRCodedEntryValue getCodedEntry(const EnumType value,
120                                             const OFBool enhancedEncodingMode = OFFalse);
121 
122   // --- reintroduce methods from base class
123 
124      using DSRContextGroup::selectValue;
125      using DSRContextGroup::findCodedEntry;
126 
127 
128   protected:
129 
130     /// type used for storing and managing the coded entries
131     typedef OFMap<EnumType, DSRBasicCodedEntry> CodeList;
132 
133     /** print details on coded entries that are contained in this context group.
134      *  See DSRCodedEntryValue::print() for details of the coded entry output.
135      ** @param  stream  stream to which the output should be printed
136      */
137     virtual void printCodes(STD_NAMESPACE ostream &stream) const;
138 
139     /** search for a given coded entry in this context group
140      ** @param  searchForCodedEntry   coded entry to be searched for
141      *  @param  foundCodedEntry       pointer to variable that will store the coded entry
142      *                                (if found and pointer is not NULL)
143      *  @param  enhancedEncodingMode  set enhanced encoding mode for coded entry (if enabled)
144      ** @return result of the search process, also defines the type of the entry
145      */
146     virtual OFCondition findCodedEntry(const DSRCodedEntryValue &searchForCodedEntry,
147                                        DSRCodedEntryValue *foundCodedEntry,
148                                        const OFBool enhancedEncodingMode = OFFalse) const;
149 
150   // --- static helper function ---
151 
152     /** get list of standard coded entries that are managed by this context group.
153      *  Internally, the singleton pattern is used, so the list is initialized only once.
154      *  Please note that this function is not thread-safe.  Therefore, the initialize()
155      *  function can be called before any instance of this class is actually used.
156      ** @return reference to list of coded entries managed by this context group
157      */
158     static CodeList &getCodes();
159 
160     /** set the "Enhanced Encoding Mode" for a given coded entry
161      ** @param  codedEntryValue  coded entry for which the enhanced encoding mode is set
162      ** @return status, EC_Normal if successful, an error code otherwise
163      */
164     static OFCondition setEnhancedEncodingMode(DSRCodedEntryValue &codedEntryValue);
165 
166 
167   private:
168 
169     /// pointer to internal code list (use a static variable for singleton pattern)
170     static CodeList *Codes;
171 };
172 
173 
174 /*-------------------*
175  *  type definition  *
176  *-------------------*/
177 
178 // define short name for the context group class
179 typedef CID7464_GeneralRegionOfInterestMeasurementModifiers CMR_CID7464;
180 
181 
182 #endif
183