Nan and Infinity

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Shaeto
Posts: 150
Joined: Tue, 2009-01-20, 17:50
Location: CA, USA
Contact:

Nan and Infinity

#1 Post by Shaeto »

Hi,

OFStandard::ftoa produces incompatible with a javascript world "nan", "inf" , "-inf", it should be NaN Infinity -Infinity

it is important only for writeJson method, so, may be it is good idea to add new ftoa formatting flag and use it only in FL etc writeJson

or just change it from nan to NaN because as i see OFStandard::atof can handle both variants

Thanks!

Shaeto
Posts: 150
Joined: Tue, 2009-01-20, 17:50
Location: CA, USA
Contact:

Re: Nan and Infinity

#2 Post by Shaeto »

update: my solution is changed DcmJsonFormat::normalizeDecimalString with check and conversion

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1484
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Nan and Infinity

#3 Post by Marco Eichelberg »

Unfortunately, JSON does not have official keywords for "not a number" and "infinity". DICOM will define official keywords in CP 2275, which is not public yet. These will probably be the same ones as supported by JavaScript, but in any case DCMTK will write JSON compatible with CP 2275, once it is available.

Shaeto
Posts: 150
Joined: Tue, 2009-01-20, 17:50
Location: CA, USA
Contact:

Re: Nan and Infinity

#4 Post by Shaeto »

agree, may be move static functions like normalizeDecimalString etc to virtual table of the DcmJsonFormat ? to have more flex control.

thanks!

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1484
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Nan and Infinity

#5 Post by Marco Eichelberg »

You mean, we should declare some methods in class DcmJsonFormat virtual that are currently not declared so? That would certainly be possible. Perhaps you could propose a patch.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest