Skip to content

Commit 519228b

Browse files
Merge branch 'main' into dask_live_viewer
2 parents 209facd + ed6cdc8 commit 519228b

File tree

16 files changed

+69
-68
lines changed

16 files changed

+69
-68
lines changed

.github/actions/publish-package/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ runs:
3131
conda config --set always_yes yes --set changeps1 no
3232
# Install build requirements
3333
# We can't use the makefile target for this because the CONDA_ACTIVATE command is incompatible with GitHub Actions Windows runners
34-
conda create -n build-env --yes boa anaconda-client conda-verify
34+
conda create -n build-env --yes boa anaconda-client
3535
conda activate build-env
3636
# Configure the conda channels
3737
conda config --env $(cat environment.yml | sed -ne '/channels:/,/dependencies:/{//!p}' | grep '^ -' | sed 's/ - / --append channels /g' | tr -d '\n')

.github/workflows/cos7_testing.yml renamed to .github/workflows/rocky_testing.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Testing with CentOS 7 docker
1+
name: Testing with Rocky docker
22

33
on:
44
push:
@@ -16,42 +16,42 @@ concurrency:
1616

1717
jobs:
1818
test:
19-
# It is hosted on Ubuntu but the docker image is built on CentOS 7
19+
# It is hosted on Ubuntu but the docker image is built on Rocky
2020
runs-on: ubuntu-latest
2121

2222
steps:
2323
- uses: actions/checkout@v4
2424

2525
- name: Pre-load docker image
26-
run: docker pull ghcr.io/mantidproject/mantidimaging:centos7
26+
run: docker pull ghcr.io/mantidproject/mantidimaging:rocky8
2727

2828
- name: List versions
2929
uses: ./.github/actions/test
3030
with:
3131
command: python --version; conda list ; pip list
32-
label: centos7
32+
label: rocky8
3333

3434
- name: yapf
3535
uses: ./.github/actions/test
3636
with:
3737
command: yapf --parallel --diff --recursive .
38-
label: centos7
38+
label: rocky8
3939

4040
- name: ruff
4141
uses: ./.github/actions/test
4242
with:
4343
command: ruff check .
44-
label: centos7
44+
label: rocky8
4545

4646
- name: mypy
4747
uses: ./.github/actions/test
4848
with:
4949
command: mypy --ignore-missing-imports mantidimaging
50-
label: centos7
50+
label: rocky8
5151

5252
- name: pytest
5353
timeout-minutes: 5
5454
uses: ./.github/actions/test
5555
with:
5656
command: xvfb-run pytest -n auto -o log_cli=true --ignore=mantidimaging/eyes_tests --durations=10
57-
label: centos7
57+
label: rocky8

conda/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ source:
1313
requirements:
1414
build:
1515
- python=3.12.*
16-
- setuptools=62.*
16+
- setuptools=72.*
1717
run:
1818
- python=3.12.*
1919
- pip

docker/Makefile

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Requirements
1717
------------
1818

1919
Operating system
20-
- Linux. Tested on Ubuntu 18.04, 20.04, 22.04 and CentOS 7
20+
- Linux. Tested on Ubuntu 18.04, 20.04, 22.04 and Rocky 8
2121
- Windows. Tested on Windows 10
2222

2323
GPU
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#2273: Display the modified image timestamp within the live viewer to allow for easier determination of what scan is being displayed within the live viewer.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#2285: Resolve operations windows crop co-ordinates ROI size from being larger than stack bounds. Additionally resolve ROI crop co-ordinate dialog window persistence if parent window closed.

mantidimaging/eyes_tests/live_viewer_window_test.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
# Copyright (C) 2024 ISIS Rutherford Appleton Laboratory UKRI
22
# SPDX - License - Identifier: GPL-3.0-or-later
3-
from __future__ import annotations
43

4+
from __future__ import annotations
5+
from typing import TYPE_CHECKING
56
from unittest import mock
6-
77
import numpy as np
8-
8+
import os
99
from mantidimaging.core.operations.loader import load_filter_packages
1010
from mantidimaging.gui.windows.live_viewer.model import Image_Data
1111
from mantidimaging.test_helpers.unit_test_helper import FakeFSTestCase
1212
from pathlib import Path
13-
1413
from mantidimaging.eyes_tests.base_eyes import BaseEyesTest
1514

15+
if TYPE_CHECKING:
16+
import time # noqa: F401
17+
1618

1719
class LiveViewerWindowTest(FakeFSTestCase, BaseEyesTest):
1820

21+
def __init__(self, *args, **kwargs):
22+
super().__init__(*args, **kwargs)
23+
self.initial_time = 4000.0
24+
1925
@classmethod
2026
def setUpClass(cls) -> None:
2127
super().setUpClass()
@@ -30,26 +36,30 @@ def setUp(self) -> None:
3036
def _generate_image(self):
3137
image = np.zeros((10, 10))
3238
image[5, :] = np.arange(10)
39+
os.utime(self.live_directory, (10, self.initial_time))
40+
self.initial_time += 1000
3341
return image
3442

3543
def _make_simple_dir(self, directory: Path):
3644
file_list = [directory / f"abc_{i:06d}.tif" for i in range(5)]
37-
if not directory.exists():
38-
self.fs.create_dir(directory)
39-
45+
increment = 0
4046
for file in file_list:
4147
self.fs.create_file(file)
48+
os.utime(file, (10, self.initial_time + increment))
49+
increment += 1000
4250

4351
return file_list
4452

4553
@mock.patch('mantidimaging.gui.windows.live_viewer.model.ImageWatcher')
46-
def test_live_view_opens_without_data(self, _mock_image_watcher):
54+
@mock.patch("time.time", return_value=4000.0)
55+
def test_live_view_opens_without_data(self, _mock_time, _mock_image_watcher):
4756
self.imaging.show_live_viewer(self.live_directory)
4857
self.check_target(widget=self.imaging.live_viewer)
4958

5059
@mock.patch('mantidimaging.gui.windows.live_viewer.presenter.LiveViewerWindowPresenter.load_image')
5160
@mock.patch('mantidimaging.gui.windows.live_viewer.model.ImageWatcher')
52-
def test_live_view_opens_with_data(self, _mock_image_watcher, mock_load_image):
61+
@mock.patch("time.time", return_value=4000.0)
62+
def test_live_view_opens_with_data(self, _mock_time, _mock_image_watcher, mock_load_image):
5363
file_list = self._make_simple_dir(self.live_directory)
5464
image_list = [Image_Data(path) for path in file_list]
5565
mock_load_image.return_value = self._generate_image()
@@ -59,7 +69,8 @@ def test_live_view_opens_with_data(self, _mock_image_watcher, mock_load_image):
5969

6070
@mock.patch('mantidimaging.gui.windows.live_viewer.presenter.LiveViewerWindowPresenter.load_image')
6171
@mock.patch('mantidimaging.gui.windows.live_viewer.model.ImageWatcher')
62-
def test_live_view_opens_with_bad_data(self, _mock_image_watcher, mock_load_image):
72+
@mock.patch("time.time", return_value=4000.0)
73+
def test_live_view_opens_with_bad_data(self, _mock_time, _mock_image_watcher, mock_load_image):
6374
file_list = self._make_simple_dir(self.live_directory)
6475
image_list = [Image_Data(path) for path in file_list]
6576
mock_load_image.side_effect = ValueError
@@ -69,7 +80,8 @@ def test_live_view_opens_with_bad_data(self, _mock_image_watcher, mock_load_imag
6980

7081
@mock.patch('mantidimaging.gui.windows.live_viewer.presenter.LiveViewerWindowPresenter.load_image')
7182
@mock.patch('mantidimaging.gui.windows.live_viewer.model.ImageWatcher')
72-
def test_rotate_operation_rotates_image(self, _mock_image_watcher, mock_load_image):
83+
@mock.patch("time.time", return_value=4000.0)
84+
def test_rotate_operation_rotates_image(self, _mock_time, _mock_image_watcher, mock_load_image):
7385
file_list = self._make_simple_dir(self.live_directory)
7486
image_list = [Image_Data(path) for path in file_list]
7587
mock_load_image.return_value = self._generate_image()

mantidimaging/gui/test/gui_system_operations_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
ALLOWED_ERRORS = [
5050
'Negative values found in result preview for slice 0.',
5151
'Flat-fielding completed. Slices containing negative values in IMAT_Flower_Tomo_000000: all slices.',
52-
'Error applying filter for preview: could not broadcast input array from shape (1,80,80) into shape (1,90,90)'
5352
]
5453

5554

mantidimaging/gui/widgets/mi_image_view/view.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import TYPE_CHECKING
88
from collections.abc import Callable
99

10-
from PyQt5.QtCore import Qt
10+
from PyQt5.QtCore import Qt, QRectF
1111
from PyQt5.QtWidgets import QApplication, QHBoxLayout, QLabel, QPushButton, QSizePolicy
1212
from pyqtgraph import ROI, ImageItem, ImageView, ViewBox
1313
from pyqtgraph.GraphicsScene.mouseEvents import HoverEvent
@@ -148,6 +148,9 @@ def angles(self, angles: ProjectionAngles | None) -> None:
148148
self._angles = angles
149149
self._update_message(self._last_mouse_hover_location)
150150

151+
def _set_roi_max_bounds(self):
152+
self.roi.maxBounds = QRectF(0, 0, self.image_data.shape[2], self.image_data.shape[1])
153+
151154
def setImage(self, image: np.ndarray, *args, **kwargs):
152155
dimensions_changed = self.image_data is None or self.image_data.shape != image.shape
153156
if image.ndim == 3:
@@ -195,6 +198,7 @@ def roiChanged(self) -> None:
195198
roi = self._update_roi_region_avg()
196199
if self.roi_changed_callback and roi is not None:
197200
self.roi_changed_callback(roi)
201+
self._set_roi_max_bounds()
198202
self._refresh_message()
199203

200204
def _update_roi_region_avg(self) -> SensibleROI | None:

0 commit comments

Comments
 (0)