getOFString() Behavior With VM=0

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
aprogrammer
Posts: 5
Joined: Wed, 2011-04-20, 04:09

getOFString() Behavior With VM=0

#1 Post by aprogrammer »

Hello, I've noticed that getOFString() will return an error code if used to retrieve a ShortString or LongString field that has a VM of zero. However, it will successfully return an empty string if used on a ShortText or LongText field with a VM of zero.

I know the main difference between the *String and *Text fields is that the former allow multiple items to be encoded using the backslash as separator. It still seems like the behavior should be the same when VM=0, though. Is this difference by design?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

What is the return code? I could imagine that in one case the data element is present with an empty value, while in the other case the data element is not present in the dataset.

Btw, which version of the DCMTK are you using?

aprogrammer
Posts: 5
Joined: Wed, 2011-04-20, 04:09

#3 Post by aprogrammer »

It returns EC_IllegalParameter on DCMTK 3.5.4, and the source for 3.6.0 looks like it probably does the same.

FWIW, if I look at the file in jdicom, it shows both fields being present but empty (and having a VM of 0).

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#4 Post by Jörg Riesmeier »

Thank you for pointing this out. No, I don't think that this was a deliberate design decision. It is caused by the fact that SH and LO use the method DcmByteString::getOFString() - where pos=0 is invalid in case of VM=0 - while ST and LT use internally getOFStringArray() which does not check the "pos" parameter.

We will add this issue to our to-do list.

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

#5 Post by J. Riesmeier »

Thanks again for reporting this. Should be fixed now.

Post Reply

Who is online

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