feat(multimonitor): Add simple multi-monitor support to open another study(#4178)

This commit is contained in:
Bill Wallace authored and GitHub committed 2025-01-13 10:49:08 -05:00
1 parent a4a6de07f4
commit 07c628e689
49 files changed
+1476 -367

No files matched your search

@@ -1,4 +1,7 @@
import { Types } from '@ohif/core';
import { studyWithImages } from './utils/studySelectors';
import { seriesWithImages } from './utils/seriesSelectors';
import { viewportOptions } from './utils/viewportOptions';
/**
* Sync group configuration for hydrating segmentations across viewports
@@ -21,41 +24,15 @@ export const HYDRATE_SEG_SYNC_GROUP = {
* `&hangingProtocolId=@ohif/mnGrid` added to the viewer URL
* It is not included in the viewer mode by default.
*/
const hpMN: Types.HangingProtocol.Protocol = {
export const hpMN: Types.HangingProtocol.Protocol = {
id: '@ohif/mnGrid',
description: 'Has various hanging protocol grid layouts',
name: '2x2',
protocolMatchingRules: [
{
id: 'OneOrMoreSeries',
weight: 25,
attribute: 'numberOfDisplaySetsWithImages',
constraint: {
greaterThan: 0,
},
},
],
protocolMatchingRules: studyWithImages,
toolGroupIds: ['default'],
displaySetSelectors: {
defaultDisplaySetId: {
seriesMatchingRules: [
{
attribute: 'numImageFrames',
constraint: {
greaterThan: { value: 0 },
},
required: true,
},
// This display set will select the specified items by preference
// It has no affect if nothing is specified in the URL.
{
attribute: 'isDisplaySetFromUrl',
weight: 20,
constraint: {
equals: true,
},
},
],
seriesMatchingRules: seriesWithImages,
},
},
defaultViewport: {
@@ -90,21 +67,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
},
viewports: [
{
viewportOptions: {
toolGroupId: 'default',
allowUnmatchedView: true,
syncGroups: [
{
type: 'hydrateseg',
id: 'sameFORId',
source: true,
target: true,
options: {
matchingRules: ['sameFOR'],
},
},
],
},
viewportOptions,
displaySets: [
{
id: 'defaultDisplaySetId',
@@ -112,10 +75,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
],
},
{
viewportOptions: {
toolGroupId: 'default',
allowUnmatchedView: true,
},
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 1,
@@ -124,21 +84,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
],
},
{
viewportOptions: {
toolGroupId: 'default',
allowUnmatchedView: true,
syncGroups: [
{
type: 'hydrateseg',
id: 'sameFORId',
source: true,
target: true,
// options: {
// matchingRules: ['sameFOR'],
// },
},
],
},
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 2,
@@ -147,21 +93,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
],
},
{
viewportOptions: {
toolGroupId: 'default',
allowUnmatchedView: true,
syncGroups: [
{
type: 'hydrateseg',
id: 'sameFORId',
source: true,
target: true,
// options: {
// matchingRules: ['sameFOR'],
// },
},
],
},
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 3,
@@ -174,11 +106,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
// 3x1 stage
{
id: '3x1',
// Obsolete settings:
requiredViewports: 1,
preferredViewports: 3,
// New equivalent:
name: '3x1',
stageActivation: {
enabled: {
minViewportsMatched: 3,
@@ -193,10 +121,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
},
viewports: [
{
viewportOptions: {
toolGroupId: 'default',
allowUnmatchedView: true,
},
viewportOptions,
displaySets: [
{
id: 'defaultDisplaySetId',
@@ -204,10 +129,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
],
},
{
viewportOptions: {
toolGroupId: 'default',
allowUnmatchedView: true,
},
viewportOptions,
displaySets: [
{
id: 'defaultDisplaySetId',
@@ -216,10 +138,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
],
},
{
viewportOptions: {
toolGroupId: 'default',
allowUnmatchedView: true,
},
viewportOptions,
displaySets: [
{
id: 'defaultDisplaySetId',
@@ -232,9 +151,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
// A 2x1 stage
{
id: '2x1',
requiredViewports: 1,
preferredViewports: 2,
name: '2x1',
stageActivation: {
enabled: {
minViewportsMatched: 2,
@@ -249,10 +166,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
},
viewports: [
{
viewportOptions: {
toolGroupId: 'default',
allowUnmatchedView: true,
},
viewportOptions,
displaySets: [
{
id: 'defaultDisplaySetId',
@@ -260,10 +174,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
],
},
{
viewportOptions: {
toolGroupId: 'default',
allowUnmatchedView: true,
},
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 1,
@@ -276,9 +187,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
// A 1x1 stage - should be automatically activated if there is only 1 viewable instance
{
id: '1x1',
requiredViewports: 1,
preferredViewports: 1,
name: '1x1',
stageActivation: {
enabled: {
minViewportsMatched: 1,
@@ -293,10 +202,7 @@ const hpMN: Types.HangingProtocol.Protocol = {
},
viewports: [
{
viewportOptions: {
toolGroupId: 'default',
allowUnmatchedView: true,
},
viewportOptions,
displaySets: [
{
id: 'defaultDisplaySetId',
@@ -309,4 +215,341 @@ const hpMN: Types.HangingProtocol.Protocol = {
numberOfPriorsReferenced: -1,
};
/**
* This hanging protocol can be activated on the primary mode by directly
* referencing it in a URL or by directly including it within a mode, e.g.:
* `&hangingProtocolId=@ohif/mnGrid8` added to the viewer URL
* It is not included in the viewer mode by default.
*/
export const hpMN8: Types.HangingProtocol.Protocol = {
...hpMN,
id: '@ohif/mnGrid8',
description: 'Has various hanging protocol grid layouts up to 4x2',
name: '4x2',
stages: [
{
id: '4x2',
name: '4x2',
stageActivation: {
enabled: {
minViewportsMatched: 7,
},
},
viewportStructure: {
layoutType: 'grid',
properties: {
rows: 2,
columns: 4,
},
},
viewports: [
{
viewportOptions,
displaySets: [
{
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 1,
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 2,
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 3,
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 4,
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 5,
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 6,
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 7,
id: 'defaultDisplaySetId',
},
],
},
],
},
{
id: '3x2',
name: '3x2',
stageActivation: {
enabled: {
minViewportsMatched: 5,
},
},
viewportStructure: {
layoutType: 'grid',
properties: {
rows: 2,
columns: 3,
},
},
viewports: [
{
viewportOptions,
displaySets: [
{
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 1,
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 2,
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 3,
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 4,
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 5,
id: 'defaultDisplaySetId',
},
],
},
],
},
...hpMN.stages,
],
};
/**
* This hanging protocol extends the default protocol with additional
* images on the second monitor. It assumes the first four images are shown
* on monitor 0
*/
export const hpMNMonitor2: Types.HangingProtocol.Protocol = {
...hpMN,
id: '@ohif/mnGridMonitor2',
description: 'Second monitor HP with 2x2 grid',
name: '2x2 Monitor 2',
stages: [
{
id: '2x2',
name: '2x2',
stageActivation: {
enabled: {
minViewportsMatched: 3,
},
},
viewportStructure: {
layoutType: 'grid',
properties: {
rows: 2,
columns: 2,
},
},
viewports: [
{
viewportOptions,
displaySets: [
{
id: 'defaultDisplaySetId',
matchedDisplaySetsIndex: 4,
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 5,
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 6,
id: 'defaultDisplaySetId',
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 7,
id: 'defaultDisplaySetId',
},
],
},
],
},
// A 2x1 stage
{
name: '2x1',
stageActivation: {
enabled: {
minViewportsMatched: 1,
},
},
viewportStructure: {
layoutType: 'grid',
properties: {
rows: 1,
columns: 2,
},
},
viewports: [
{
viewportOptions,
displaySets: [
{
id: 'defaultDisplaySetId',
matchedDisplaySetsIndex: 4,
},
],
},
{
viewportOptions,
displaySets: [
{
matchedDisplaySetsIndex: 5,
id: 'defaultDisplaySetId',
},
],
},
],
},
{
name: '1x1',
stageActivation: {
enabled: {
minViewportsMatched: 0,
},
},
viewportStructure: {
layoutType: 'grid',
properties: {
rows: 1,
columns: 1,
},
},
viewports: [
{
viewportOptions,
displaySets: [
{
id: 'defaultDisplaySetId',
matchedDisplaySetsIndex: 4,
},
],
},
],
},
{
name: '1x1 Base',
stageActivation: {
enabled: {
minViewportsMatched: 1,
},
},
viewportStructure: {
layoutType: 'grid',
properties: {
rows: 1,
columns: 1,
},
},
viewports: [
{
viewportOptions,
displaySets: [
{
id: 'defaultDisplaySetId',
matchedDisplaySetsIndex: 0,
},
],
},
],
},
],
};
export default hpMN;
@@ -7,7 +7,7 @@ import {
LCCPrior,
RMLOPrior,
LMLOPrior,
} from './mammoDisplaySetSelector';
} from './utils/mammoDisplaySetSelector';
const rightDisplayArea = {
storeAsInitialCamera: true,
@@ -1,9 +1,10 @@
import viewCodeAttribute from './viewCode';
import lateralityAttribute from './laterality';
import registerHangingProtocolAttributes from './registerHangingProtocolAttributes';
import viewCodeAttribute from './utils/viewCode';
import lateralityAttribute from './utils/laterality';
import registerHangingProtocolAttributes from './utils/registerHangingProtocolAttributes';
import hpMammography from './hpMammo';
import hpMNGrid from './hpMNGrid';
import hpCompare from './hpCompare';
export * from './hpMNGrid';
export {
viewCodeAttribute,
@@ -0,0 +1,23 @@
import { Types } from '@ohif/core';
type MatchingRule = Types.HangingProtocol.MatchingRule;
export const seriesWithImages: MatchingRule[] = [
{
attribute: 'numImageFrames',
constraint: {
greaterThan: { value: 0 },
},
weight: 1,
required: true,
},
// This display set will select the specified items by preference
// It has no affect if nothing is specified in the URL.
{
attribute: 'isDisplaySetFromUrl',
weight: 20,
constraint: {
equals: true,
},
},
];
@@ -0,0 +1,14 @@
import { Types } from '@ohif/core';
type MatchingRule = Types.HangingProtocol.MatchingRule;
export const studyWithImages: MatchingRule[] = [
{
id: 'OneOrMoreSeries',
weight: 25,
attribute: 'numberOfDisplaySetsWithImages',
constraint: {
greaterThan: 0,
},
},
];
@@ -0,0 +1,18 @@
/** A default viewport options */
export const viewportOptions = {
toolGroupId: 'default',
allowUnmatchedView: true,
syncGroups: [
{
type: 'hydrateseg',
id: 'sameFORId',
source: true,
target: true,
options: {
matchingRules: ['sameFOR'],
},
},
],
};
export const hydrateSegDefault = viewportOptions;