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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
/*
*
* Copyright (C) 2016-2019, 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: dcmfg
*
* Author: Jan Schlamelcher
*
* Purpose: Class for managing the Parametric Map Frame Type
*
*/
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dcdeftag.h"
#include "dcmtk/dcmfg/fgparametricmapframetype.h"
#include "dcmtk/dcmiod/iodutil.h"
FGParametricMapFrameType::FGParametricMapFrameType()
: FGBase(DcmFGTypes::EFG_PARAMETRICMAPFRAMETYPE)
, m_FrameType(DCM_FrameType)
{
}
FGParametricMapFrameType::~FGParametricMapFrameType()
{
}
void FGParametricMapFrameType::clearData()
{
m_FrameType.clear();
}
FGBase* FGParametricMapFrameType::clone() const
{
if (FGParametricMapFrameType* copy = new FGParametricMapFrameType)
{
copy->m_FrameType = m_FrameType;
return copy;
}
return OFnullptr;
}
OFCondition FGParametricMapFrameType::read(DcmItem& item)
{
clearData();
DcmItem* seqItem;
OFCondition result;
seqItem = OFnullptr;
result = getItemFromFGSequence(item, DCM_ParametricMapFrameTypeSequence, 0, seqItem);
if (result.bad())
return result;
DcmIODUtil::getAndCheckElementFromDataset(*seqItem, m_FrameType, "4", "1", "Parametric Map Frame Type");
return EC_Normal;
}
OFCondition FGParametricMapFrameType::write(DcmItem& item)
{
OFCondition result = check();
if (result.good())
{
DcmItem* seqItem;
seqItem = OFnullptr;
result = createNewFGSequence(item, DCM_ParametricMapFrameTypeSequence, 0, seqItem);
if (result.good())
{
DcmIODUtil::copyElementToDataset(result, *seqItem, m_FrameType, "4", "1", "Parametric Map Frame Type");
}
}
return result;
}
int FGParametricMapFrameType::compare(const FGBase& rhs) const
{
int result = FGBase::compare(rhs);
if (result == 0)
{
const FGParametricMapFrameType* myRhs = OFstatic_cast(const FGParametricMapFrameType*, &rhs);
if (!myRhs)
return -1;
// Compare all elements
result = m_FrameType.compare(myRhs->m_FrameType);
}
return result;
}
OFCondition FGParametricMapFrameType::check() const
{
DcmCodeString myFrameType = m_FrameType;
OFCondition result = myFrameType.checkValue("4");
if (result.good())
{
OFString val;
myFrameType.getOFString(val, 0);
if (val == "DERIVED")
{
val.clear();
myFrameType.getOFString(val, 1);
if (val == "PRIMARY")
{
val.clear();
myFrameType.getOFString(val, 1);
return EC_Normal;
}
else
DCMFG_ERROR("Frame Type' 2nd value must be \"PRIMARY\" but is \"" << val << "\"");
}
else
DCMFG_ERROR("Frame Type 1st value must be \"DERIVED\" but is \"" << val << "\"");
}
return FG_EC_InvalidData;
}
OFCondition FGParametricMapFrameType::getFrameType(OFString& value, const signed long pos) const
{
return DcmIODUtil::getStringValueFromElement(m_FrameType, value, pos);
}
OFCondition FGParametricMapFrameType::setFrameType(const OFString& value, const OFBool checkValue)
{
OFCondition result = (checkValue) ? DcmCodeString::checkStringValue(value, "4") : EC_Normal;
if (result.good())
result = m_FrameType.putString(value.c_str());
return result;
}
|