DCMTK Version 3.6.8
OFFIS DICOM Toolkit
|
Class for numeric values and measurements. More...
Public Member Functions | |
DSRNumericMeasurementValue () | |
default constructor | |
DSRNumericMeasurementValue (const OFString &numericValue, const DSRCodedEntryValue &measurementUnit, const OFBool check=OFTrue) | |
constructor More... | |
DSRNumericMeasurementValue (const DSRCodedEntryValue &valueQualifier, const OFBool check=OFTrue) | |
constructor More... | |
DSRNumericMeasurementValue (const OFString &numericValue, const DSRCodedEntryValue &measurementUnit, const DSRCodedEntryValue &valueQualifier, const OFBool check=OFTrue) | |
constructor More... | |
DSRNumericMeasurementValue (const DSRNumericMeasurementValue &numericMeasurement) | |
copy constructor More... | |
virtual | ~DSRNumericMeasurementValue () |
destructor | |
DSRNumericMeasurementValue & | operator= (const DSRNumericMeasurementValue &numericMeasurement) |
assignment operator More... | |
OFBool | operator== (const DSRNumericMeasurementValue &numericMeasurement) const |
comparison operator "equal". More... | |
OFBool | operator!= (const DSRNumericMeasurementValue &numericMeasurement) const |
comparison operator "not equal". More... | |
virtual void | clear () |
clear all internal variables. More... | |
virtual OFBool | isValid () const |
check whether the current numeric measurement value is valid. More... | |
virtual OFBool | isEmpty () const |
check whether the current numeric measurement value is empty. More... | |
virtual OFBool | isComplete () const |
check whether the current numeric measurement value is complete, i.e. whether the numeric value is non-empty and the measurement unit is complete, or whether the value qualifier is complete. More... | |
virtual OFCondition | print (STD_NAMESPACE ostream &stream, const size_t flags) const |
print numeric measurement value. More... | |
virtual OFCondition | readXML (const DSRXMLDocument &doc, DSRXMLCursor cursor, const size_t flags) |
read numeric measurement value from XML document More... | |
virtual OFCondition | writeXML (STD_NAMESPACE ostream &stream, const size_t flags) const |
write numeric measurement value in XML format More... | |
virtual OFCondition | readSequence (DcmItem &dataset, const size_t flags) |
read measured value sequence and numeric value qualifier code sequence from dataset. More... | |
virtual OFCondition | writeSequence (DcmItem &dataset) const |
write measured value sequence and numeric value qualifier code sequence to dataset. More... | |
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 More... | |
const DSRNumericMeasurementValue & | getValue () const |
get reference to numeric measurement value More... | |
OFCondition | getValue (DSRNumericMeasurementValue &numericMeasurement) const |
get copy of numeric measurement value More... | |
const OFString & | getNumericValue () const |
get numeric value More... | |
const DSRCodedEntryValue & | getMeasurementUnit () const |
get measurement unit More... | |
const DSRCodedEntryValue & | getNumericValueQualifier () const |
get numeric value qualifier (conditional) More... | |
OFCondition | getMeasurementUnit (DSRCodedEntryValue &measurementUnit) const |
get copy of measurement unit More... | |
OFCondition | getNumericValueQualifier (DSRCodedEntryValue &valueQualifier) const |
get copy of numeric value qualifier (conditional) More... | |
OFCondition | getFloatingPointRepresentation (Float64 &floatingPoint) const |
get floating point representation of the numeric value (optional) More... | |
OFCondition | getRationalRepresentation (Sint32 &rationalNumerator, Uint32 &rationalDenominator) const |
get rational representation of the numeric value (optional) More... | |
OFCondition | setValue (const DSRNumericMeasurementValue &numericMeasurement, const OFBool check=OFTrue) |
set numeric measurement value. More... | |
OFCondition | setValue (const OFString &numericValue, const DSRCodedEntryValue &measurementUnit, const OFBool check=OFTrue) |
set numeric value and measurement unit. More... | |
OFCondition | setValue (const DSRCodedEntryValue &valueQualifier, const OFBool check=OFTrue) |
set empty numeric value and measurement unit with a numeric value qualifier. More... | |
OFCondition | setValue (const OFString &numericValue, const DSRCodedEntryValue &measurementUnit, const DSRCodedEntryValue &valueQualifier, const OFBool check=OFTrue) |
set numeric value, measurement unit and numeric value qualifier. More... | |
OFCondition | setNumericValue (const OFString &numericValue, const OFBool check=OFTrue) |
set numeric value. More... | |
OFCondition | setNumericValue (const DcmElement &delem, const unsigned long pos=0, const OFBool check=OFTrue) |
set numeric value from element. More... | |
OFCondition | setNumericValue (DcmItem &dataset, const DcmTagKey &tagKey, const unsigned long pos=0, const OFBool check=OFTrue) |
set numeric value from dataset. More... | |
OFCondition | setMeasurementUnit (const DSRCodedEntryValue &measurementUnit, const OFBool check=OFTrue) |
set measurement unit. More... | |
OFCondition | setNumericValueQualifier (const DSRCodedEntryValue &valueQualifier, const OFBool check=OFTrue) |
set numeric value qualifier. More... | |
OFCondition | setFloatingPointRepresentation (const Float64 floatingPoint, const OFBool check=OFTrue) |
set floating point representation of the numeric value. More... | |
OFCondition | setRationalRepresentation (const Sint32 rationalNumerator, const Uint32 rationalDenominator, const OFBool check=OFTrue) |
set rational representation of the numeric value. More... | |
void | removeFloatingPointRepresentation () |
remove floating point representation of the numeric value (if any). More... | |
void | removeRationalRepresentation () |
remove rational representation of the numeric value (if any). More... | |
Protected Member Functions | |
DSRNumericMeasurementValue * | getValuePtr () |
get pointer to numeric measurement value More... | |
virtual OFCondition | readItem (DcmItem &dataset, const size_t flags) |
read numeric measurement value from dataset More... | |
virtual OFCondition | writeItem (DcmItem &dataset) const |
write numeric measurement value to dataset More... | |
virtual OFCondition | checkNumericValue (const OFString &numericValue) const |
check the specified numeric value for validity. More... | |
virtual OFCondition | checkMeasurementUnit (const DSRCodedEntryValue &measurementUnit) const |
check the specified measurement unit for validity. More... | |
virtual OFCondition | checkNumericValueQualifier (const DSRCodedEntryValue &valueQualifier) const |
check the specified numeric value qualifier for validity. More... | |
virtual OFCondition | checkRationalRepresentation (const Sint32 rationalNumerator, const Uint32 rationalDenominator) const |
check the specified rational representation for validity. More... | |
virtual OFCondition | checkCurrentValue () const |
check the currently stored numeric measurement value for validity. More... | |
Private Attributes | |
OFString | NumericValue |
Numeric Value (VR=DS, type 1 within a type 2 sequence) | |
DSRCodedEntryValue | MeasurementUnit |
Measurement Unit (type 1 within a type 2 sequence) | |
DSRCodedEntryValue | ValueQualifier |
Numeric Value Qualifier (type 1C) | |
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 values and measurements.
DSRNumericMeasurementValue::DSRNumericMeasurementValue | ( | const OFString & | numericValue, |
const DSRCodedEntryValue & | measurementUnit, | ||
const OFBool | check = OFTrue |
||
) |
constructor
numericValue | numeric value (VR=DS, mandatory) |
measurementUnit | code representing the units of measurement (mandatory) |
check | if enabled, check 'numericValue' and 'measurementUnit' for validity before setting them. See corresponding setValue() method for details. |
DSRNumericMeasurementValue::DSRNumericMeasurementValue | ( | const DSRCodedEntryValue & | valueQualifier, |
const OFBool | check = OFTrue |
||
) |
constructor
valueQualifier | code representing the numeric value qualifier (mandatory). Used to specify the reason for the absence of the measured value sequence, i.e. why the numeric value and measurement unit are empty. |
check | if enabled, check value for validity before setting it. See corresponding setValue() method for details. |
DSRNumericMeasurementValue::DSRNumericMeasurementValue | ( | const OFString & | numericValue, |
const DSRCodedEntryValue & | measurementUnit, | ||
const DSRCodedEntryValue & | valueQualifier, | ||
const OFBool | check = OFTrue |
||
) |
constructor
numericValue | numeric value (VR=DS, mandatory) |
measurementUnit | code representing the units of measurement (mandatory) |
valueQualifier | code representing the numeric value qualifier (optional) |
check | if enabled, check values for validity before setting them. See corresponding setValue() method for details. |
DSRNumericMeasurementValue::DSRNumericMeasurementValue | ( | const DSRNumericMeasurementValue & | numericMeasurement | ) |
copy constructor
numericMeasurement | numeric measurement value to be copied (not checked !) |
|
protectedvirtual |
check the currently stored numeric measurement value for validity.
See above checkXXX() methods for details.
|
protectedvirtual |
check the specified measurement unit for validity.
Internally, the methods DSRCodedEntryValue::isEmpty() and DSRCodedEntryValue::checkCurrentValue() are used for this purpose. Conformance with the Context Group 82 (as defined in the DICOM standard) is not yet checked.
measurementUnit | measurement unit to be checked |
Reimplemented in CMR_SRNumericMeasurementValueWithUnits< T_Units, T_DefinedGroup >.
Referenced by CMR_SRNumericMeasurementValueWithUnits< T_Units, T_DefinedGroup >::checkMeasurementUnit().
|
protectedvirtual |
check the specified numeric value for validity.
Currently, the only checks performed are that the string is non-empty and that the given value conforms to the corresponding VR (DS) and VM (1).
numericValue | numeric value to be checked |
|
protectedvirtual |
check the specified numeric value qualifier for validity.
Internally, DSRCodedEntryValue::isEmpty() and DSRCodedEntryValue::checkCurrentValue() are used for this purpose. Conformance with the Context Group 42 (as defined in the DICOM standard) is not checked; see class CMR_SRNumericMeasurementValue if needed, which supports such additional checks.
valueQualifier | numeric value qualifier to be checked |
Reimplemented in CMR_SRNumericMeasurementValue.
|
protectedvirtual |
check the specified rational representation for validity.
The only check that is performed is that the 'rationalDenominator' is not zero, i.e. it is not checked whether this representation is consistent with the numeric value stored as a string.
rationalNumerator | numerator of the rational representation to be checked |
rationalDenominator | denominator of a rational representation to be checked |
|
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 |
|
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 |
|
inline |
get numeric value
|
inline |
get numeric value qualifier (conditional)
OFCondition DSRNumericMeasurementValue::getNumericValueQualifier | ( | DSRCodedEntryValue & | valueQualifier | ) | const |
get copy of numeric value qualifier (conditional)
valueQualifier | reference to variable in which the code should be stored |
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 |
|
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 |
|
inlineprotected |
get pointer to numeric measurement value
|
virtual |
check whether the current numeric measurement value is complete, i.e. whether the numeric value is non-empty and the measurement unit is complete, or whether the value qualifier is complete.
This is just a basic check that might be useful for "validating" input data. See isValid() for a more sophisticated way of checking the current numeric measurement value.
|
virtual |
check whether the current numeric measurement value is empty.
Checks whether both the numeric value and the measurement are empty. The optional value qualifier is not checked since it might contain the reason for the absence of the measured value sequence.
|
virtual |
check whether the current numeric measurement value is valid.
The value is valid if isEmpty() is true or both the numeric value and the measurement unit contain a valid value, and the value qualifier is valid (see checkXXX() methods). The possibly available additional representations of the numeric value are never checked.
Reimplemented in DSRNumTreeNode.
OFBool DSRNumericMeasurementValue::operator!= | ( | const DSRNumericMeasurementValue & | numericMeasurement | ) | const |
comparison operator "not equal".
Two numeric measurement values are not equal if either the numeric value or the measurement unit or the value qualifier are not equal. Other (additional) information is not used for comparison.
numericMeasurement | numeric measurement value that should be compared to the current one |
DSRNumericMeasurementValue & DSRNumericMeasurementValue::operator= | ( | const DSRNumericMeasurementValue & | numericMeasurement | ) |
assignment operator
numericMeasurement | numeric measurement value to be copied (not checked !) |
OFBool DSRNumericMeasurementValue::operator== | ( | const DSRNumericMeasurementValue & | numericMeasurement | ) | const |
comparison operator "equal".
Two numeric measurement values are equal if the numeric value, the measurement unit and the value qualifier are equal. Other (additional) information is not used.
numericMeasurement | numeric measurement value that should be compared to the current one |
|
virtual |
print numeric measurement value.
The output of a typical numeric measurement value looks like this: "3.5" (cm,UCUM[1.4],"centimeter"). If the value is empty, the text "empty" is printed instead, followed by the numeric value qualifier (if present). The possibly available additional floating point and rational 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.
|
protectedvirtual |
read numeric measurement value from dataset
dataset | DICOM dataset from which the value should be read |
flags | flag used to customize the reading process (see DSRTypes::RF_xxx) |
|
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 |
flags | flag used to customize the reading process (see DSRTypes::RF_xxx) |
|
virtual |
read numeric measurement value from XML document
doc | document containing the XML file content |
cursor | cursor pointing to the starting node |
flags | flag used to customize the reading process (see DSRTypes::XF_xxx) |
void DSRNumericMeasurementValue::removeFloatingPointRepresentation | ( | ) |
remove floating point representation of the numeric value (if any).
Internally, all elements that belong to this representation are cleared.
void DSRNumericMeasurementValue::removeRationalRepresentation | ( | ) |
remove rational representation of the numeric value (if any).
Internally, all elements that belong to this representation are cleared.
|
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, |
const OFBool | check = OFTrue |
||
) |
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 |
check | dummy parameter (currently not used) |
OFCondition DSRNumericMeasurementValue::setMeasurementUnit | ( | const DSRCodedEntryValue & | measurementUnit, |
const OFBool | check = OFTrue |
||
) |
set measurement unit.
Before setting the code, it is usually checked. If the code is invalid the current code is not replaced and remains unchanged.
measurementUnit | measurement unit to be set (mandatory) |
check | if enabled, check value for validity before setting it. See checkMeasurementUnit() method for details. An empty value is never accepted, use the clear() method instead. |
Referenced by CMR_SRNumericMeasurementValueWithUnits< T_Units, T_DefinedGroup >::setMeasurementUnit().
OFCondition DSRNumericMeasurementValue::setNumericValue | ( | const DcmElement & | delem, |
const unsigned long | pos = 0 , |
||
const OFBool | check = OFTrue |
||
) |
set numeric value from element.
Before setting the value, it is usually checked. 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.
delem | DICOM element from which the numeric value should be retrieved |
pos | index of the value in case of multi-valued elements (0..vm-1) |
check | if enabled, check numeric value for validity before setting it. See checkNumericValue() method for details. An empty value is never accepted. |
OFCondition DSRNumericMeasurementValue::setNumericValue | ( | const OFString & | numericValue, |
const OFBool | check = OFTrue |
||
) |
set numeric value.
Before setting the value, it is usually checked. 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, mandatory) |
check | if enabled, check value for validity before setting it. See checkNumericValue() method for details. An empty value is never accepted, use the clear() method instead. |
OFCondition DSRNumericMeasurementValue::setNumericValue | ( | DcmItem & | dataset, |
const DcmTagKey & | tagKey, | ||
const unsigned long | pos = 0 , |
||
const OFBool | check = OFTrue |
||
) |
set numeric value from dataset.
Before setting the value, it is usually checked. 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.
dataset | DICOM dataset from which the numeric value should be retrieved |
tagKey | DICOM tag specifying the attribute from which the value should be retrieved. The search is limited to the top-level of the dataset. |
pos | index of the value in case of multi-valued elements (0..vm-1) |
check | if enabled, check numeric value for validity before setting it. See checkNumericValue() method for details. An empty value is never accepted. |
OFCondition DSRNumericMeasurementValue::setNumericValueQualifier | ( | const DSRCodedEntryValue & | valueQualifier, |
const OFBool | check = OFTrue |
||
) |
set numeric value qualifier.
This conditional 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 usually checked. If the code is invalid the current code is not replaced and remains unchanged.
valueQualifier | numeric value qualifier to be set (conditional). Use an empty code to remove the current value. |
check | if enabled, check value for validity before setting it. See checkNumericValueQualifier() method for details. |
OFCondition DSRNumericMeasurementValue::setRationalRepresentation | ( | const Sint32 | rationalNumerator, |
const Uint32 | rationalDenominator, | ||
const OFBool | check = OFTrue |
||
) |
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) |
check | if enabled, check values for validity before setting them. See checkRationalRepresentation() method for details. |
OFCondition DSRNumericMeasurementValue::setValue | ( | const DSRCodedEntryValue & | valueQualifier, |
const OFBool | check = OFTrue |
||
) |
set empty numeric value and measurement unit with a numeric value qualifier.
Before setting the value, it is usually checked. If the value is invalid, the current numeric measurement value is not replaced and remains unchanged.
valueQualifier | numeric value qualifier to be set. Shall be used to specify the reason for the absence of the measured value sequence, i.e. why the numeric value and measurement unit are empty. |
check | if enabled, check value for validity before setting it. See checkNumericValueQualifier() method for details. |
OFCondition DSRNumericMeasurementValue::setValue | ( | const DSRNumericMeasurementValue & | numericMeasurement, |
const OFBool | check = OFTrue |
||
) |
set numeric measurement value.
Before setting the value, it is usually checked. If the value is invalid, the current value is not replaced and remains unchanged.
numericMeasurement | value to be set |
check | if enabled, check value for validity before setting it. See checkXXX() methods for details. Empty values are only accepted for non-mandatory attributes. |
OFCondition DSRNumericMeasurementValue::setValue | ( | const OFString & | numericValue, |
const DSRCodedEntryValue & | measurementUnit, | ||
const DSRCodedEntryValue & | valueQualifier, | ||
const OFBool | check = OFTrue |
||
) |
set numeric value, measurement unit and numeric value qualifier.
Before setting the values, they are usually checked. Please note that both 'numericValue' and 'measurementUnit' either have to be empty or non-empty. 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 (VR=DS, mandatory) |
measurementUnit | measurement unit to be set (mandatory) |
valueQualifier | numeric value qualifier to be set (optional). Use an empty code to remove the current value. |
check | if enabled, check values for validity before setting them. See checkXXX() methods for details. |
OFCondition DSRNumericMeasurementValue::setValue | ( | const OFString & | numericValue, |
const DSRCodedEntryValue & | measurementUnit, | ||
const OFBool | check = OFTrue |
||
) |
set numeric value and measurement unit.
Before setting the values, they are usually checked. Please note that both values (i.e. 'numericValue' and 'measurementUnit') either have to be empty or non-empty. 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 (VR=DS, mandatory) |
measurementUnit | measurement unit to be set (mandatory) |
check | if enabled, check values for validity before setting them. See checkXXX() methods for details. |
|
protectedvirtual |
write numeric measurement value to dataset
dataset | DICOM dataset to which the value should be written |
|
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 conditional and, therefore, only written if non-empty.
dataset | DICOM dataset to which the sequences should be written |
|
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.