dcmjs-org / dcmjs

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

Pixel Spacing parsing with comma as decimal separator is returning incorrect value #287

Closed triet12369 closed 2 years ago

triet12369 commented 2 years ago

Hi,

I found out that for images with the pixel spacing attribute (0028,0030), (0018,1164) that uses comma as decimal separator: image

the resulting parsed Pixel Value is not correct:

const dicomData = dcmjs.data.DicomMessage.readFile(dicomP10ArrayBuffer);
console.log(dicomData.dict['00280030'].Value) // --> [143, 143]

I'm unfamiliar with DICOM Tag parsing so I'm grateful to hear pointers to fix this issue. Thank you in advance.

I have attached the anonymized dicom file for reference dicom.zip

pieper commented 2 years ago

Thanks for the report 👍

The dicom standard is clear that only the period character . is legal for a decimal string (DS):

https://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_6.2.html

It appears whatever system generated this file had a problem with the locale setting and generated an invalid file. As a rule we avoid putting in support for invalid data.

In other software we support patching files, although I don't think this issue (commas in DS) is addressed. You could probably write a similar tool in javascript to address this particular issue if you have no other alternative.