dcmjs-org / dcmjs

Javascript implementation of DICOM manipulation
https://dcmjs.netlify.com/
MIT License
287 stars 108 forks source link

Length of Decimal String larger than 16 characters #366

Open rvantklooster opened 9 months ago

rvantklooster commented 9 months ago

Given a Decimal String with the numerical value of 0.99990081787109 (Number), and writing it to a DICOM file, then the resulting string is 17 characters wide.

In DecimalString::formatValue (ValueRepresentation.js), the function toExponential() guarantee that the resulting string is maximum 16 characters wide. See https://github.com/dcmjs-org/dcmjs/blob/master/src/ValueRepresentation.js#L535C1-L545C6

We copied the behavior from pydicom to properly truncate the string and made a PR. See https://github.com/pydicom/pydicom/blob/main/src/pydicom/valuerep.py#L912