Open neurolabusc opened 2 months ago
The best universal solution I have found is to use byteOffset, but I am not sure why this is not zero in these validation datasets:
const img8 = new Uint8Array(iwi.data.buffer, iwi.data.byteOffset, iwi.data.byteLength)
My best guess is these validation versions were created by beta software and should be updated to reflect the standard, but it might be worth understanding the origin of this discrepancy.
Yes, I expect this also.
I was able to create sensible IWI images with Python:
However, the validation itk-wasm test datasets seem odd, specifically
When I decode each, the data.buffer.bytelength is larger than the data.byteLength, with the latter being the number of bytes described by the header (while the former is >200 bytes too large). While padding datasets for byte alignment seems understandable, the strange thing is the the padding is at the start of the array, not the end. This makes fast reading of byte data as Uint8Array regardless of datatype (e.g. Float32Array, etc) ungainly. My best guess is these validation versions were created by beta software and should be updated to reflect the standard, but it might be worth understanding the origin of this discrepancy.