fix: bugs after multimonitor (#4680)

This commit is contained in:
Alireza 2025-01-13 18:32:54 -05:00 committed by GitHub
parent 7662157cbf
commit c901a847af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 5 additions and 254 deletions

View File

@ -1,81 +0,0 @@
export const studyBrowserContextMenu = {
id: 'StudyBrowser.studyContextMenu',
customizationType: 'ohif.contextMenu',
menus: [
{
id: 'studyBrowserContextMenu',
// selector restricts context menu to when there is nearbyToolData
items: [
{
label: 'Show in Grid',
commands: {
commandName: 'loadStudy',
commandOptions: {
commands: {
commandName: 'setHangingProtocol',
commandOptions: {
protocolId: '@ohif/mnGrid8',
},
},
},
},
},
{
label: 'Show in other monitor',
selector: ({ isMultimonitor }) => isMultimonitor,
commands: {
commandName: 'multimonitor',
commandOptions: {
commands: {
commandName: 'loadStudy',
commandOptions: {
commands: {
commandName: 'setHangingProtocol',
commandOptions: {
protocolId: '@ohif/mnGrid8',
},
},
},
},
},
},
},
{
label: 'Compare All',
selector: ({ isMultimonitor }) => isMultimonitor,
commands: [
{
commandName: 'loadStudy',
commandOptions: {
commands: {
commandName: 'setHangingProtocol',
commandOptions: {
protocolId: '@ohif/mnGrid',
},
},
},
},
{
commandName: 'multimonitor',
commandOptions: {
commands: {
commandName: 'loadStudy',
commandOptions: {
commands: {
commandName: 'setHangingProtocol',
commandOptions: {
protocolId: '@ohif/mnGridMonitor2',
},
},
},
},
},
},
],
},
],
},
],
};
export default studyBrowserContextMenu;

View File

@ -5,7 +5,6 @@ import { ProgressDropdownWithService } from './Components/ProgressDropdownWithSe
import DataSourceConfigurationComponent from './Components/DataSourceConfigurationComponent'; import DataSourceConfigurationComponent from './Components/DataSourceConfigurationComponent';
import { GoogleCloudDataSourceConfigurationAPI } from './DataSourceConfigurationAPI/GoogleCloudDataSourceConfigurationAPI'; import { GoogleCloudDataSourceConfigurationAPI } from './DataSourceConfigurationAPI/GoogleCloudDataSourceConfigurationAPI';
import { utils } from '@ohif/core'; import { utils } from '@ohif/core';
import studyBrowserContextMenu from './customizations/studyBrowserContextMenu';
import { import {
DropdownMenuSub, DropdownMenuSub,
DropdownMenuSubTrigger, DropdownMenuSubTrigger,
@ -215,7 +214,6 @@ export default function getCustomizationModule({ servicesManager, extensionManag
return clonedObject; return clonedObject;
}, },
}, },
studyBrowserContextMenu,
{ {
// the generic GUI component to configure a data source using an instance of a BaseDataSourceConfigurationAPI // the generic GUI component to configure a data source using an instance of a BaseDataSourceConfigurationAPI

View File

@ -1,4 +1,4 @@
import { hpMN, hpMN8, hpMNMonitor2 } from './hangingprotocols/hpMNGrid'; import { hpMN, hpMN8 } from './hangingprotocols/hpMNGrid';
import hpMNCompare from './hangingprotocols/hpCompare'; import hpMNCompare from './hangingprotocols/hpCompare';
import hpMammography from './hangingprotocols/hpMammo'; import hpMammography from './hangingprotocols/hpMammo';
import hpScale from './hangingprotocols/hpScale'; import hpScale from './hangingprotocols/hpScale';
@ -149,10 +149,6 @@ function getHangingProtocolModule() {
name: hpMN8.id, name: hpMN8.id,
protocol: hpMN8, protocol: hpMN8,
}, },
{
name: hpMNMonitor2.id,
protocol: hpMNMonitor2,
},
]; ];
} }

View File

@ -393,163 +393,4 @@ export const hpMN8: Types.HangingProtocol.Protocol = {
], ],
}; };
/**
* 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; export default hpMN;

View File

@ -218,7 +218,7 @@ export class CommandsManager {
* @param options - to include in the commands run beyond * @param options - to include in the commands run beyond
* the commandOptions specified in the base. * the commandOptions specified in the base.
*/ */
public run(input: RunInput, options: Record<string, unknown> = {}): unknown[] { public run(input: RunInput, options: Record<string, unknown> = {}): unknown {
const commands = this.validate(input, options); const commands = this.validate(input, options);
const results: unknown[] = []; const results: unknown[] = [];
@ -228,14 +228,11 @@ export class CommandsManager {
results.push(this.runCommand(commandName, commandOptions, context)); results.push(this.runCommand(commandName, commandOptions, context));
} }
return results; return results.length === 1 ? results[0] : results;
} }
/** Like run, but await each command before continuing */ /** Like run, but await each command before continuing */
public async runAsync( public async runAsync(input: RunInput, options: Record<string, unknown> = {}): Promise<unknown> {
input: RunInput,
options: Record<string, unknown> = {}
): Promise<unknown[]> {
const commands = this.validate(input, options); const commands = this.validate(input, options);
const results: unknown[] = []; const results: unknown[] = [];
@ -245,7 +242,7 @@ export class CommandsManager {
results.push(await this.runCommand(commandName, commandOptions, context)); results.push(await this.runCommand(commandName, commandOptions, context));
} }
return results; return results.length === 1 ? results[0] : results;
} }
} }