File: dpmtypes.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 (111 lines) | stat: -rw-r--r-- 2,672 bytes parent folder | download | duplicates (5)
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
/*
 *
 *  Copyright (C) 2016, 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:  dcmpmap
 *
 *  Author:  Michael Onken
 *
 *  Purpose: Class for managing common paramatric map specific types.
 *
 */

#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dcerror.h"
#include "dcmtk/dcmpmap/dpmtypes.h"

OFLogger DCM_dcmpmapLogger = OFLog::getLogger("dcmtk.dcmpmap");

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

// conditions
makeOFConditionConst(DPM_InvalidDimensions,      OFM_dcmpmap, 1, OF_error, "Invalid Dimensions");
makeOFConditionConst(DPM_InvalidAttributeValue,  OFM_dcmpmap, 2, OF_error, "Invalid Attribute Value");
makeOFConditionConst(DPM_InvalidPixelInfo,       OFM_dcmpmap, 3, OF_error, "Invalid information in pixel data or related attributes");
makeOFConditionConst(DPM_InvalidPixelData,       OFM_dcmpmap, 4, OF_error, "Invalid pixel data");
makeOFConditionConst(DPM_NoPixelData,            OFM_dcmpmap, 5, OF_error, "No pixel data found");
makeOFConditionConst(DPM_InvalidSOPClass,        OFM_dcmpmap, 6, OF_error, "SOP Class not supported");

OFString DPMTypes::rvf2Str(const RecognizableVisibleFeatures rvf)
{
  switch (rvf)
  {
    case RVF_NO: return "NO";
    case RVF_YES: return "YES";
    default: return "";
  }
}

DPMTypes::RecognizableVisibleFeatures DPMTypes::str2Rvf(const OFString& rvf)
{
  if (rvf == "NO")
    return RVF_NO;
  if (rvf == "YES")
    return RVF_YES;
  else
    return RVF_UNKNOWN;
}


OFString DPMTypes::cq2Str(const DPMTypes::ContentQualification cq)
{
   switch (cq)
  {
    case CQ_PRODUCT:  return "PRODUCT";
    case CQ_RESEARCH: return "RESEARCH";
    case CQ_SERVICE:  return "SERVICE";
    case CQ_UNKNOWN:  return "";
  }
  return "";
}


DPMTypes::ContentQualification DPMTypes::str2Cq(const OFString& cq)
{
  if (cq == "PRODUCT")
    return CQ_PRODUCT;
  if (cq == "RESEARCH")
    return CQ_RESEARCH;
  if (cq == "SERVICE")
    return CQ_SERVICE;
  else
    return CQ_UNKNOWN;
}



OFBool DPMTypes::cqValid(const DPMTypes::ContentQualification cq)
{
   switch (cq)
  {
    case CQ_PRODUCT:
    case CQ_RESEARCH:
    case CQ_SERVICE:  return OFTrue;
    case CQ_UNKNOWN:  return OFFalse;
  }
  return OFFalse;
}


OFBool DPMTypes::rvfValid(const DPMTypes::RecognizableVisibleFeatures rvf)
{
  switch (rvf)
  {
    case RVF_NO: return OFTrue;
    case RVF_YES: return OFTrue;
    case RVF_UNKNOWN: return OFFalse;
  }
  return OFFalse;
}