DCMTK  Version 3.6.1 20120515
OFFIS DICOM Toolkit
Public Member Functions | Protected Member Functions | Private Attributes | Friends
DSRNumericMeasurementValue Class Reference

Class for numeric measurement values. More...

+ Inheritance diagram for DSRNumericMeasurementValue:

List of all members.

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
DSRNumericMeasurementValueoperator= (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 DSRNumericMeasurementValuegetValue () const
 get reference to numeric measurement value
OFCondition getValue (DSRNumericMeasurementValue &numericMeasurement) const
 get copy of numeric measurement value
const OFStringgetNumericValue () const
 get numeric value
const DSRCodedEntryValuegetMeasurementUnit () const
 get measurement unit
const DSRCodedEntryValuegetNumericValueQualifier () 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

DSRNumericMeasurementValuegetValuePtr ()
 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

Detailed Description

Class for numeric measurement values.


Constructor & Destructor Documentation

DSRNumericMeasurementValue::DSRNumericMeasurementValue ( const OFString numericValue,
const DSRCodedEntryValue measurementUnit 
)

constructor.

The code triple is only set if it passed the validity check (see setValue()).

Parameters:
numericValuenumeric measurement value. (VR=DS, type 1)
measurementUnitcode 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()).

Parameters:
numericValuenumeric measurement value. (VR=DS, type 1)
measurementUnitcode representing the measurement name (code meaning) and unit (code value). (type 2)
valueQualifiercode representing the numeric value qualifier. (type 3)

copy constructor

Parameters:
numericMeasurementnumeric measurement value to be copied (not checked !)

Member Function Documentation

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.

Parameters:
measurementUnitmeasurement unit to be checked
Returns:
OFTrue if measurement unit is valid, OFFalse otherwise
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.

Parameters:
numericValuenumeric value to be checked
Returns:
OFTrue if numeric value is valid, OFFalse otherwise
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.

Parameters:
valueQualifiernumeric value qualifier to be checked
Returns:
OFTrue if value qualifier is valid, OFFalse otherwise
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.

Parameters:
rationalNumeratornumerator of the rational representation to be checked
rationalDenominatordenominator of a rational representation to be checked
Returns:
OFTrue if rational representation is valid, OFFalse otherwise
virtual void DSRNumericMeasurementValue::clear ( ) [virtual]

clear all internal variables.

Use this method to create an empty numeric measurement value.

Reimplemented in DSRNumTreeNode.

get floating point representation of the numeric value (optional)

Parameters:
floatingPointreference to variable in which the floating point representation should be stored
Returns:
status, EC_Normal if successful, an error code otherwise

get measurement unit

Returns:
reference to current measurement unit code (might be invalid or empty)

get copy of measurement unit

Parameters:
measurementUnitreference to variable in which the code should be stored
Returns:
status, EC_Normal if successful, an error code otherwise

get numeric value

Returns:
current numeric value (might be invalid or an empty string)

get numeric value qualifier (optional)

Returns:
reference to current numeric value qualifier code (might be invalid or empty)
OFCondition DSRNumericMeasurementValue::getRationalRepresentation ( Sint32 &  rationalNumerator,
Uint32 &  rationalDenominator 
) const

get rational representation of the numeric value (optional)

Parameters:
rationalNumeratorreference to variable in which the integer numerator of the rational representation should be stored
rationalDenominatorreference to variable in which the integer denominator of the rational representation should be stored
Returns:
status, EC_Normal if successful, an error code otherwise

get reference to numeric measurement value

Returns:
reference to numeric measurement value

get copy of numeric measurement value

Parameters:
numericMeasurementreference to variable in which the value should be stored
Returns:
status, EC_Normal if successful, an error code otherwise

get pointer to numeric measurement value

Returns:
pointer to numeric measurement value (never NULL)
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.

Returns:
OFTrue if value is empty, OFFalse otherwise
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.

Returns:
OFTrue if value is valid, OFFalse otherwise

Reimplemented in DSRNumTreeNode.

DSRNumericMeasurementValue& DSRNumericMeasurementValue::operator= ( const DSRNumericMeasurementValue numericMeasurement)

assignment operator

Parameters:
numericMeasurementnumeric measurement value to be copied (not checked !)
Returns:
reference to this numeric value after 'numericMeasurement' has been copied
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.

Parameters:
streamoutput stream to which the numeric measurement value should be printed
flagsflag used to customize the output (not used)
Returns:
status, EC_Normal if successful, an error code otherwise

Reimplemented in DSRNumTreeNode.

virtual OFCondition DSRNumericMeasurementValue::readItem ( DcmItem dataset) [protected, virtual]

read numeric measurement value from dataset

Parameters:
datasetDICOM dataset from which the value should be read
Returns:
status, EC_Normal if successful, an error code otherwise

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.

Parameters:
datasetDICOM dataset from which the sequences should be read
Returns:
status, EC_Normal if successful, an error code otherwise
virtual OFCondition DSRNumericMeasurementValue::readXML ( const DSRXMLDocument doc,
DSRXMLCursor  cursor 
) [virtual]

read numeric measurement value from XML document

Parameters:
docdocument containing the XML file content
cursorcursor pointing to the starting node
Returns:
status, EC_Normal if successful, an error code otherwise
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

Parameters:
docStreamoutput stream to which the main HTML/XHTML document is written
annexStreamoutput stream to which the HTML/XHTML document annex is written
annexNumberreference to the variable where the current annex number is stored. Value is increased automatically by 1 after a new entry has been added.
flagsflag used to customize the output (see DSRTypes::HF_xxx)
Returns:
status, EC_Normal if successful, an error code otherwise

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.

Parameters:
floatingPointfloating point representation of the numeric value
Returns:
status, EC_Normal if successful, an error code otherwise

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.

Parameters:
measurementUnitmeasurement unit to be set
Returns:
status, EC_Normal if successful, an error code otherwise

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.

Parameters:
numericValuenumeric value to be set (VR=DS)
Returns:
status, EC_Normal if successful, an error code otherwise

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.

Parameters:
valueQualifiernumeric value qualifier to be set
Returns:
status, EC_Normal if successful, an error code otherwise
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.

Parameters:
rationalNumeratorinteger numerator of a rational representation of the numeric value (encoded as a signed integer value)
rationalDenominatorinteger denominator of a rational representation of the numeric value (encoded as a non-zero unsigned integer value)
Returns:
status, EC_Normal if successful, an error code otherwise

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.

Parameters:
numericMeasurementvalue to be set
Returns:
status, EC_Normal if successful, an error code otherwise
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.

Parameters:
numericValuenumeric value to be set
measurementUnitmeasurement unit to be set
Returns:
status, EC_Normal if successful, an error code otherwise
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.

Parameters:
numericValuenumeric value to be set
measurementUnitmeasurement unit to be set
valueQualifiernumeric value qualifier to be set
Returns:
status, EC_Normal if successful, an error code otherwise
virtual OFCondition DSRNumericMeasurementValue::writeItem ( DcmItem dataset) const [protected, virtual]

write numeric measurement value to dataset

Parameters:
datasetDICOM dataset to which the value should be written
Returns:
status, EC_Normal if successful, an error code otherwise
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.

Parameters:
datasetDICOM dataset to which the sequences should be written
Returns:
status, EC_Normal if successful, an error code otherwise
virtual OFCondition DSRNumericMeasurementValue::writeXML ( STD_NAMESPACE ostream &  stream,
const size_t  flags 
) const [virtual]

write numeric measurement value in XML format

Parameters:
streamoutput stream to which the XML document is written
flagsflag used to customize the output (see DSRTypes::XF_xxx)
Returns:
status, EC_Normal if successful, an error code otherwise

Reimplemented in DSRNumTreeNode.


The documentation for this class was generated from the following file:


Generated on Tue May 15 2012 for DCMTK Version 3.6.1 20120515 by Doxygen 1.7.5.1-20111027