OHIF / Viewers

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages
https://docs.ohif.org/
MIT License
3.29k stars 3.32k forks source link

The worker in PaintFilter doesn't work #2215

Closed StevenRoger closed 1 year ago

StevenRoger commented 3 years ago

Bug Report

Describe the Bug

First, in vtk extension, OHIFVTKViewport.js, init the labelmapDataObject like this:

if (!labelmapDataObject) {
      labelmapDataObject = createLabelMapImageData(this.imageDataObject);
    }

Second, set the painting to true in View2D.js, vtkPaintWidget will be enabled, so we can stroke sth on the viewport

this.viewWidget.onEndInteractionEvent(() => {
            const strokeBufferPromise = this.paintFilter.endStroke();

            if (this.props.onPaintEnd) {
              strokeBufferPromise.then(strokeBuffer => {
                this.props.onPaintEnd(strokeBuffer);
              });
            }
          })

but strokeBufferPromise never be resolved, I debug into the PaintFilter/index.js,

publicAPI.endStroke = () => {
    let endStrokePromise;

    if (workerPromise) {
      endStrokePromise = workerPromise.exec('end');

      endStrokePromise.then((strokeBuffer) => {
        publicAPI.applyBinaryMask(strokeBuffer);
        worker.terminate();
        worker = null;
        workerPromise = null;
      });
    }
    return endStrokePromise;
  };

endStrokePromise also can't be resolved.

I run the react-vtkjs-viewport example, the endStrokePromise works fine, the stokeBuffer can be returned. something wrong in OHIF's dependencies?

swederik commented 3 years ago

I think I've run into something similar when using the UMD version, since it couldn't find the worker to dynamically import. Are you using the UMD or PWA version?

StevenRoger commented 3 years ago

At that point, what kind of version should i use? And how to fix it?

sedghi commented 1 year ago

We have just shipped the segmentation mode which uses brushes if you need. https://ohif.org/release-notes/3p7