Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add simple multi-monitor support #4178

Merged
merged 44 commits into from
Jan 13, 2025
Merged

Conversation

wayfarer3130
Copy link
Contributor

@wayfarer3130 wayfarer3130 commented May 27, 2024

Note

We plan to enhance this service in the future. Currently, it offers a basic implementation of multi-monitor support, allowing you to manually open multiple windows on the same monitor or separate monitor. It is not yet a full multi-monitor solution!

The multi-monitor service provides detection, launch, and communication support for multiple monitors or windows/screens within a single monitor.

Note

The multi-monitor service is currently applied via a configuration file.

customizationService: ['@ohif/extension-default.customizationModule.multimonitor'],

Configurations

The service supports two predefined configurations:

  1. Split Screen (multimonitor=split)
    Splits the primary monitor into two windows.

  2. Multi-Monitor (multimonitor=2)
    Opens windows across separate physical monitors.

Launch Methods

  • Specify &screenNumber=0 to designate the first window explicitly.
  • Omit screenNumber to let the service handle window assignments dynamically.
  • Use launchAll in the query parameters to launch all configured screens simultaneously.

Example URLs:

  • Split Screen:
    http://viewer.ohif.org/.....&multimonitor=split
    Splits the primary monitor into two windows when a study is viewed.

  • Multi-Monitor with All Screens:
    http://viewer.ohif.org/.....&multimonitor=2&screenNumber=0&launchAll
    Launches two monitors and opens all configured screens.


Behavior

Refresh, Close and Open

If you refresh the base/original window, then all the other windows will also
refresh. However, you can safely refresh any single other window, and on the next
command to the other windows, it will re-create the other window links without
losing content in the other windows. You can also close any other window and
it will be reopened the next time you try to call to it.

Executing Commands

The MultiMonitorService adds the ability to run commands on other specified windows.
This allows opening up a study on another window without needing to refresh
it's contents. The command below shows an example of how this can be done:

Copy link

netlify bot commented May 27, 2024

Deploy Preview for ohif-platform-docs ready!

Name Link
🔨 Latest commit fb94570
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/678533306766ac000815d457
😎 Deploy Preview https://deploy-preview-4178--ohif-platform-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented May 27, 2024

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit fb94570
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/678533304d1d9800087a88a1
😎 Deploy Preview https://deploy-preview-4178--ohif-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@wayfarer3130
Copy link
Contributor Author

In the starting phase, launch a study using multimonitor=split
This will show in the current window
Select the all button to show all studies for a patient, and click on the launch study button on the right hand side of the study list:
image

@wayfarer3130
Copy link
Contributor Author

This results in a second page being displayed with the specified study:
image

@wayfarer3130
Copy link
Contributor Author

You can then navigate either window from the 'all' studies in the study browser tab.

Study navigation currently refreshes the page, which loses the position on that page, plus any markup/annotations you have created. This is a temporary issue while the navigation is updated to use internal navigation to preserve data.

Copy link

cypress bot commented May 27, 2024

Viewers    Run #4684

Run Properties:  status check passed Passed #4684  •  git commit fb9457065e: revert
Project Viewers
Branch Review feat/multi-monitor-take2
Run status status check passed Passed #4684
Run duration 02m 06s
Commit git commit fb9457065e: revert
Committer sedghi
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 44
View all changes introduced in this branch ↗︎

}

public run(screenDelta = 1, commands, options) {
const screenNumber = (this.screenNumber + (screenDelta ?? 1)) % this.numberOfScreens;
Copy link

@salkz salkz Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using negative delta to run commands from window 2 into window 1 feels a bit weird I think. I could see explicit screen id being more intuitive. Or what's the use case with delta?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use case is really left/right windows or "other window" for the two window use case.

this.isMultimonitor = false;
}

public run(screenDelta = 1, commands, options) {
Copy link

@salkz salkz Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts about a function that would run commands and options in all windows except the origin from which it was called?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, future enhancement. This is baby steps to get started.

.webpack/webpack.base.js Outdated Show resolved Hide resolved
sedghi and others added 7 commits January 13, 2025 10:17
…ommand execution

- Added a new type `RunInput` to enhance input flexibility for the `run` and `runAsync` methods.
- Implemented a private `validate` method to check and convert input commands, improving error handling and logging.
- Simplified the `run` and `runAsync` methods to utilize the new validation logic, ensuring consistent command execution and returning results as arrays.
- Enhanced code readability and maintainability by reducing redundancy in command processing.

Co-authored-by: Bill Wallace <[email protected]>
- Added a note indicating future enhancements for the Multi Monitor Service.
- Clarified the current capabilities of the service, emphasizing its basic implementation of multi-monitor support.
- Improved overall documentation clarity and user guidance.

This update aims to inform users about the service's limitations and upcoming features.
Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot
@salkz I added some notes to the documentation of the service we're just starting. It's not a complete multi-monitor implementation, but I believe it's good enough to be merged.

@sedghi sedghi merged commit 07c628e into master Jan 13, 2025
19 of 20 checks passed
@sedghi sedghi deleted the feat/multi-monitor-take2 branch January 22, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants