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
|
/*
*
* Copyright (C) 2016-2024, 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: dcmiod
*
* Author: Michael Onken
*
* Purpose: Base class for Image Pixel Module and related (e.g. Floating Point)
*
*/
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmiod/modimagepixelbase.h"
#include "dcmtk/dcmdata/dcdeftag.h"
#include "dcmtk/dcmdata/dcvris.h"
#include "dcmtk/dcmiod/iodutil.h"
const OFString IODImagePixelBase::m_ModuleName = "ImagePixelBase";
IODImagePixelBase::IODImagePixelBase(OFshared_ptr<DcmItem> item, OFshared_ptr<IODRules> rules)
: IODModule(item, rules)
{
// reset element rules
resetRules();
}
OFString IODImagePixelBase::getName() const
{
return m_ModuleName;
}
IODImagePixelBase::IODImagePixelBase()
: IODModule()
{
resetRules();
}
IODImagePixelBase::~IODImagePixelBase()
{
}
void IODImagePixelBase::resetRules()
{
// all rules in sub classes
}
OFCondition IODImagePixelBase::getSamplesPerPixel(Uint16& value, const unsigned long pos)
{
return m_Item->findAndGetUint16(DCM_SamplesPerPixel, value, pos);
}
OFCondition IODImagePixelBase::getPhotometricInterpretation(OFString& value, const signed long pos)
{
return DcmIODUtil::getStringValueFromItem(DCM_PhotometricInterpretation, *m_Item, value, pos);
}
OFCondition IODImagePixelBase::getRows(Uint16& value, const unsigned long pos)
{
return m_Item->findAndGetUint16(DCM_Rows, value, pos);
}
OFCondition IODImagePixelBase::getColumns(Uint16& value, const unsigned long pos)
{
return m_Item->findAndGetUint16(DCM_Columns, value, pos);
}
OFCondition IODImagePixelBase::getBitsAllocated(Uint16& value, const unsigned long pos)
{
return m_Item->findAndGetUint16(DCM_BitsAllocated, value, pos);
}
OFCondition IODImagePixelBase::getPixelAspectRatio(Uint16& value, const unsigned long pos)
{
return m_Item->findAndGetUint16(DCM_PixelAspectRatio, value, pos);
}
OFCondition IODImagePixelBase::setRows(const Uint16 value, const OFBool checkValue)
{
(void)checkValue;
return m_Item->putAndInsertUint16(DCM_Rows, value);
}
OFCondition IODImagePixelBase::setColumns(const Uint16 value, const OFBool checkValue)
{
(void)checkValue;
return m_Item->putAndInsertUint16(DCM_Columns, value);
}
OFCondition IODImagePixelBase::setPixelAspectRatio(const OFString& verticalPixelSize,
const OFString& horizontalPixelSize,
const OFBool checkValue)
{
OFString concat = verticalPixelSize;
concat += "\\";
concat += horizontalPixelSize;
OFCondition cond;
if (checkValue)
{
cond = DcmIntegerString::checkStringValue(concat, "2");
// check for unsignedness, too?
}
if (cond.good())
m_Item->putAndInsertOFStringArray(DCM_PixelAspectRatio, concat);
return cond;
}
|