00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
#ifndef DCDICENT_H
00035
#define DCDICENT_H
00036
00037
#include "osconfig.h"
00038
#include "dctagkey.h"
00039
#include "dcvr.h"
00040
00041
#define INCLUDE_CSTRING
00042
#include "ofstdinc.h"
00043
00045
#define DcmVariableVM -1
00046
00047
#define DCM_INRANGE(x,a,b) (((x) >= (a)) && ((x) <= (b)))
00048
#define DCM_IS_ODD(x) (((x) % 2) == 1)
00049
#define DCM_IS_EVEN(x) (((x) % 2) == 0)
00050
00051
00054
enum DcmDictRangeRestriction
00055 {
00057 DcmDictRange_Unspecified,
00058
00060 DcmDictRange_Odd,
00061
00063 DcmDictRange_Even
00064 };
00065
00066
00070 class DcmDictEntry:
public DcmTagKey
00071 {
00072
public:
00073
00085
DcmDictEntry(Uint16 g, Uint16 e,
DcmVR vr,
00086
const char* nam,
int vmMin,
int vmMax,
00087
const char* vers, OFBool doCopyStrings,
00088
const char* pcreator);
00089
00103
DcmDictEntry(Uint16 g, Uint16 e, Uint16 ug, Uint16 ue,
DcmVR vr,
00104
const char* nam,
int vmMin,
int vmMax,
00105
const char* vers, OFBool doCopyStrings,
00106
const char* pcreator);
00107
00109
DcmDictEntry(
const DcmDictEntry& e);
00110
00112
~DcmDictEntry();
00113
00114
00115
00117 DcmVR getVR()
const
00118
{
00119
return valueRepresentation;
00120 }
00121
00123 DcmEVR
getEVR()
const
00124
{
00125
return valueRepresentation.
getEVR();
00126 }
00127
00129 const char*
getStandardVersion()
const
00130
{
00131
return standardVersion;
00132 }
00133
00135 const char*
getTagName()
const
00136
{
00137
return tagName;
00138 }
00139
00141 const char*
getPrivateCreator()
const
00142
{
00143
return privateCreator;
00144 }
00145
00150 int privateCreatorMatch(
const char *c)
const
00151
{
00152
return
00153 (
00154 ((
privateCreator == NULL) && (c == NULL)) ||
00155 (
privateCreator && c && (0 == strcmp(
privateCreator, c)))
00156 );
00157 }
00158
00164 int privateCreatorMatch(
const DcmDictEntry& arg)
const
00165
{
00166
return privateCreatorMatch(arg.
privateCreator);
00167 }
00168
00170 int getVMMin()
const
00171
{
00172
return valueMultiplicityMin;
00173 }
00174
00176 int getVMMax()
const
00177
{
00178
return valueMultiplicityMax;
00179 }
00180
00182 OFBool
isFixedSingleVM()
const
00183
{
00184
return ((
valueMultiplicityMin != DcmVariableVM) &&
00185 (
valueMultiplicityMin ==
valueMultiplicityMax));
00186 }
00187
00189 OFBool
isFixedRangeVM()
const
00190
{
00191
return ((
valueMultiplicityMin != DcmVariableVM) &&
00192 (
valueMultiplicityMax != DcmVariableVM));
00193 }
00194
00196 OFBool
isVariableRangeVM()
const
00197
{
00198
return ((
valueMultiplicityMin != DcmVariableVM) &&
00199 (
valueMultiplicityMax == DcmVariableVM));
00200 }
00201
00206 void setUpper(
const DcmTagKey& key)
00207 {
00208
upperKey = key;
00209 }
00210
00215 void setUpperGroup(Uint16 ug)
00216 {
00217
upperKey.setGroup(ug);
00218 }
00219
00224 void setUpperElement(Uint16 ue)
00225 {
00226
upperKey.setElement(ue);
00227 }
00228
00230 Uint16
getUpperGroup()
const
00231
{
00232
return upperKey.getGroup();
00233 }
00234
00236 Uint16
getUpperElement()
const
00237
{
00238
return upperKey.getElement();
00239 }
00240
00242 DcmTagKey
getKey()
const
00243
{
00244
return * OFstatic_cast(
const DcmTagKey *,
this);
00245 }
00246
00248 DcmTagKey
getUpperKey()
const
00249
{
00250
return upperKey;
00251 }
00252
00254 int isRepeatingGroup()
const
00255
{
00256
return (getGroup() !=
getUpperGroup());
00257 }
00258
00260 int isRepeatingElement()
const
00261
{
00262
return (getElement() !=
getUpperElement());
00263 }
00264
00266 int isRepeating()
const
00267
{
00268
return (
isRepeatingGroup() ||
isRepeatingElement());
00269 }
00270
00272 DcmDictRangeRestriction
getGroupRangeRestriction()
const
00273
{
00274
return groupRangeRestriction;
00275 }
00276
00278 void setGroupRangeRestriction(DcmDictRangeRestriction rr)
00279 {
00280
groupRangeRestriction = rr;
00281 }
00282
00284 DcmDictRangeRestriction
getElementRangeRestriction()
const
00285
{
00286
return elementRangeRestriction;
00287 }
00288
00290 void setElementRangeRestriction(DcmDictRangeRestriction rr)
00291 {
00292
elementRangeRestriction = rr;
00293 }
00294
00295
00296
00303 int contains(
const DcmTagKey& key,
const char *privCreator)
const
00304 {
00305
if ((
getGroupRangeRestriction() == DcmDictRange_Even) &&
00306 DCM_IS_ODD(key.getGroup()))
00307
return OFFalse;
00308
else if ((
getGroupRangeRestriction() == DcmDictRange_Odd) &&
00309 DCM_IS_EVEN(key.getGroup()))
00310
return OFFalse;
00311
else if ((
getElementRangeRestriction() == DcmDictRange_Even) &&
00312 DCM_IS_ODD(key.getElement()))
00313
return OFFalse;
00314
else if ((
getElementRangeRestriction() == DcmDictRange_Odd) &&
00315 DCM_IS_EVEN(key.getElement()))
00316
return OFFalse;
00317
else if (!
privateCreatorMatch(privCreator))
00318
return OFFalse;
00319
else
00320 {
00321
return
00322 DCM_INRANGE(key.getGroup(), getGroup(),
getUpperGroup()) &&
00323 DCM_INRANGE(key.getElement(), getElement(),
getUpperElement());
00324 }
00325 }
00326
00331 int contains(
const char *name)
const
00332 {
00333
return !strcmp(
tagName, name );
00334 }
00335
00336
00337
00343 int subset(
const DcmDictEntry& e)
const
00344 {
00345
return ( (getGroup() >= e.getGroup()) &&
00346 (
getUpperGroup() <= e.
getUpperGroup()) &&
00347 (getElement() >= e.getElement()) &&
00348 (
getUpperElement() <= e.
getUpperElement()) &&
00349
privateCreatorMatch(e.
privateCreator)
00350 );
00351 }
00352
00357 int setEQ(
const DcmDictEntry& e)
const
00358 {
00359
return ( (getGroup() == e.getGroup()) &&
00360 (
getUpperGroup() == e.
getUpperGroup()) &&
00361 (getElement() == e.getElement()) &&
00362 (
getUpperElement() == e.
getUpperElement()) &&
00363 (
getGroupRangeRestriction() == e.
getGroupRangeRestriction()) &&
00364 (
getElementRangeRestriction() == e.
getElementRangeRestriction()) &&
00365
privateCreatorMatch(e.
privateCreator)
00366 );
00367 }
00368
00370
friend ostream&
operator<<(ostream& s,
const DcmDictEntry& e);
00371
00372
private:
00373
00375
DcmDictEntry &
operator=(
const DcmDictEntry &);
00376
00380 DcmTagKey
upperKey;
00381
00383 DcmVR valueRepresentation;
00384
00386 const char *
tagName;
00387
00389 int valueMultiplicityMin;
00390
00392 int valueMultiplicityMax;
00393
00395 const char *
standardVersion;
00396
00398 OFBool
stringsAreCopies;
00399
00401 DcmDictRangeRestriction
groupRangeRestriction;
00402
00404 DcmDictRangeRestriction
elementRangeRestriction;
00405
00407 const char *
privateCreator;
00408 };
00409
00410
#endif
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479