-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Internationalization support #146
Comments
Here is what I get using the DICOM Dump to JSON live example: while it should look like: ref: |
readFixedString does not seems to check the value for SpecificCharacterSet (0008,0005) as seen at:
refs: |
@malaterre Currently dicomParser itself doesn't do any character set decoding. However, if you need it now, you can pair dicomParser with the dicom-character-set library that I wrote. |
@yagni That looks pretty promising. One thing I still fail to understand. The original
So I am wondering what is the expected input to your library ? Can I pass directly the output of |
I didn't have any experience with DICOM character sets so didn't factor it into the original design. I like the idea of putting it in a separate library like @yagni did so it can be added in for those that need it. I specifically didn't add image decompression to this library for the same reason. |
@chafey I am pretty sure that this test is just wrong:
This feel like a c-string ASCII ending. I am sure we can have |
@malaterre You'll need to pass the raw bytes to dicom-character-set. If I remember correctly, fromCharCode converts it to UTF so you end up with bytes not in the original data. So just slice the byteArray starting at the element's |
It probably makes sense to revisit the whole repo in light of non ascii character sets, lots of code is using this library now and we should not be propogating designs with are not character set aware |
@creemer To get the raw data, create a Uint8Array at the data offset of the element (like we do in the readme) of the appropriate length: const patientNameElement = dataSet.elements.x00100010;
const patientNameBytes = new Uint8Array(dataSet.byteArray.buffer, patientNameElement.dataOffset, patientNameElement.length); If you don't want to parse those bytes yourself at this point, you can pass them, along with the value of the Specific Character Set element, to my dicom-character-set library: import { convertBytes } from 'dicom-character-set';
const str = convertBytes(dataSet.string('x00080005'), patientNameBytes, {vr: 'PN'}); |
@yagni Thanks a lot! It is all I need :) |
I cannot find anything related to internationalization support neither in the documentation nor in the code itself. What is the status of internationalization support in dicomParser ?
I have not checked but I suspect some string won't play well with JSON which is limited to UTF-8 /UTF-16/UTF-32 strings.
Ref:
The text was updated successfully, but these errors were encountered: