DCMTK
Version 3.6.1 20120515
OFFIS DICOM Toolkit
|
a class representing the DICOM value representation 'Time' (TM) More...
Public Member Functions | |
DcmTime (const DcmTag &tag, const Uint32 len=0) | |
constructor. | |
DcmTime (const DcmTime &old) | |
copy constructor | |
virtual | ~DcmTime () |
destructor | |
DcmTime & | operator= (const DcmTime &obj) |
assignment operator | |
virtual DcmObject * | clone () const |
clone method | |
virtual OFCondition | copyFrom (const DcmObject &rhs) |
Virtual object copying. | |
virtual DcmEVR | ident () const |
get element type identifier | |
virtual OFCondition | checkValue (const OFString &vm="1-n", const OFBool oldFormat=OFFalse) |
check whether stored value conforms to the VR and to the specified VM | |
virtual OFCondition | getOFString (OFString &stringValue, const unsigned long pos, OFBool normalize=OFTrue) |
get a copy of a particular string component | |
OFCondition | setCurrentTime (const OFBool seconds=OFTrue, const OFBool fraction=OFFalse) |
set the element value to the current system time. | |
OFCondition | setOFTime (const OFTime &timeValue) |
set the element value to the given time | |
OFCondition | getOFTime (OFTime &timeValue, const unsigned long pos=0, const OFBool supportOldFormat=OFTrue) |
get the current element value in OFTime format. | |
OFCondition | getISOFormattedTime (OFString &formattedTime, const unsigned long pos=0, const OFBool seconds=OFTrue, const OFBool fraction=OFFalse, const OFBool createMissingPart=OFFalse, const OFBool supportOldFormat=OFTrue) |
get the current element value in ISO time format. | |
Static Public Member Functions | |
static OFCondition | getCurrentTime (OFString &dicomTime, const OFBool seconds=OFTrue, const OFBool fraction=OFFalse) |
get the current system time. | |
static OFCondition | getDicomTimeFromOFTime (const OFTime &timeValue, OFString &dicomTime, const OFBool seconds=OFTrue, const OFBool fraction=OFFalse) |
get the specified OFTime value in DICOM format. | |
static OFCondition | getOFTimeFromString (const OFString &dicomTime, OFTime &timeValue, const OFBool supportOldFormat=OFTrue) |
get the specified DICOM time value in OFTime format. | |
static OFCondition | getISOFormattedTimeFromString (const OFString &dicomTime, OFString &formattedTime, const OFBool seconds=OFTrue, const OFBool fraction=OFFalse, const OFBool createMissingPart=OFFalse, const OFBool supportOldFormat=OFTrue) |
get the specified DICOM time value in ISO format. | |
static OFCondition | getTimeZoneFromString (const OFString &dicomTimeZone, double &timeZone) |
get the specified DICOM time zone in number of hours format DICOM standard states that if the "Timezone Offset From UTC" attribute (0008,0201) is present it applies to all TM attributes in the object. | |
static OFCondition | checkStringValue (const OFString &value, const OFString &vm="1-n", const OFBool oldFormat=OFFalse) |
check whether given string value conforms to the VR "TM" (Time) and to the specified VM. |
a class representing the DICOM value representation 'Time' (TM)
DcmTime::DcmTime | ( | const DcmTag & | tag, |
const Uint32 | len = 0 |
||
) |
constructor.
Create new element from given tag and length.
tag | DICOM tag for the new element |
len | value length for the new element |
DcmTime::DcmTime | ( | const DcmTime & | old | ) |
copy constructor
old | element to be copied |
static OFCondition DcmTime::checkStringValue | ( | const OFString & | value, |
const OFString & | vm = "1-n" , |
||
const OFBool | oldFormat = OFFalse |
||
) | [static] |
check whether given string value conforms to the VR "TM" (Time) and to the specified VM.
value | string value to be checked (possibly multi-valued) |
vm | value multiplicity (according to the data dictionary) to be checked for. (See DcmElement::checkVM() for a list of valid values.) |
oldFormat | support old ACR/NEMA time format if OFTrue (i.e. with ":" and "." delimiters) |
virtual OFCondition DcmTime::checkValue | ( | const OFString & | vm = "1-n" , |
const OFBool | oldFormat = OFFalse |
||
) | [virtual] |
check whether stored value conforms to the VR and to the specified VM
vm | value multiplicity (according to the data dictionary) to be checked for. (See DcmElement::checkVM() for a list of valid values.) |
oldFormat | support old ACR/NEMA format if OFTrue (':' as a separator) |
Reimplemented from DcmElement.
virtual DcmObject* DcmTime::clone | ( | ) | const [inline, virtual] |
virtual OFCondition DcmTime::copyFrom | ( | const DcmObject & | rhs | ) | [virtual] |
Virtual object copying.
This method can be used for DcmObject and derived classes to get a deep copy of an object. Internally the assignment operator is called if the given DcmObject parameter is of the same type as "this" object instance. If not, an error is returned. This function permits copying an object by value in a virtual way which therefore is different to just calling the assignment operator of DcmElement which could result in slicing the object.
rhs | - [in] The instance to copy from. Has to be of the same class type as "this" object |
Reimplemented from DcmByteString.
static OFCondition DcmTime::getCurrentTime | ( | OFString & | dicomTime, |
const OFBool | seconds = OFTrue , |
||
const OFBool | fraction = OFFalse |
||
) | [static] |
get the current system time.
The DICOM TM format supported by this function is "HHMM[SS[.FFFFFF]]" where the brackets enclose optional parts. If the current system time or parts of it are unavailable the corresponding values are set to "0" and an error code is returned.
dicomTime | reference to string variable where the result is stored |
seconds | add optional seconds ("SS") if OFTrue |
fraction | add optional fractional part of a second (".FFFFFF") if OFTrue (requires parameter 'seconds' to be also OFTrue) |
static OFCondition DcmTime::getDicomTimeFromOFTime | ( | const OFTime & | timeValue, |
OFString & | dicomTime, | ||
const OFBool | seconds = OFTrue , |
||
const OFBool | fraction = OFFalse |
||
) | [static] |
get the specified OFTime value in DICOM format.
The DICOM TM format supported by this function is "HHMM[SS[.FFFFFF]]" where the brackets enclose optional parts. If the current system time or parts of it are unavailable the corresponding values are set to "0" and an error code is returned.
timeValue | time to be converted to DICOM format |
dicomTime | reference to string variable where the result is stored |
seconds | add optional seconds ("SS") if OFTrue |
fraction | add optional fractional part of a second (".FFFFFF") if OFTrue (requires parameter 'seconds' to be also OFTrue) |
OFCondition DcmTime::getISOFormattedTime | ( | OFString & | formattedTime, |
const unsigned long | pos = 0 , |
||
const OFBool | seconds = OFTrue , |
||
const OFBool | fraction = OFFalse , |
||
const OFBool | createMissingPart = OFFalse , |
||
const OFBool | supportOldFormat = OFTrue |
||
) |
get the current element value in ISO time format.
The ISO time format supported by this function is "HH:MM[:SS[.FFFFFF]]" where the brackets enclose optional parts. Please note that the element value is expected to be in valid DICOM TM format ("[HH[MM[SS[.FFFFFF]]]]", "[HH[:MM[:SS[.FFFFFF]]]]" is also supported for reasons of backward compatibility). If this function fails or the current element value is empty, the result variable 'formattedTime' is cleared automatically. Please note that if the "Timezone Offset From UTC" attribute (0008,0201) is present, it applies to all TM attributes in the object. However, the time zone is not taken into account for the creation of the ISO formatted time. See also "getTimeZoneFromString()" below.
formattedTime | reference to string variable where the result is stored |
pos | index of the element component in case of value multiplicity (0..vm-1) |
seconds | add optional seconds (":SS") if OFTrue |
fraction | add optional fractional part of a second (".FFFFFF") if OFTrue (requires parameter 'seconds' to be also OFTrue) |
createMissingPart | if OFTrue create optional parts (seconds and/or fractional part of a seconds) if absent in the element value |
supportOldFormat | if OFTrue support old (prior V3.0) time format (see above) |
static OFCondition DcmTime::getISOFormattedTimeFromString | ( | const OFString & | dicomTime, |
OFString & | formattedTime, | ||
const OFBool | seconds = OFTrue , |
||
const OFBool | fraction = OFFalse , |
||
const OFBool | createMissingPart = OFFalse , |
||
const OFBool | supportOldFormat = OFTrue |
||
) | [static] |
get the specified DICOM time value in ISO format.
The ISO time format supported by this function is "HH:MM[:SS[.FFFFFF]]" where the brackets enclose optional parts. Please note that the specified value is expected to be in valid DICOM TM format ("[HH[MM[SS[.FFFFFF]]]]", "[HH[:MM[:SS[.FFFFFF]]]]" is also supported for reasons of backward compatibility). If this function fails or the specified DICOM time value is empty, the result variable 'formattedTime' is cleared automatically.
dicomTime | string value in DICOM TM format to be converted to ISO format |
formattedTime | reference to string variable where the result is stored |
seconds | add optional seconds (":SS") if OFTrue |
fraction | add optional fractional part of a second (".FFFFFF") if OFTrue (requires parameter 'seconds' to be also OFTrue) |
createMissingPart | if OFTrue create optional parts (seconds and/or fractional part of a seconds) if absent in the DICOM TM value |
supportOldFormat | if OFTrue support old (prior V3.0) time format (see above) |
virtual OFCondition DcmTime::getOFString | ( | OFString & | stringValue, |
const unsigned long | pos, | ||
OFBool | normalize = OFTrue |
||
) | [virtual] |
get a copy of a particular string component
stringValue | variable in which the result value is stored |
pos | index of the value in case of multi-valued elements (0..vm-1) |
normalize | delete trailing spaces if OFTrue |
Reimplemented from DcmByteString.
OFCondition DcmTime::getOFTime | ( | OFTime & | timeValue, |
const unsigned long | pos = 0 , |
||
const OFBool | supportOldFormat = OFTrue |
||
) |
get the current element value in OFTime format.
Please note that the element value is expected to be in valid DICOM TM format ("[HH[MM[SS[.FFFFFF]]]]", "[HH[:MM[:SS[.FFFFFF]]]]" is also supported for reasons of backward compatibility). Since there is no time zone for the DICOM TM format local time is assumed (the time zone of 'timeValue' is set automatically). If this function fails the result variable 'timeValue' is cleared automatically.
timeValue | reference to OFTime variable where the result is stored |
pos | index of the element component in case of value multiplicity (0..vm-1) |
supportOldFormat | if OFTrue support old (prior V3.0) time format (see above) |
static OFCondition DcmTime::getOFTimeFromString | ( | const OFString & | dicomTime, |
OFTime & | timeValue, | ||
const OFBool | supportOldFormat = OFTrue |
||
) | [static] |
get the specified DICOM time value in OFTime format.
Please note that the element value is expected to be in valid DICOM TM format ("[HH[MM[SS[.FFFFFF]]]]", "[HH[:MM[:SS[.FFFFFF]]]]" is also supported for reasons of backward compatibility). Since there is no time zone for the DICOM TM format local time is assumed (the time zone of 'timeValue' is set automatically). If this function fails the result variable 'timeValue' is cleared automatically.
dicomTime | string value in DICOM TM format to be converted to ISO format. An empty string is not regarded as valid input, since the time would be unknown. |
timeValue | reference to OFTime variable where the result is stored |
supportOldFormat | if OFTrue support old (prior V3.0) time format (see above) |
static OFCondition DcmTime::getTimeZoneFromString | ( | const OFString & | dicomTimeZone, |
double & | timeZone | ||
) | [static] |
get the specified DICOM time zone in number of hours format DICOM standard states that if the "Timezone Offset From UTC" attribute (0008,0201) is present it applies to all TM attributes in the object.
This functions allows to convert the DICOM format ("&ZZZZ" where "&" is "+" or "-" and "ZZZZ" hours and minutes) to a floating point value, e.g. "+1.0" means plus one hour and "-2.5" minus two and a half hour, i.e. 2 hours and 30 minutes. The resulting 'timeZone' value can be used in conjuction with a OFTime object to convert the time to different time zones (e.g. to local time or UTC).
dicomTimeZone | string value in DICOM format ("&ZZZZ") to be converted |
timeZone | reference to floating point variable where the resulting UTC offset is stored |
virtual DcmEVR DcmTime::ident | ( | ) | const [virtual] |
get element type identifier
Reimplemented from DcmByteString.
assignment operator
obj | element to be assigned/copied |
OFCondition DcmTime::setCurrentTime | ( | const OFBool | seconds = OFTrue , |
const OFBool | fraction = OFFalse |
||
) |
set the element value to the current system time.
The DICOM TM format supported by this function is "HHMM[SS[.FFFFFF]]" where the brackets enclose optional parts. If the current system time or parts of it are unavailable the corresponding values are set to "0" and an error code is returned.
seconds | add optional seconds ("SS") if OFTrue |
fraction | add optional fractional part of a second (".FFFFFF") if OFTrue (requires parameter 'seconds' to be also OFTrue) |
OFCondition DcmTime::setOFTime | ( | const OFTime & | timeValue | ) |
set the element value to the given time
timeValue | time to be set (should be a valid time) |