Viewers icon indicating copy to clipboard operation
Viewers copied to clipboard

[Bug] cameraPosition sync works weirdly when orientation is not specified

Open m00n620 opened this issue 1 year ago • 4 comments

Describe the Bug

cameraPosition synchronizing is not working, series are super zoomed in custom hanging protocol.

Here's the viewports configuration in custom hanging protocol.

viewports: [
  {
    viewportOptions: {
      viewportId: 'mip-0',
      viewportType: 'volume',
      // orientation: 'axial',
      toolGroupId: 'mip',
      initialImageOptions: {
        preset: 'middle',
      },
      syncGroups: [
        {
          type: 'cameraPosition',
          id: 'axialSync',
          source: true,
          target: true,
        },
        {
          type: 'voi',
          id: 'wlSync',
          source: true,
          target: true,
        },
      ],
    },
    displaySets: [
      {
        id: 'activeDisplaySet',
      },
    ],
  },
  {
    viewportOptions: {
      viewportId: 'mip-1',
      viewportType: 'volume',
      // orientation: 'axial',
      toolGroupId: 'mip',
      initialImageOptions: {
        preset: 'middle',
      },
      syncGroups: [
        {
          type: 'cameraPosition',
          id: 'axialSync',
          source: true,
          target: true,
        },
        {
          type: 'voi',
          id: 'wlSync',
          source: true,
          target: true,
        },
      ],
    },
    displaySets: [
      {
        id: 'activeDisplaySet',
        options: {
          blendMode: 'MIP',
          slabThickness: 5,
        },
      },
    ],
  },
]

But, if I enable the orientation, everything works correctly.

However, I want to use the protocol for all orientations(axial, coronal and sagittal).

Steps to Reproduce

  1. Enable custom hanging protocol(1x2).
  2. Drag Series 1 into Viewport 1, everything works fine.
  3. Drag Series 2 into Viewport 1, still fine.
  4. Drag Series 1 again into Viewport 1, the viewport loses the zoom level, images are super zoomed.

The current behavior

The viewport loses the zoom level, images are super zoomed when orientation is not specified.

The expected behavior

cameraPosition sync should be working whenever orientation is set or not.

OS

Windows 11

Node version

18.16.0

Browser

Chrome 120.0.6099.217

m00n620 avatar Mar 13 '24 14:03 m00n620

I tried to reproduce it but can't, can you please add more details or ideally more code?

sedghi avatar Mar 15 '24 14:03 sedghi

This is our custom hanging protocol. We are turn this on/off using toggleHangingProtocol like MPR.

export const mip: Types.HangingProtocol.Protocol = {
  id: 'mip',
  name: 'mip',
  imageLoadStrategy: 'nth',
  protocolMatchingRules: [],
  callbacks: {
    // Switches out of MIP mode when the layout change button is used
    onLayoutChange: [
      {
        commandName: 'toggleHangingProtocol',
        commandOptions: { protocolId: 'mip' },
        context: 'DEFAULT',
      },
    ],
    // Turns off crosshairs when switching out of MPR mode
    // onProtocolExit: [
    //   {
    //     commandName: 'cleanUpCrosshairs',
    //   },
    // ],
  },
  displaySetSelectors: {
    activeDisplaySet: {
      seriesMatchingRules: [
        {
          weight: 1,
          attribute: 'isReconstructable',
          constraint: {
            equals: {
              value: true,
            },
          },
          required: true,
        },
      ],
    },
  },
  stages: [
    {
      name: '2D MIP',
      viewportStructure: {
        layoutType: 'grid',
        properties: {
          rows: 1,
          columns: 2,
          layoutOptions: [
            {
              x: 0,
              y: 0,
              width: 1 / 2,
              height: 1,
            },
            {
              x: 1 / 2,
              y: 0,
              width: 1 / 2,
              height: 1,
            },
          ],
        },
      },
      viewports: [
        {
          viewportOptions: {
            toolGroupId: 'mip',
            viewportType: 'volume',
            initialImageOptions: {
              preset: 'middle',
            },
            syncGroups: [
              {
                type: 'cameraPosition',
                id: 'mip-sync-cameraPosition',
                source: true,
                target: true,
              },
              {
                type: 'voi',
                id: 'mip-sync-voi',
                source: true,
                target: true,
              },
            ],
          },
          displaySets: [
            {
              id: 'activeDisplaySet',
            },
          ],
        },
        {
          viewportOptions: {
            toolGroupId: 'mip',
            viewportType: 'volume',
            initialImageOptions: {
              preset: 'middle',
            },
            syncGroups: [
              {
                type: 'cameraPosition',
                id: 'mip-sync-cameraPosition',
                source: true,
                target: true,
              },
              {
                type: 'voi',
                id: 'mip-sync-voi',
                source: true,
                target: true,
              },
            ],
          },
          displaySets: [
            {
              id: 'activeDisplaySet',
              options: {
                blendMode: 'MIP',
                slabThickness: 5,
              },
            },
          ],
        },
      ],
    },
  ],
};

m00n620 avatar Mar 18 '24 21:03 m00n620

seems like when we are storing the presentations, it does it one by one and by the time that we store the first (left) viewport, the left viewport gets a new displayset and the synchronizer try to sync the right (old layout) camera with the new display set(left), and as a result an incorrect presentation will get saved for the right viewport at the exit

sedghi avatar Mar 21 '24 14:03 sedghi

@sedghi , can you please share the timeline for this bug?

m00n620 avatar Mar 22 '24 16:03 m00n620