DCMTK
Version 3.6.1 20120515
OFFIS DICOM Toolkit
|
Class for numeric measurement values. More...
Public Member Functions | |
DSRNumericMeasurementValue () | |
default constructor | |
DSRNumericMeasurementValue (const OFString &numericValue, const DSRCodedEntryValue &measurementUnit) | |
constructor. | |
DSRNumericMeasurementValue (const OFString &numericValue, const DSRCodedEntryValue &measurementUnit, const DSRCodedEntryValue &valueQualifier) | |
constructor. | |
DSRNumericMeasurementValue (const DSRNumericMeasurementValue &numericMeasurement) | |
copy constructor | |
virtual | ~DSRNumericMeasurementValue () |
destructor | |
DSRNumericMeasurementValue & | operator= (const DSRNumericMeasurementValue &numericMeasurement) |
assignment operator | |
virtual void | clear () |
clear all internal variables. | |
virtual OFBool | isValid () const |
check whether the current numeric measurement value is valid. | |
virtual OFBool | isEmpty () const |
check whether the current numeric measurement value is empty. | |
virtual OFCondition | print (STD_NAMESPACE ostream &stream, const size_t flags) const |
print numeric measurement value. | |
virtual OFCondition | readXML (const DSRXMLDocument &doc, DSRXMLCursor cursor) |
read numeric measurement value from XML document | |
virtual OFCondition | writeXML (STD_NAMESPACE ostream &stream, const size_t flags) const |
write numeric measurement value in XML format | |
virtual OFCondition | readSequence (DcmItem &dataset) |
read measured value sequence and numeric value qualifier code sequence from dataset. | |
virtual OFCondition | writeSequence (DcmItem &dataset) const |
write measured value sequence and numeric value qualifier code sequence to dataset. | |
virtual OFCondition | renderHTML (STD_NAMESPACE ostream &docStream, STD_NAMESPACE ostream &annexStream, size_t &annexNumber, const size_t flags) const |
render numeric measurement value in HTML/XHTML format | |
const DSRNumericMeasurementValue & | getValue () const |
get reference to numeric measurement value | |
OFCondition | getValue (DSRNumericMeasurementValue &numericMeasurement) const |
get copy of numeric measurement value | |
const OFString & | getNumericValue () const |
get numeric value | |
const DSRCodedEntryValue & | getMeasurementUnit () const |
get measurement unit | |
const DSRCodedEntryValue & | getNumericValueQualifier () const |
get numeric value qualifier (optional) | |
OFCondition | getMeasurementUnit (DSRCodedEntryValue &measurementUnit) const |
get copy of measurement unit | |
OFCondition | getFloatingPointRepresentation (Float64 &floatingPoint) const |
get floating point representation of the numeric value (optional) | |
OFCondition | getRationalRepresentation (Sint32 &rationalNumerator, Uint32 &rationalDenominator) const |
get rational representation of the numeric value (optional) | |
OFCondition | setValue (const DSRNumericMeasurementValue &numericMeasurement) |
set numeric measurement value. | |
OFCondition | setValue (const OFString &numericValue, const DSRCodedEntryValue &measurementUnit) |
set numeric value and measurement unit. | |
OFCondition | setValue (const OFString &numericValue, const DSRCodedEntryValue &measurementUnit, const DSRCodedEntryValue &valueQualifier) |
set numeric value, measurement unit and numeric value qualifier. | |
OFCondition | setNumericValue (const OFString &numericValue) |
set numeric value. | |
OFCondition | setMeasurementUnit (const DSRCodedEntryValue &measurementUnit) |
set measurement unit. | |
OFCondition | setNumericValueQualifier (const DSRCodedEntryValue &valueQualifier) |
set numeric value qualifier. | |
OFCondition | setFloatingPointRepresentation (const Float64 floatingPoint) |
set floating point representation of the numeric value. | |
OFCondition | setRationalRepresentation (const Sint32 rationalNumerator, const Uint32 rationalDenominator) |
set rational representation of the numeric value. | |
Protected Member Functions | |
DSRNumericMeasurementValue * | getValuePtr () |
get pointer to numeric measurement value | |
virtual OFCondition | readItem (DcmItem &dataset) |
read numeric measurement value from dataset | |
virtual OFCondition | writeItem (DcmItem &dataset) const |
write numeric measurement value to dataset | |
virtual OFBool | checkNumericValue (const OFString &numericValue) const |
check the specified numeric value for validity. | |
virtual OFBool | checkMeasurementUnit (const DSRCodedEntryValue &measurementUnit) const |
check the specified measurement unit for validity. | |
virtual OFBool | checkNumericValueQualifier (const DSRCodedEntryValue &valueQualifier) const |
check the specified numeric value qualifier for validity. | |
virtual OFBool | checkRationalRepresentation (const Sint32 rationalNumerator, const Uint32 rationalDenominator) const |
check the specified rational representation for validity. | |
Private Attributes | |
OFString | NumericValue |
Numeric Value (VR=DS, type 1) | |
DSRCodedEntryValue | MeasurementUnit |
Measurement Unit (type 2) | |
DSRCodedEntryValue | ValueQualifier |
Numeric Value Qualifier (type 3) | |
DcmFloatingPointDouble | FloatingPointValue |
Floating Point Value (VR=FD, type 1C) | |
DcmSignedLong | RationalNumeratorValue |
Rational Numerator Value (VR=SL, type 1C) | |
DcmUnsignedLong | RationalDenominatorValue |
Rational Denominator Value (VR=UL, type 1C) | |
Friends | |
class | DSRContentItem |
Class for numeric measurement values.
DSRNumericMeasurementValue::DSRNumericMeasurementValue | ( | const OFString & | numericValue, |
const DSRCodedEntryValue & | measurementUnit | ||
) |
constructor.
The code triple is only set if it passed the validity check (see setValue()).
numericValue | numeric measurement value. (VR=DS, type 1) |
measurementUnit | code representing the measurement name (code meaning) and unit (code value). (type 2) |
DSRNumericMeasurementValue::DSRNumericMeasurementValue | ( | const OFString & | numericValue, |
const DSRCodedEntryValue & | measurementUnit, | ||
const DSRCodedEntryValue & | valueQualifier | ||
) |
constructor.
The two codes are only set if they passed the validity check (see setValue()).
numericValue | numeric measurement value. (VR=DS, type 1) |
measurementUnit | code representing the measurement name (code meaning) and unit (code value). (type 2) |
valueQualifier | code representing the numeric value qualifier. (type 3) |
DSRNumericMeasurementValue::DSRNumericMeasurementValue | ( | const DSRNumericMeasurementValue & | numericMeasurement | ) |
copy constructor
numericMeasurement | numeric measurement value to be copied (not checked !) |
virtual OFBool DSRNumericMeasurementValue::checkMeasurementUnit | ( | const DSRCodedEntryValue & | measurementUnit | ) | const [protected, virtual] |
check the specified measurement unit for validity.
The isValid() method in class DSRCodedEntryValue is used for this purpose.
measurementUnit | measurement unit to be checked |
virtual OFBool DSRNumericMeasurementValue::checkNumericValue | ( | const OFString & | numericValue | ) | const [protected, virtual] |
check the specified numeric value for validity.
Currently the only check that is performed is that the string is not empty. Later on it might be checked whether the format conforms to the definition of DS.
numericValue | numeric value to be checked |
virtual OFBool DSRNumericMeasurementValue::checkNumericValueQualifier | ( | const DSRCodedEntryValue & | valueQualifier | ) | const [protected, virtual] |
check the specified numeric value qualifier for validity.
The isEmpty() and isValid() methods in class DSRCodedEntryValue are used for this purpose. The conformance with the Context Group 42 (as defined in the DICOM standard) is not yet checked.
valueQualifier | numeric value qualifier to be checked |
virtual OFBool DSRNumericMeasurementValue::checkRationalRepresentation | ( | const Sint32 | rationalNumerator, |
const Uint32 | rationalDenominator | ||
) | const [protected, virtual] |
check the specified rational representation for validity.
The only check that is performed is that the 'rationalDenominator' is not zero.
rationalNumerator | numerator of the rational representation to be checked |
rationalDenominator | denominator of a rational representation to be checked |
virtual void DSRNumericMeasurementValue::clear | ( | ) | [virtual] |
clear all internal variables.
Use this method to create an empty numeric measurement value.
Reimplemented in DSRNumTreeNode.
OFCondition DSRNumericMeasurementValue::getFloatingPointRepresentation | ( | Float64 & | floatingPoint | ) | const |
get floating point representation of the numeric value (optional)
floatingPoint | reference to variable in which the floating point representation should be stored |
const DSRCodedEntryValue& DSRNumericMeasurementValue::getMeasurementUnit | ( | ) | const [inline] |
get measurement unit
OFCondition DSRNumericMeasurementValue::getMeasurementUnit | ( | DSRCodedEntryValue & | measurementUnit | ) | const |
get copy of measurement unit
measurementUnit | reference to variable in which the code should be stored |
const OFString& DSRNumericMeasurementValue::getNumericValue | ( | ) | const [inline] |
get numeric value
const DSRCodedEntryValue& DSRNumericMeasurementValue::getNumericValueQualifier | ( | ) | const [inline] |
get numeric value qualifier (optional)
OFCondition DSRNumericMeasurementValue::getRationalRepresentation | ( | Sint32 & | rationalNumerator, |
Uint32 & | rationalDenominator | ||
) | const |
get rational representation of the numeric value (optional)
rationalNumerator | reference to variable in which the integer numerator of the rational representation should be stored |
rationalDenominator | reference to variable in which the integer denominator of the rational representation should be stored |
const DSRNumericMeasurementValue& DSRNumericMeasurementValue::getValue | ( | ) | const [inline] |
get reference to numeric measurement value
OFCondition DSRNumericMeasurementValue::getValue | ( | DSRNumericMeasurementValue & | numericMeasurement | ) | const |
get copy of numeric measurement value
numericMeasurement | reference to variable in which the value should be stored |
DSRNumericMeasurementValue* DSRNumericMeasurementValue::getValuePtr | ( | ) | [inline, protected] |
get pointer to numeric measurement value
virtual OFBool DSRNumericMeasurementValue::isEmpty | ( | ) | const [virtual] |
check whether the current numeric measurement value is empty.
Checks whether both the numeric value and the measurement unit are empty.
virtual OFBool DSRNumericMeasurementValue::isValid | ( | ) | const [virtual] |
check whether the current numeric measurement value is valid.
The value is valid if isEmpty() is true or all three values (numeric value, measurement unit and value qualifier) do contain valid values (see checkXXX() methods). The possibly available additional representations of the numeric value are never checked.
Reimplemented in DSRNumTreeNode.
DSRNumericMeasurementValue& DSRNumericMeasurementValue::operator= | ( | const DSRNumericMeasurementValue & | numericMeasurement | ) |
assignment operator
numericMeasurement | numeric measurement value to be copied (not checked !) |
virtual OFCondition DSRNumericMeasurementValue::print | ( | STD_NAMESPACE ostream & | stream, |
const size_t | flags | ||
) | const [virtual] |
print numeric measurement value.
The output of a typical numeric measurement value looks like this: "3" (cm,99_OFFIS_DCMTK,"Length Unit"). If the value is empty the text "empty" is printed instead. The numeric value qualifier and the possibly available additional representations of the numeric value are never printed.
stream | output stream to which the numeric measurement value should be printed |
flags | flag used to customize the output (not used) |
Reimplemented in DSRNumTreeNode.
virtual OFCondition DSRNumericMeasurementValue::readItem | ( | DcmItem & | dataset | ) | [protected, virtual] |
read numeric measurement value from dataset
dataset | DICOM dataset from which the value should be read |
virtual OFCondition DSRNumericMeasurementValue::readSequence | ( | DcmItem & | dataset | ) | [virtual] |
read measured value sequence and numeric value qualifier code sequence from dataset.
The number of items within the sequences is checked. If error/warning output are enabled a warning message is printed if a sequence is absent or contains more than one item.
dataset | DICOM dataset from which the sequences should be read |
virtual OFCondition DSRNumericMeasurementValue::readXML | ( | const DSRXMLDocument & | doc, |
DSRXMLCursor | cursor | ||
) | [virtual] |
read numeric measurement value from XML document
doc | document containing the XML file content |
cursor | cursor pointing to the starting node |
virtual OFCondition DSRNumericMeasurementValue::renderHTML | ( | STD_NAMESPACE ostream & | docStream, |
STD_NAMESPACE ostream & | annexStream, | ||
size_t & | annexNumber, | ||
const size_t | flags | ||
) | const [virtual] |
render numeric measurement value in HTML/XHTML format
docStream | output stream to which the main HTML/XHTML document is written |
annexStream | output stream to which the HTML/XHTML document annex is written |
annexNumber | reference to the variable where the current annex number is stored. Value is increased automatically by 1 after a new entry has been added. |
flags | flag used to customize the output (see DSRTypes::HF_xxx) |
OFCondition DSRNumericMeasurementValue::setFloatingPointRepresentation | ( | const Float64 | floatingPoint | ) |
set floating point representation of the numeric value.
According to the DICOM standard, this value is "required if the numeric value has insufficient precision to represent the value as a string. May be present otherwise." Please note that it is not checked whether this representation is consistent with the numeric value stored as a string.
floatingPoint | floating point representation of the numeric value |
OFCondition DSRNumericMeasurementValue::setMeasurementUnit | ( | const DSRCodedEntryValue & | measurementUnit | ) |
set measurement unit.
Before setting the code, it is checked (see checkMeasurementUnit()). If the code is invalid the current code is not replaced and remains unchanged.
measurementUnit | measurement unit to be set |
OFCondition DSRNumericMeasurementValue::setNumericValue | ( | const OFString & | numericValue | ) |
set numeric value.
Before setting the value, it is checked (see checkNumericValue()). If the value is invalid the current value is not replaced and remains unchanged. If the value is replaced, the optional floating point and rational representations are cleared, i.e. they have to be set manually if needed.
numericValue | numeric value to be set (VR=DS) |
OFCondition DSRNumericMeasurementValue::setNumericValueQualifier | ( | const DSRCodedEntryValue & | valueQualifier | ) |
set numeric value qualifier.
This optional code specifies the qualification of the Numeric Value in the Measured Value Sequence, or the reason for the absence of the Measured Value Sequence Item. Before setting the code, it is checked (see checkNumericValueQualifier()). If the code is invalid the current code is not replaced and remains unchanged.
valueQualifier | numeric value qualifier to be set |
OFCondition DSRNumericMeasurementValue::setRationalRepresentation | ( | const Sint32 | rationalNumerator, |
const Uint32 | rationalDenominator | ||
) |
set rational representation of the numeric value.
According to the DICOM standard, this value is "required if the numeric value has insufficient precision to represent a rational value as a string. May be present otherwise." Please note that it is not checked whether this representation is consistent with the numeric value stored as a string.
rationalNumerator | integer numerator of a rational representation of the numeric value (encoded as a signed integer value) |
rationalDenominator | integer denominator of a rational representation of the numeric value (encoded as a non-zero unsigned integer value) |
OFCondition DSRNumericMeasurementValue::setValue | ( | const DSRNumericMeasurementValue & | numericMeasurement | ) |
set numeric measurement value.
Before setting the value, it is checked (see checkXXX()). If the value is invalid the current value is not replaced and remains unchanged.
numericMeasurement | value to be set |
OFCondition DSRNumericMeasurementValue::setValue | ( | const OFString & | numericValue, |
const DSRCodedEntryValue & | measurementUnit | ||
) |
set numeric value and measurement unit.
Before setting the values, they are checked (see checkXXX()). If the value pair is invalid the current value pair is not replaced and remains unchanged. If the value pair is replaced, the optional floating point and rational representations are cleared, i.e. they have to be set manually if needed.
numericValue | numeric value to be set |
measurementUnit | measurement unit to be set |
OFCondition DSRNumericMeasurementValue::setValue | ( | const OFString & | numericValue, |
const DSRCodedEntryValue & | measurementUnit, | ||
const DSRCodedEntryValue & | valueQualifier | ||
) |
set numeric value, measurement unit and numeric value qualifier.
Before setting the values, they are checked (see checkXXX()). If one of the three values is invalid the current numeric measurement value is not replaced and remains unchanged. If the values are replaced, the optional floating point and rational representations are cleared, i.e. they have to be set manually if needed.
numericValue | numeric value to be set |
measurementUnit | measurement unit to be set |
valueQualifier | numeric value qualifier to be set |
virtual OFCondition DSRNumericMeasurementValue::writeItem | ( | DcmItem & | dataset | ) | const [protected, virtual] |
write numeric measurement value to dataset
dataset | DICOM dataset to which the value should be written |
virtual OFCondition DSRNumericMeasurementValue::writeSequence | ( | DcmItem & | dataset | ) | const [virtual] |
write measured value sequence and numeric value qualifier code sequence to dataset.
The measured value sequence is always written (might be empty, though). The numeric value qualifier code sequence is optional and, therefore, only written if non-empty.
dataset | DICOM dataset to which the sequences should be written |
virtual OFCondition DSRNumericMeasurementValue::writeXML | ( | STD_NAMESPACE ostream & | stream, |
const size_t | flags | ||
) | const [virtual] |
write numeric measurement value in XML format
stream | output stream to which the XML document is written |
flags | flag used to customize the output (see DSRTypes::XF_xxx) |
Reimplemented in DSRNumTreeNode.