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

Live Viewer calculates intensity of live images via QThreads #2457

Merged
merged 26 commits into from
Jan 23, 2025

Conversation

MikeSullivan7
Copy link
Collaborator

@MikeSullivan7 MikeSullivan7 commented Jan 14, 2025

Issue

Closes #2448

Description

The calculation of the Intensity Profile in the Live Viewer is now done asynchronously via a QThread and the GUI is updated via the main thread upon the QThread termination. The intensity is calculated in chunks of 100 points, each done via a different thread. It is done in this way so that the GUI will remain responsive and smooth while the ROI is moved on the image, all while the intensity updates to the new position. The calculation speed is also increased by using the ImageCache class.
Unit and System tests have been added for the Live Viewer.

This PR will require PR #2425 after which this PR will need to be rebased.

Testing

make check
make test-system

Acceptance Criteria

Check that all tests pass.

  1. Open Live Viewer
  2. Right click -> Operations -> Calculate Intensity
  3. Ensure that the Intensity plot opens, the ROI is visible, and that the intensity is plotted correctly (check against known data)
  4. Move and resize the ROI and check that the Intensity plot updates smoothly with no GUI interruption.

Documentation

Release Note

@MikeSullivan7 MikeSullivan7 force-pushed the 2448_live_viewer_spectrum_async branch from cc43f76 to c53660e Compare January 14, 2025 15:49
@coveralls
Copy link

coveralls commented Jan 14, 2025

Coverage Status

coverage: 73.114% (-0.5%) from 73.612%
when pulling 660ec9a on 2448_live_viewer_spectrum_async
into dd5949f on main.

@MikeSullivan7 MikeSullivan7 marked this pull request as ready for review January 15, 2025 13:29
@MikeSullivan7 MikeSullivan7 changed the title 2448 live viewer spectrum async Live Viewer calculates intensity of live images via QThreads Jan 15, 2025
Copy link
Collaborator

@samtygier-stfc samtygier-stfc left a comment

Choose a reason for hiding this comment

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

Looking good from a first pass, here are some requests for the code.

mantidimaging/gui/test/gui_system_base.py Outdated Show resolved Hide resolved
mantidimaging/gui/windows/live_viewer/live_view_widget.py Outdated Show resolved Hide resolved
mantidimaging/gui/windows/live_viewer/live_view_widget.py Outdated Show resolved Hide resolved
mantidimaging/gui/windows/live_viewer/model.py Outdated Show resolved Hide resolved
mantidimaging/gui/windows/live_viewer/model.py Outdated Show resolved Hide resolved
mantidimaging/gui/windows/live_viewer/model.py Outdated Show resolved Hide resolved
mantidimaging/gui/windows/live_viewer/model.py Outdated Show resolved Hide resolved
mantidimaging/gui/windows/live_viewer/model.py Outdated Show resolved Hide resolved
mantidimaging/gui/windows/live_viewer/presenter.py Outdated Show resolved Hide resolved
mantidimaging/gui/windows/live_viewer/test/model_test.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@samtygier-stfc samtygier-stfc left a comment

Choose a reason for hiding this comment

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

Looking good. I couple of code nitpicks.

I hit a couple of issues when running the simulate script in slow mode --mode slow, but I'd be happy to merge this and fix those after.

mantidimaging/eyes_tests/live_viewer_window_test.py Outdated Show resolved Hide resolved
mantidimaging/gui/windows/live_viewer/model.py Outdated Show resolved Hide resolved
mantidimaging/gui/windows/live_viewer/live_view_widget.py Outdated Show resolved Hide resolved
@MikeSullivan7 MikeSullivan7 force-pushed the 2448_live_viewer_spectrum_async branch 8 times, most recently from ebfbdb0 to 25001e0 Compare January 22, 2025 17:06
@MikeSullivan7 MikeSullivan7 force-pushed the 2448_live_viewer_spectrum_async branch from 25001e0 to 660ec9a Compare January 23, 2025 15:26
Copy link
Collaborator

@samtygier-stfc samtygier-stfc left a comment

Choose a reason for hiding this comment

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

Looks good. I have tested locally.

There are a few issues to be done as separate PRs, #2469 #2474

@samtygier-stfc samtygier-stfc added this pull request to the merge queue Jan 23, 2025
Merged via the queue into main with commit e6f10f6 Jan 23, 2025
8 checks passed
@samtygier-stfc samtygier-stfc deleted the 2448_live_viewer_spectrum_async branch January 23, 2025 16:21
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.

Calculate Live Viewer Spectrum asynchronously
3 participants