Example of DICOM load, edit and download edited version, issue with DicomWriter
Helloo! I'm attempting to complete a rather simple task but I seem to be stuck, I'm certainly missing something quite obvious. Thank you in advance :pray:
Task:
- Load DICOM via
loadURLs. - Edit some metadata fields.
- Draw some shapes on the canvas.
- Write an edited copy of the DICOM and download it.
I prepared a JSFiddle forking one of the main examples from the docs.
Note that I omitted step 2) for the sake of simplicity; correct me if I'm misunderstanding but to achieve that one would directly edit a particular field in the metadata object of type {string, DataElement}.
The issue in the example is at step 4), particularly when calling
writer.getBuffer(dicomElements)
Error:
What the example does is get the metadata from dataId=0, then pass it to getBuffer as dicomElements, so I reckon I'm not sending the right argument here.
If you think it can be informative, I'd be happy to submit a PR to the repo with a new example once I can get the whole thing working (both the vanilla examples & react which is what I'm working with) :relaxed:
Thanks for the lib & help!
PS. Also attempted it via explicit XHTMLRequest arraybuffer parsing, but then one needs to implement the image + layer + view creation logic, which is slightly more tedious IIUC.