Skip to content

Commit

Permalink
selected ROI updates when sample changed
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeSullivan7 committed Feb 20, 2024
1 parent e3e65d4 commit a34a968
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions mantidimaging/gui/windows/spectrum_viewer/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def handle_sample_change(self, uuid: Optional['UUID']) -> None:
self.add_rits_roi()
self.view.set_normalise_error(self.model.normalise_issue())
self.show_new_sample()
self.view.on_visibility_change()

def handle_normalise_stack_change(self, normalise_uuid: Optional['UUID']) -> None:
if normalise_uuid == self.current_norm_stack_uuid:
Expand Down
12 changes: 8 additions & 4 deletions mantidimaging/gui/windows/spectrum_viewer/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ def on_visibility_change(self) -> None:
if self.presenter.export_mode == ExportMode.IMAGE_MODE:
self.set_roi_alpha(255, ROI_RITS)
self.presenter.redraw_spectrum(ROI_RITS)
self.last_clicked_roi = self.current_roi
if self.current_roi != ROI_RITS:
self.last_clicked_roi = self.current_roi
self.current_roi = ROI_RITS
for _, spinbox in self.roiPropertiesSpinBoxes.items():
spinbox.setEnabled(True)
Expand Down Expand Up @@ -447,11 +448,12 @@ def set_binning_visibility(self) -> None:
self.bin_step_spinBox.setHidden(hide_binning)

def set_roi_properties(self) -> None:
for spinbox in self.roiPropertiesSpinBoxes.values():
spinbox.setEnabled(True)
if self.presenter.export_mode == ExportMode.IMAGE_MODE:
self.current_roi = ROI_RITS
current_roi = self.presenter.model.get_roi(self.current_roi)
if self.current_roi not in self.presenter.model.get_list_of_roi_names() or not self.roiPropertiesSpinBoxes:
return
else:
current_roi = self.presenter.model.get_roi(self.current_roi)
self.roiPropertiesGroupBox.setTitle(f"Roi Properties: {self.current_roi}")
roi_iter_order = ["Left", "Top", "Right", "Bottom"]
for row, pos in enumerate(current_roi):
Expand All @@ -461,6 +463,8 @@ def set_roi_properties(self) -> None:
self.presenter.redraw_spectrum(self.current_roi)
self.roiPropertiesLabels["Width"].setText(str(current_roi.width))
self.roiPropertiesLabels["Height"].setText(str(current_roi.height))
for spinbox in self.roiPropertiesSpinBoxes.values():
spinbox.setEnabled(True)

def adjust_roi(self) -> None:
roi_iter_order = ["Left", "Top", "Right", "Bottom"]
Expand Down

0 comments on commit a34a968

Please sign in to comment.