dsr2xml drops milliseconds from SR content items of type DATETIME and TIME

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
p.nast
Posts: 3
Joined: Tue, 2024-06-18, 09:34
Location: Germany

dsr2xml drops milliseconds from SR content items of type DATETIME and TIME

#1 Post by p.nast »

Hi,

is there a reason why dsr2xml discards the fractions of a second from content items of value type DATETIME and TIME? From my understanding, xs:time definitely allows fractions of a second.
When dumping the same DICOM SR instance with dcm2xml it keeps the milliseconds for these content items.

dsr2xml:

Code: Select all

            ...
            <time>
               <relationship>HAS ACQ CONTEXT</relationship>
               <concept>
                  <value>Time</value>
                  <scheme>
                     <designator>99PNA</designator>
                  </scheme>
                  <meaning>Time sample</meaning>
               </concept>
               <value>09:47:29</value>
            </time>
            <datetime>
               <relationship>HAS ACQ CONTEXT</relationship>
               <concept>
                  <value>DateTime</value>
                  <scheme>
                     <designator>99PNA</designator>
                  </scheme>
                  <meaning>DateTime sample</meaning>
               </concept>
               <value>1971-01-16T09:47:29</value>
            </datetime>
            ...
dcm2xml (for the same instance):

Code: Select all

         ...
         <item card="4">
            <element tag="0040,a010" vr="CS" vm="1" len="16" name="RelationshipType">HAS ACQ CONTEXT</element>
            <element tag="0040,a040" vr="CS" vm="1" len="4" name="ValueType">TIME</element>
            <sequence tag="0040,a043" vr="SQ" card="1" name="ConceptNameCodeSequence">
               <item card="3">
                  <element tag="0008,0100" vr="SH" vm="1" len="4" name="CodeValue">Time</element>
                  <element tag="0008,0102" vr="SH" vm="1" len="6" name="CodingSchemeDesignator">99PNA</element>
                  <element tag="0008,0104" vr="LO" vm="1" len="12" name="CodeMeaning">Time sample</element>
               </item>
            </sequence>
            <element tag="0040,a122" vr="TM" vm="1" len="10" name="Time">094729.333</element>
         </item>
         <item card="4">
            <element tag="0040,a010" vr="CS" vm="1" len="16" name="RelationshipType">HAS ACQ CONTEXT</element>
            <element tag="0040,a040" vr="CS" vm="1" len="8" name="ValueType">DATETIME</element>
            <sequence tag="0040,a043" vr="SQ" card="1" name="ConceptNameCodeSequence">
               <item card="3">
                  <element tag="0008,0100" vr="SH" vm="1" len="8" name="CodeValue">DateTime</element>
                  <element tag="0008,0102" vr="SH" vm="1" len="6" name="CodingSchemeDesignator">99PNA</element>
                  <element tag="0008,0104" vr="LO" vm="1" len="16" name="CodeMeaning">DateTime sample</element>
               </item>
            </sequence>
            <element tag="0040,a120" vr="DT" vm="1" len="18" name="DateTime">19710116094729.333</element>
         </item>
         ...
Thanks and best regards,
Patrick A. Nast

J. Riesmeier
DCMTK Developer
Posts: 2524
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: dsr2xml drops milliseconds from SR content items of type DATETIME and TIME

#2 Post by J. Riesmeier »

I think there is at least no good reason for it. This is just the format that was implemented at that time. I guess it shouldn't be too complicated to change this (including the XML Schema).

I'll have a look at this (as time permits)...

P.S.: I just noticed that the reason for not supporting the fractional part of a second is/was that the read XML method does not support this optional part of the value, because OFTime::setISOFormattedTime() does not yet support it. Also see DCMTK issue #895.

p.nast
Posts: 3
Joined: Tue, 2024-06-18, 09:34
Location: Germany

Re: dsr2xml drops milliseconds from SR content items of type DATETIME and TIME

#3 Post by p.nast »

Thanks for the information.

So, does that mean it will get fixed in dsr2xml once the patch #895 is merged to dcmtk?

J. Riesmeier
DCMTK Developer
Posts: 2524
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: dsr2xml drops milliseconds from SR content items of type DATETIME and TIME

#4 Post by J. Riesmeier »

I've just created a new entry to our issue tracker: Feature #1128: dcmsr should support the fractional part of a second in its own XML format

Yes, this feature is currently blocked by issue #895 and #1127. The patch from the GitHub pull request 17 is certainly a good starting point, but I will not merge it directly.

By the way, I've already created an internal branch where I started to implement support for the fractional part of a second, not only for TIME and DATETIME Content Items but for all data elements that use a VR of "TM" or "DT". However, as I said, the read XML functionality relies on OFTime, which does not yet fully support the fractional part of a second...

p.nast
Posts: 3
Joined: Tue, 2024-06-18, 09:34
Location: Germany

Re: dsr2xml drops milliseconds from SR content items of type DATETIME and TIME

#5 Post by p.nast »

Thanks Jörg.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Semrush [Bot] and 1 guest