How to prevent cross reference lines from rendering where the FrameOfReferenceUID does not match?

Describe Your Question

When I load multiple studies the cross reference lines are drawn between images that have different FrameOfReferenceUIDs. One of the studies has standard MR images; the other multiframe enhanced MR.

I tried changing the code in extensions/cornerstone/src/commandsModule.ts to limit the calls to the rendering engine to viewports with data containing the same FrameOfReferenceUID - but this did not work:

    setSourceViewportForReferenceLinesTool: ({ viewportId }) => {
      
      if (!viewportId) {
        const { activeViewportId } = viewportGridService.getState();
        viewportId = activeViewportId ?? 'default';
      }

      const toolGroup = toolGroupService.getToolGroupForViewport(viewportId);

      toolGroup?.setToolConfiguration(
        ReferenceLinesTool.toolName,
        {
          sourceViewportId: viewportId,
        },
        true // overwrite
      );

      const renderingEngine = cornerstoneViewportService.getRenderingEngine();
      // debugger
      const frame_of_reference_uid = renderingEngine.getViewport(viewportId).getFrameOfReferenceUID()
      console.log('frame_of_reference_uid ' + frame_of_reference_uid)
      if (frame_of_reference_uid){
        renderingEngine.renderFrameOfReference(frame_of_reference_uid);
      }
      else{
         renderingEngine.render();
      }
    },

I’m using 3.9.0-beta.74

What steps can we follow to reproduce the bug?

  1. Load OHIF Viewer for patient Neptune - there are two CT studies for this patient.
  2. Make the layout 2x2
  3. Click on the All button in the study panel to show the second study.
  4. From the second study - drag an axial image over to one of the panels where there is already an axial image.
  5. Scroll the new axial image. The cross reference line on the localizer is in the wrong location.

I really like that the images can be synced together for scrolling with different FrameOfReferenceUIDs - by turning syncing on and off you can register them pretty well. But for my app I’d like to turn off the cross reference lines when scrolling the images from a different study. Is this possible?