OHIF / Viewers

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

[Bug] Mutiple enter and exit of full view viewport make image shifting #4056

Open salimkanoun opened 5 months ago

salimkanoun commented 5 months ago

Describe the Bug

See this video, in TMTV mode (ex : https://viewer-dev.ohif.org/tmtv?StudyInstanceUIDs=1.3.6.1.4.1.14519.5.2.1.7009.2403.871108593056125491804754960339) If make a fusion viewport full screen multiple time, the image seems to pan and shift outside viewport

https://github.com/OHIF/Viewers/assets/25229822/aac74133-4906-4ef4-9e77-a6568f166940

Interestingly it happens only for fused viewport

Steps to Reproduce

See video

The current behavior

image is panning more and more at each full screen exit

The expected behavior

image position shall be fixed

OS

Linux

Node version

20

Browser

Chrome latest

sedghi commented 3 months ago

And there was another issue where I don't remeber where we discussed that PT becomes infront of the CT and then sometimes CT is in front

sedghi commented 3 months ago

Probably the issue is in the getPan in getPresentation here

  private performResize() {
    const isImmediate = false;

    try {
      const viewports = this.getRenderingEngine().getViewports();

      // Store the current position presentations for each viewport.
      viewports.forEach(({ id }) => {
        const presentation = this.getPositionPresentation(id);
        this.beforeResizePositionPresentations.set(id, presentation);
      });

      // Resize the rendering engine and render.
      const renderingEngine = this.renderingEngine;
      renderingEngine.resize(isImmediate);
      renderingEngine.render();

      // Reset the camera for viewports that should reset their camera on resize,
      // which means only those viewports that have a zoom level of 1.
      this.beforeResizePositionPresentations.forEach((positionPresentation, viewportId) => {
        this.setPresentations(viewportId, { positionPresentation });
      });

      // Resize and render the rendering engine again.
      renderingEngine.resize(isImmediate);
      renderingEngine.render();
    } catch (e) {
      // This can happen if the resize is too close to navigation or shutdown
      console.warn('Caught resize exception', e);
    }
  }
IbrahimCSAE commented 3 months ago

@salimkanoun I was not able to replicate the image shifting bug, are you still able to? I will work on something else for now.

salimkanoun commented 3 months ago

It doesn't shit anymore, bug there is now the bug reported by @sedghi about colomap invert in fusion viewport, and also the pan is lost on the axial and coronal viewport (and same problem for zoom)

https://github.com/OHIF/Viewers/assets/25229822/0f86d16f-9ab0-4eeb-833b-d7de2a257265

03shek commented 3 months ago

@sedghi we're seeing the fusion row show only the PET in TMTV mode in our deployed version after using W/L on the PET. Can you comment if the comment immediately after you mentioned "PT becomes infront of the CT and then sometimes CT is in front" is the fix for it? We don't see the issue on viewer-dev.ohif.org @ beta.31, so wondering what version the problem had started (and was fixed?)

EDIT: Nevermind :) Found fix in fix #4113 committed to beta.32