dwv icon indicating copy to clipboard operation
dwv copied to clipboard

Example of DICOM load, edit and download edited version, issue with DicomWriter

Open git-toni opened this issue 1 year ago • 0 comments

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:

  1. Load DICOM via loadURLs .
  2. Edit some metadata fields.
  3. Draw some shapes on the canvas.
  4. 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: image

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.

git-toni avatar Jul 02 '24 12:07 git-toni