Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into 2001_Live_Viewer_brightness_adjustment
  • Loading branch information
MikeSullivan7 committed Jan 29, 2024
2 parents 467cb77 + bd75526 commit 81b6d86
Show file tree
Hide file tree
Showing 15 changed files with 162 additions and 18 deletions.
13 changes: 11 additions & 2 deletions .github/actions/publish-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ inputs:
repository:
description: 'Anaconda repository'
required: true
default: 'mantidimaging'
repository-old:
description: 'Anaconda repository - old'
required: true
default: 'mantid'
label:
description: 'Label'
Expand All @@ -12,6 +16,9 @@ inputs:
token:
description: 'Anaconda API Token'
required: true
token-old:
description: 'Anaconda API Token - old'
required: true

description: Build conda package
runs:
Expand All @@ -35,8 +42,10 @@ runs:
shell: bash -l {0}
run: |
conda activate build-env
conda config --set anaconda_upload yes
conda config --set anaconda_upload no
# if the upload silently fails - check the token expiration. Conda can fail silently!
conda mambabuild --user ${{ inputs.repository }} --token ${{ inputs.token }} --label ${{ inputs.label }} $GITHUB_WORKSPACE/conda |& tee upload.log
conda mambabuild $GITHUB_WORKSPACE/conda
anaconda -t ${{ inputs.token }} upload --user ${{ inputs.repository }} --label ${{ inputs.label }} ${CONDA_PREFIX}/conda-bld/*/mantidimaging*.tar.bz2 |& tee upload.log
anaconda -t ${{ inputs.token-old }} upload --user ${{ inputs.repository-old }} --label ${{ inputs.label }} ${CONDA_PREFIX}/conda-bld/*/mantidimaging*.tar.bz2
# Check that upload completed
grep "Upload complete" upload.log
3 changes: 2 additions & 1 deletion .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,5 @@ jobs:
uses: ./.github/actions/publish-package
with:
label: unstable
token: ${{ secrets.ANACONDA_API_TOKEN }}
token: ${{ secrets.ANACONDA_API_TOKEN_MANTIDIMAGING }}
token-old: ${{ secrets.ANACONDA_API_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,5 @@ jobs:
uses: ./.github/actions/publish-package
with:
label: unstable
token: ${{ secrets.ANACONDA_API_TOKEN }}
token: ${{ secrets.ANACONDA_API_TOKEN_MANTIDIMAGING }}
token-old: ${{ secrets.ANACONDA_API_TOKEN }}
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
<div align="center">
<a href="https://mantidproject.github.io/mantidimaging/">
<img src="images/mantid_imaging_64px.ico" alt="Logo" width="80" height="80">
</a>

<h1 align="center">MantidImaging</h1>

<p align="center" style="font-size: 18px">
<strong>A graphical toolkit for 3D reconstruction of neutron tomography data</strong>
<br />
<br />
<a href="https://mantidproject.github.io/mantidimaging/"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://anaconda.org/mantid/mantidimaging"><b>Anaconda Package</b></a>
·
<a href="https://github.com/mantidproject/mantidimaging"><b>Code Repository</b></a>
·
<a href="https://www.jiscmail.ac.uk/cgi-bin/wa-jisc.exe?SUBED1=MANTID-IMAGING-ANNOUNCE&A=1"><b>Release Mailing List</b></a>
</p>
</div>

# MantidImaging

Mantid Imaging is a graphical toolkit for performing 3D reconstruction of neutron tomography data. It provides an easy-to-use graphical interface to a wide range of pre/post-processing operations, tilt correction and reconstruction algorithms, accommodating for tomography users with varying data complexity and image analysis background knowledge. It utilises a flexible plugin system that allows easy integration of external software, and has allowed us to re-use software widely known in the neutron tomography community.

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4728059.svg)](https://doi.org/10.5281/zenodo.4728059)
[![Coverage Status](https://coveralls.io/repos/github/mantidproject/mantidimaging/badge.svg?branch=main)](https://coveralls.io/github/mantidproject/mantidimaging?branch=main)

## Links

- Documentation: https://mantidproject.github.io/mantidimaging/
- Anaconda package: https://anaconda.org/mantid/mantidimaging
- Code repository: https://github.com/mantidproject/mantidimaging
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ Please cite as:
Tasev, Dimitar; Akello-Egwel, Dolica; Allen, Jack; Baust, Rachel; Gigg, Martyn; Jones, Samuel; Nixon, Daniel; Stock, Samuel; Taylor, Will; Tygier, Sam. (2023). Mantid Imaging (2.5.0), Zenodo https://doi.org/10.5281/zenodo.4728059

(See `Zenodo <https://doi.org/10.5281/zenodo.4728059>`_ for citing specific versions).

Sign up to our `mailing list <https://www.jiscmail.ac.uk/cgi-bin/wa-jisc.exe?SUBED1=MANTID-IMAGING-ANNOUNCE&A=1>`_ to receive updates on the project
2 changes: 2 additions & 0 deletions docs/release_notes/next/feature-1943-RITS-transmission-error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#1943 : RITS export transmission errors

2 changes: 2 additions & 0 deletions docs/release_notes/next/fix-2002-default-values
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#2002 : Better default values in Remove all stripes

5 changes: 5 additions & 0 deletions docs/support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ Issues can be reported on the `Github project page <https://github.com/mantidpro

The developers can be contacted at
[email protected]

Release Updates
===============

Sign up to our `mailing list <https://www.jiscmail.ac.uk/cgi-bin/wa-jisc.exe?SUBED1=MANTID-IMAGING-ANNOUNCE&A=1>`_ to receive updates on the project
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,23 @@ def register_gui(form, on_change, view):

_, la_size = add_property_to_form('Large stripe kernel',
Type.INT,
default_value=61,
default_value=21,
valid_values=(1, 100),
form=form,
on_change=on_change,
tooltip="Window size of the median filter to remove large stripes.")

_, sm_size = add_property_to_form('Small stripe kernel',
Type.INT,
default_value=21,
default_value=7,
valid_values=(1, 100),
form=form,
on_change=on_change,
tooltip="Window size of the median filter to remove small-to-medium stripes.")

_, dim = add_property_to_form('Dimension of the window',
Type.INT,
default_value=1,
default_value=2,
valid_values=(1, 2),
form=form,
on_change=on_change,
Expand Down
65 changes: 64 additions & 1 deletion mantidimaging/gui/ui/spectrum_viewer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,75 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="image_output_mode">
<widget class="QComboBox" name="image_output_mode_combobox">
<item>
<property name="text">
<string>Single Spectrum</string>
</property>
</item>
<item>
<property name="text">
<string>2D Binned</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Error Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="transmission_error_mode_combobox">
<item>
<property name="text">
<string>Standard Deviation</string>
</property>
</item>
<item>
<property name="text">
<string>Propagated</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="bin_size_label">
<property name="text">
<string>Bin Size</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="bin_size_spinBox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="bin_step_label">
<property name="text">
<string>Bin Step</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="bin_step_spinBox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item>
Expand Down
11 changes: 9 additions & 2 deletions mantidimaging/gui/windows/spectrum_viewer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@ class SpecType(Enum):


class ErrorMode(Enum):
STANDARD_DEVIATION = 1
PROPAGATED = 2
STANDARD_DEVIATION = "Standard Deviation"
PROPAGATED = "Propagated"

@classmethod
def get_by_value(cls, value: str) -> ErrorMode:
for element in cls:
if element.value == value:
return element
raise ValueError(f"Unknown error mode: {value}")


class SpectrumViewerWindowModel:
Expand Down
3 changes: 2 additions & 1 deletion mantidimaging/gui/windows/spectrum_viewer/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ def handle_rits_export(self) -> None:
return
if path.suffix != ".dat":
path = path.with_suffix(".dat")
self.model.save_rits(path, self.spectrum_mode == SpecType.SAMPLE_NORMED, ErrorMode.STANDARD_DEVIATION)
error_mode = ErrorMode.get_by_value(self.view.transmission_error_mode)
self.model.save_rits(path, self.spectrum_mode == SpecType.SAMPLE_NORMED, error_mode)

def handle_enable_normalised(self, enabled: bool) -> None:
if enabled:
Expand Down
5 changes: 5 additions & 0 deletions mantidimaging/gui/windows/spectrum_viewer/test/model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,3 +406,8 @@ def test_WHEN_stack_tof_THEN_tof_correct(self):
tof_result = self.model.get_stack_time_of_flight()
self.assertIsInstance(tof_result, np.ndarray)
npt.assert_array_equal(tof_result, np.arange(0, 10) * 0.1)

def test_error_modes(self):
self.assertEqual(ErrorMode.get_by_value("Standard Deviation"), ErrorMode.STANDARD_DEVIATION)
self.assertEqual(ErrorMode.get_by_value("Propagated"), ErrorMode.PROPAGATED)
self.assertRaises(ValueError, ErrorMode.get_by_value, "")
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def test_handle_export_csv(self, path_name: str, mock_save_csv: mock.Mock):
@mock.patch("mantidimaging.gui.windows.spectrum_viewer.model.SpectrumViewerWindowModel.save_rits")
def test_handle_rits_export(self, path_name: str, mock_save_rits: mock.Mock):
self.view.get_rits_export_filename = mock.Mock(return_value=Path(path_name))
self.view.transmission_error_mode = "Standard Deviation"

self.presenter.model.set_stack(generate_images())

Expand Down
31 changes: 30 additions & 1 deletion mantidimaging/gui/windows/spectrum_viewer/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QCheckBox, QVBoxLayout, QFileDialog, QPushButton, QLabel, QAbstractItemView, QHeaderView, \
QTabWidget
QTabWidget, QComboBox, QSpinBox

from mantidimaging.core.utility import finder
from mantidimaging.gui.mvp_base import BaseMainWindowView
Expand Down Expand Up @@ -36,6 +36,10 @@ class SpectrumViewerWindowView(BaseMainWindowView):
normaliseErrorIcon: QLabel
_current_dataset_id: Optional['UUID']
normalise_error_issue: str = ""
image_output_mode_combobox: QComboBox
transmission_error_mode_combobox: QComboBox
bin_size_spinBox: QSpinBox
bin_step_spinBox: QSpinBox

def __init__(self, main_window: 'MainWindowView'):
super().__init__(None, 'gui/ui/spectrum_viewer.ui')
Expand Down Expand Up @@ -67,6 +71,8 @@ def __init__(self, main_window: 'MainWindowView'):
self.normaliseCheckBox.stateChanged.connect(self.presenter.handle_button_enabled)

self.exportTabs.currentChanged.connect(self.presenter.handle_export_tab_change)
self.image_output_mode_combobox.currentTextChanged.connect(self.set_binning_visibility)
self.set_binning_visibility()

# ROI action buttons
self.addBtn.clicked.connect(self.set_new_roi)
Expand Down Expand Up @@ -305,3 +311,26 @@ def clear_all_rois(self) -> None:
self.spectrum.spectrum_data_dict = {}
self.spectrum.spectrum.clearPlots()
self.removeBtn.setEnabled(False)

@property
def transmission_error_mode(self) -> str:
return self.transmission_error_mode_combobox.currentText()

@property
def image_output_mode(self) -> str:
return self.image_output_mode_combobox.currentText()

@property
def bin_size(self) -> int:
return self.bin_size_spinbox.value()

@property
def bin_step(self) -> int:
return self.bin_step_spinbox.value()

def set_binning_visibility(self) -> None:
hide_binning = self.image_output_mode != "2D Binned"
self.bin_size_label.setHidden(hide_binning)
self.bin_size_spinBox.setHidden(hide_binning)
self.bin_step_label.setHidden(hide_binning)
self.bin_step_spinBox.setHidden(hide_binning)

0 comments on commit 81b6d86

Please sign in to comment.