1 /*
2  *
3  *  Copyright (C) 2015-2020, J. Riesmeier, Oldenburg, Germany
4  *  All rights reserved.  See COPYRIGHT file for details.
5  *
6  *  Source file for class CID7181_AbstractMultiDimensionalImageModelComponentUnits
7  *
8  *  Generated automatically from DICOM PS 3.16-2020e
9  *  File created on 2020-11-25 11:13:05 by J. Riesmeier
10  *
11  */
12 
13 
14 #include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
15 
16 #include "dcmtk/dcmsr/cmr/cid7181.h"
17 
18 
19 // general information on CID 7181 (Abstract Multi-dimensional Image Model Component Units)
20 #define CONTEXT_GROUP_NUMBER  "7181"
21 #define CONTEXT_GROUP_VERSION "20180605"
22 #define CONTEXT_GROUP_UID     "1.2.840.10008.6.1.918"
23 #define CONTEXT_GROUP_TYPE    OFTrue  /* extensible */
24 
25 // initialize global/static variable
26 CID7181_AbstractMultiDimensionalImageModelComponentUnits::CodeList *CID7181_AbstractMultiDimensionalImageModelComponentUnits::Codes = NULL;
27 
28 
CID7181_AbstractMultiDimensionalImageModelComponentUnits(const DSRCodedEntryValue & selectedValue)29 CID7181_AbstractMultiDimensionalImageModelComponentUnits::CID7181_AbstractMultiDimensionalImageModelComponentUnits(const DSRCodedEntryValue &selectedValue)
30   : DSRContextGroup(CONTEXT_GROUP_NUMBER, "DCMR", CONTEXT_GROUP_VERSION, CONTEXT_GROUP_UID, selectedValue)
31 {
32     setExtensible(CONTEXT_GROUP_TYPE);
33 }
34 
35 
CID7181_AbstractMultiDimensionalImageModelComponentUnits(const EnumType selectedValue,const OFBool enhancedEncodingMode)36 CID7181_AbstractMultiDimensionalImageModelComponentUnits::CID7181_AbstractMultiDimensionalImageModelComponentUnits(const EnumType selectedValue,
37                                                                                                                    const OFBool enhancedEncodingMode)
38   : DSRContextGroup(CONTEXT_GROUP_NUMBER, "DCMR", CONTEXT_GROUP_VERSION, CONTEXT_GROUP_UID, getCodedEntry(selectedValue, enhancedEncodingMode))
39 {
40     setExtensible(CONTEXT_GROUP_TYPE);
41 }
42 
43 
selectValue(const EnumType selectedValue,const OFBool enhancedEncodingMode)44 OFCondition CID7181_AbstractMultiDimensionalImageModelComponentUnits::selectValue(const EnumType selectedValue,
45                                                                                   const OFBool enhancedEncodingMode)
46 {
47     /* never check the coded entry */
48     return DSRContextGroup::selectValue(getCodedEntry(selectedValue, enhancedEncodingMode), OFFalse /*check*/, OFFalse /*definedContextGroup*/);
49 }
50 
51 
findCodedEntry(const DSRCodedEntryValue & searchForCodedEntry,DSRCodedEntryValue * foundCodedEntry,const OFBool enhancedEncodingMode) const52 OFCondition CID7181_AbstractMultiDimensionalImageModelComponentUnits::findCodedEntry(const DSRCodedEntryValue &searchForCodedEntry,
53                                                                                      DSRCodedEntryValue *foundCodedEntry,
54                                                                                      const OFBool enhancedEncodingMode) const
55 {
56     OFCondition result = SR_EC_CodedEntryNotInContextGroup;
57     /* first, search for standard codes */
58     CodeList::const_iterator iter = getCodes().begin();
59     CodeList::const_iterator last = getCodes().end();
60     /* iterate over coded entry list */
61     while (iter != last)
62     {
63         /* if found, exit loop */
64         if (searchForCodedEntry == iter->second)
65         {
66             /* return coded entry (if requested) */
67             if (foundCodedEntry != NULL)
68             {
69                 *foundCodedEntry = iter->second;
70                 /* also set enhanced encoding mode (if enabled) */
71                 if (!foundCodedEntry->isEmpty() && enhancedEncodingMode)
72                     setEnhancedEncodingMode(*foundCodedEntry);
73             }
74             result = SR_EC_CodedEntryInStandardContextGroup;
75             break;
76         }
77         ++iter;
78     }
79     /* if not, continue with extended codes */
80     if (result.bad())
81     {
82         result = DSRContextGroup::findCodedEntry(searchForCodedEntry, foundCodedEntry);
83         /* tbd: set "enhanced encoding mode" to mark a local/extended version? */
84     }
85     return result;
86 }
87 
88 
printCodes(STD_NAMESPACE ostream & stream) const89 void CID7181_AbstractMultiDimensionalImageModelComponentUnits::printCodes(STD_NAMESPACE ostream &stream) const
90 {
91     /* print standard codes */
92     stream << "Standard codes:" << OFendl;
93     CodeList::const_iterator iter = getCodes().begin();
94     CodeList::const_iterator last = getCodes().end();
95     /* iterate over coded entry list */
96     while (iter != last)
97     {
98         stream << "  ";
99         /* print coded entry */
100         DSRCodedEntryValue(iter->second).print(stream);
101         stream << OFendl;
102         ++iter;
103     }
104     /* print extended codes */
105     DSRContextGroup::printCodes(stream);
106 }
107 
108 
109 // static functions
110 
initialize()111 void CID7181_AbstractMultiDimensionalImageModelComponentUnits::initialize()
112 {
113     /* create and initialize code list */
114     getCodes();
115 }
116 
117 
cleanup()118 void CID7181_AbstractMultiDimensionalImageModelComponentUnits::cleanup()
119 {
120     /* delete code list, it will be recreated automatically when needed */
121     delete Codes;
122     Codes = NULL;
123 }
124 
125 
getCodedEntry(const EnumType value,const OFBool enhancedEncodingMode)126 DSRCodedEntryValue CID7181_AbstractMultiDimensionalImageModelComponentUnits::getCodedEntry(const EnumType value,
127                                                                                            const OFBool enhancedEncodingMode)
128 {
129     DSRCodedEntryValue codedEntry;
130     /* search for given enumerated value */
131     CodeList::iterator iter = getCodes().find(value);
132     /* if found, set the coded entry */
133     if (iter != getCodes().end())
134     {
135         codedEntry = iter->second;
136         /* also set enhanced encoding mode (if enabled) */
137         if (!codedEntry.isEmpty() && enhancedEncodingMode)
138             setEnhancedEncodingMode(codedEntry);
139     }
140     return codedEntry;
141 }
142 
143 
getCodes()144 CID7181_AbstractMultiDimensionalImageModelComponentUnits::CodeList &CID7181_AbstractMultiDimensionalImageModelComponentUnits::getCodes()
145 {
146     /* check whether code list has already been created and initialized */
147     if (Codes == NULL)
148     {
149         /* create a new code list (should never fail) */
150         Codes = new CodeList();
151         /* and initialize it by adding the coded entries */
152         Codes->insert(OFMake_pair(MmHg, DSRBasicCodedEntry("mm[Hg]", "UCUM", "mmHg")));
153         Codes->insert(OFMake_pair(KPa, DSRBasicCodedEntry("kPa", "UCUM", "kPa")));
154         Codes->insert(OFMake_pair(PRU, DSRBasicCodedEntry("[PRU]", "UCUM", "P.R.U.")));
155         Codes->insert(OFMake_pair(WoodU, DSRBasicCodedEntry("[wood'U]", "UCUM", "Wood U")));
156         Codes->insert(OFMake_pair(Dynscm5, DSRBasicCodedEntry("dyn.s.cm-5", "UCUM", "dyn.s.cm-5")));
157         Codes->insert(OFMake_pair(PRUPerM2, DSRBasicCodedEntry("[PRU]/m2", "UCUM", "P.R.U./m2")));
158         Codes->insert(OFMake_pair(WoodUPerM2, DSRBasicCodedEntry("[wood'U]/m2", "UCUM", "Wood U/m2")));
159         Codes->insert(OFMake_pair(Dynscm5PerM2, DSRBasicCodedEntry("dyn.s.cm-5/m2", "UCUM", "dyn.s.cm-5/m2")));
160         Codes->insert(OFMake_pair(Centimeter, DSRBasicCodedEntry("cm", "UCUM", "centimeter")));
161         Codes->insert(OFMake_pair(Millimeter, DSRBasicCodedEntry("mm", "UCUM", "millimeter")));
162         Codes->insert(OFMake_pair(Micrometer, DSRBasicCodedEntry("um", "UCUM", "micrometer")));
163         Codes->insert(OFMake_pair(SquareCentimeter, DSRBasicCodedEntry("cm2", "UCUM", "square centimeter")));
164         Codes->insert(OFMake_pair(SquareMillimeter, DSRBasicCodedEntry("mm2", "UCUM", "square millimeter")));
165         Codes->insert(OFMake_pair(SquareMicrometer, DSRBasicCodedEntry("um2", "UCUM", "square micrometer")));
166         Codes->insert(OFMake_pair(CubicDecimeter, DSRBasicCodedEntry("dm3", "UCUM", "cubic decimeter")));
167         Codes->insert(OFMake_pair(CubicCentimeter, DSRBasicCodedEntry("cm3", "UCUM", "cubic centimeter")));
168         Codes->insert(OFMake_pair(CubicMillimeter, DSRBasicCodedEntry("mm3", "UCUM", "cubic millimeter")));
169         Codes->insert(OFMake_pair(CubicMicrometer, DSRBasicCodedEntry("um3", "UCUM", "cubic micrometer")));
170         Codes->insert(OFMake_pair(StandardizedUptakeValueBodyWeight, DSRBasicCodedEntry("g/ml{SUVbw}", "UCUM", "Standardized Uptake Value body weight")));
171         Codes->insert(OFMake_pair(StandardizedUptakeValueLeanBodyMassJames, DSRBasicCodedEntry("g/ml{SUVlbm}", "UCUM", "Standardized Uptake Value lean body mass (James)")));
172         Codes->insert(OFMake_pair(StandardizedUptakeValueLeanBodyMassJames128Multiplier, DSRBasicCodedEntry("g/ml{SUVlbm(James128)}", "UCUM", "Standardized Uptake Value lean body mass (James 128 multiplier)")));
173         Codes->insert(OFMake_pair(StandardizedUptakeValueLeanBodyMassJanma, DSRBasicCodedEntry("g/ml{SUVlbm(Janma)}", "UCUM", "Standardized Uptake Value lean body mass (Janma)")));
174         Codes->insert(OFMake_pair(StandardizedUptakeValueBodySurfaceArea, DSRBasicCodedEntry("cm2/ml{SUVbsa}", "UCUM", "Standardized Uptake Value body surface area")));
175         Codes->insert(OFMake_pair(StandardizedUptakeValueIdealBodyWeight, DSRBasicCodedEntry("g/ml{SUVibw}", "UCUM", "Standardized Uptake Value ideal body weight")));
176         Codes->insert(OFMake_pair(Counts, DSRBasicCodedEntry("{counts}", "UCUM", "Counts")));
177         Codes->insert(OFMake_pair(CountsPerSecond, DSRBasicCodedEntry("{counts}/s", "UCUM", "Counts per second")));
178         Codes->insert(OFMake_pair(ProportionalToCounts, DSRBasicCodedEntry("{propcounts}", "UCUM", "Proportional to counts")));
179         Codes->insert(OFMake_pair(ProportionalToCountsPerSecond, DSRBasicCodedEntry("{propcounts}/s", "UCUM", "Proportional to counts per second")));
180         Codes->insert(OFMake_pair(SquareCentimeterPerMilliliter, DSRBasicCodedEntry("cm2/ml", "UCUM", "Centimeter**2/milliliter")));
181         Codes->insert(OFMake_pair(Percent, DSRBasicCodedEntry("%", "UCUM", "Percent")));
182         Codes->insert(OFMake_pair(BecquerelsPerMilliliter, DSRBasicCodedEntry("Bq/ml", "UCUM", "Becquerels/milliliter")));
183         Codes->insert(OFMake_pair(MilligramsPerMinutePerMilliliter, DSRBasicCodedEntry("mg/min/ml", "UCUM", "Milligrams/minute/milliliter")));
184         Codes->insert(OFMake_pair(MicromolePerMinutePerMilliliter, DSRBasicCodedEntry("umol/min/ml", "UCUM", "Micromole/minute/milliliter")));
185         Codes->insert(OFMake_pair(MilliliterPerMinutePerGram, DSRBasicCodedEntry("ml/min/g", "UCUM", "Milliliter/minute/gram")));
186         Codes->insert(OFMake_pair(MilliliterPerGram, DSRBasicCodedEntry("ml/g", "UCUM", "Milliliter/gram")));
187         Codes->insert(OFMake_pair(PerCentimeter, DSRBasicCodedEntry("/cm", "UCUM", "/Centimeter")));
188         Codes->insert(OFMake_pair(MicromolePerMilliliter, DSRBasicCodedEntry("umol/ml", "UCUM", "Micromole/milliliter")));
189         Codes->insert(OFMake_pair(Mm2PerS, DSRBasicCodedEntry("mm2/s", "UCUM", "mm2/s")));
190         Codes->insert(OFMake_pair(Um2PerMs, DSRBasicCodedEntry("um2/ms", "UCUM", "um2/ms")));
191         Codes->insert(OFMake_pair(Um2PerS, DSRBasicCodedEntry("um2/s", "UCUM", "um2/s")));
192         Codes->insert(OFMake_pair(_106mm2PerS, DSRBasicCodedEntry("10-6.mm2/s", "UCUM", "10-6.mm2/s")));
193         Codes->insert(OFMake_pair(Gy, DSRBasicCodedEntry("Gy", "UCUM", "Gy")));
194         Codes->insert(OFMake_pair(Sv, DSRBasicCodedEntry("Sv", "UCUM", "Sv")));
195         Codes->insert(OFMake_pair(NoUnits, DSRBasicCodedEntry("1", "UCUM", "no units")));
196         Codes->insert(OFMake_pair(Ratio, DSRBasicCodedEntry("{ratio}", "UCUM", "ratio")));
197         Codes->insert(OFMake_pair(HounsfieldUnit, DSRBasicCodedEntry("[hnsf'U]", "UCUM", "Hounsfield Unit")));
198         Codes->insert(OFMake_pair(ArbitraryUnit, DSRBasicCodedEntry("[arb'U]", "UCUM", "arbitrary unit")));
199         Codes->insert(OFMake_pair(Ppm, DSRBasicCodedEntry("ppm", "UCUM", "ppm")));
200         Codes->insert(OFMake_pair(CentimeterPerSecond, DSRBasicCodedEntry("cm/s", "UCUM", "centimeter/second")));
201         Codes->insert(OFMake_pair(MillimeterPerSecond, DSRBasicCodedEntry("mm/s", "UCUM", "millimeter/second")));
202         Codes->insert(OFMake_pair(Decibel, DSRBasicCodedEntry("dB", "UCUM", "decibel")));
203         Codes->insert(OFMake_pair(DegreesCelsius, DSRBasicCodedEntry("Cel", "UCUM", "degrees Celsius")));
204         Codes->insert(OFMake_pair(MilliliterPerMinute, DSRBasicCodedEntry("ml/min", "UCUM", "milliliter per minute")));
205         Codes->insert(OFMake_pair(MilliliterPerSecond, DSRBasicCodedEntry("ml/s", "UCUM", "milliliter per second")));
206         Codes->insert(OFMake_pair(Millisecond, DSRBasicCodedEntry("ms", "UCUM", "millisecond")));
207         Codes->insert(OFMake_pair(Second, DSRBasicCodedEntry("s", "UCUM", "second")));
208         Codes->insert(OFMake_pair(Hertz, DSRBasicCodedEntry("Hz", "UCUM", "Hertz")));
209         Codes->insert(OFMake_pair(MilliTesla, DSRBasicCodedEntry("mT", "UCUM", "milliTesla")));
210         Codes->insert(OFMake_pair(NumberParticlesPer100GramOfTissue, DSRBasicCodedEntry("{Particles}/[100]g{Tissue}", "UCUM", "number particles per 100 gram of tissue")));
211         Codes->insert(OFMake_pair(SecondPerSquareMillimeter, DSRBasicCodedEntry("s/mm2", "UCUM", "second per square millimeter")));
212         Codes->insert(OFMake_pair(MilliliterPer100GramPerMinute, DSRBasicCodedEntry("ml/[100]g/min", "UCUM", "milliliter per 100 gram per minute")));
213         Codes->insert(OFMake_pair(MilliliterPer100Milliliter, DSRBasicCodedEntry("ml/[100]ml", "UCUM", "milliliter per 100 milliliter")));
214         Codes->insert(OFMake_pair(MillimolesPerKgWetWeight, DSRBasicCodedEntry("mmol/kg{WetWeight}", "UCUM", "millimoles per kg wet weight")));
215         Codes->insert(OFMake_pair(PerMin, DSRBasicCodedEntry("/min", "UCUM", "/min")));
216         Codes->insert(OFMake_pair(PerS, DSRBasicCodedEntry("/s", "UCUM", "/s")));
217     }
218     /* should never be NULL */
219     return *Codes;
220 }
221 
222 
setEnhancedEncodingMode(DSRCodedEntryValue & codedEntryValue)223 OFCondition CID7181_AbstractMultiDimensionalImageModelComponentUnits::setEnhancedEncodingMode(DSRCodedEntryValue &codedEntryValue)
224 {
225     return codedEntryValue.setEnhancedEncodingMode(CONTEXT_GROUP_NUMBER, "DCMR", CONTEXT_GROUP_VERSION, CONTEXT_GROUP_UID);
226 }
227