str2time.Rd
The DICOM time entry (TM) is converted into two alternative formats: a text version of the original format and a number in seconds. The DICOM date entry (DA) is converted into a simple alternative format.
str2time(tt, format.out = "%02i:%02i:%08.5f")
str2date(dd, format.in = "%Y%m%d", format.out = "%d %b %Y")
tt | TM field from a DICOM header. |
---|---|
dd | DA field from a DICOM header. |
format.in, format.out | Appropriate formatting of input or output. |
For “TM”, a list structure containing two fields
A text version of the time where colons have been inserted for readability.
Time in seconds from midnight.
DICOM “TM” format consists of a string of characters of the format
hhmmss.frac
; where hh
contains hours (range “00” -
“23”), mm
contains minutes (range “00” - “59”),
ss
contains seconds (range “00” - “59”), and
frac
contains a fractional part of a second as small as 1 millionth
of a second (range 000000 - 999999). A 24 hour clock is assumed. Midnight
can be represented by only 0000 since 2400 would violate the hour range.
The string may be padded with trailing spaces. Leading and embedded spaces
are not allowed. One or more of the components mm
, ss
, or
frac
may be unspecified as long as every component to the right of an
unspecified component is also unspecified. If frac
is unspecified
the preceding “.” may not be included. Frac
shall be held to
six decimal places or less to ensure its format conforms to the ANSI HISPP
MSDS Time common data type. Examples:
070907.0705 represents a time of 7 hours, 9 minutes and 7.0705 seconds.
1010 represents a time of 10 hours, and 10 minutes.
021 is an invalid value.
Notes: For reasons of backward compatibility with versions of this
standard prior to V3.0, it is recommended that implementations also support
a string of characters of the format hh:mm:ss.frac
for this VR.
DICOM “DA” format A string of characters of the format yyyymmdd; where yyyy shall contain year, mm shall contain the month, and dd shall contain the day. This conforms to the ANSI HISPP MSDS Date common data type. Example:
19930822 would represent August 22, 1993.
Notes: For reasons of backward compatibility with versions of this standard prior to V3.0, it is recommended that implementations also support a string of characters of the format yyyy.mm.dd for this VR.
Digital Imaging and Communications in Medicine (DICOM)
http://medical.nema.org
http://en.wikipedia.org/wiki/Digital_Imaging_and_Communications_in_Medicine
Brandon Whitcher bwhitcher@gmail.com
str2date("19930822")
#> [1] "22 Aug 1993"
str2time("112308")
#> $txt
#> [1] "11:23:08.00000"
#>
#> $time
#> [1] 40988
#>