diff --git a/docs/release_notes/next/feature-2094-Load_ShutterCount_files_front-end b/docs/release_notes/next/feature-2094-Load_ShutterCount_files_front-end new file mode 100644 index 00000000000..897d04ff2ae --- /dev/null +++ b/docs/release_notes/next/feature-2094-Load_ShutterCount_files_front-end @@ -0,0 +1 @@ +#2094: Front-end for loading ShutterCount files into Mantid Imaging. \ No newline at end of file diff --git a/mantidimaging/core/io/instrument_log.py b/mantidimaging/core/io/instrument_log.py index bec1786537e..5fb642ca994 100644 --- a/mantidimaging/core/io/instrument_log.py +++ b/mantidimaging/core/io/instrument_log.py @@ -246,6 +246,3 @@ def pulse_per_shutter_range_numbers(self) -> np.ndarray[Any, Any]: def has_Pulse(self) -> bool: return ShutterCountColumn.PULSE in self.data - - def raise_if_counts_missing(self): - pass diff --git a/mantidimaging/core/utility/data_containers.py b/mantidimaging/core/utility/data_containers.py index 872bc4e5787..8be4df8040f 100644 --- a/mantidimaging/core/utility/data_containers.py +++ b/mantidimaging/core/utility/data_containers.py @@ -143,11 +143,11 @@ class FILE_TYPES(Enum): DARK_AFTER = ("Dark", "After", "images") PROJ_180 = ("180 degree", "", "180") SAMPLE_LOG = ("Sample Log", "", "log") - FLAT_BEFORE_LOG = ("Flat Before Log", "", "log") - FLAT_AFTER_LOG = ("Flat After Log", "", "log") SHUTTER_COUNTS = ("Sample Shutter Counts", "", "ShutterCount") FLAT_BEFORE_SHUTTER_COUNTS = ("Flat Before Shutter Counts", "", "ShutterCount") FLAT_AFTER_SHUTTER_COUNTS = ("Flat After Shutter Counts", "", "ShutterCount") + FLAT_BEFORE_LOG = ("Flat Before Log", "", "log") + FLAT_AFTER_LOG = ("Flat After Log", "", "log") def __init__(self, tname: str, suffix: str, mode: str) -> None: self.tname = tname diff --git a/mantidimaging/gui/ui/image_load_dialog.ui b/mantidimaging/gui/ui/image_load_dialog.ui index b69e0a920d8..ca5a21a32fd 100644 --- a/mantidimaging/gui/ui/image_load_dialog.ui +++ b/mantidimaging/gui/ui/image_load_dialog.ui @@ -7,7 +7,7 @@ 0 0 690 - 497 + 530 @@ -129,24 +129,30 @@ - - Flat Before Log - - - - - - - - - - + + Sample Shutter Counts + - - Flat After Log - + + Flat Before Shutter Counts + + + + + Flat After Shutter Counts + + + + Flat Before Log + + + + + Flat After Log + + diff --git a/mantidimaging/gui/ui/main_window.ui b/mantidimaging/gui/ui/main_window.ui index e9e5f67babb..3d2b555b043 100644 --- a/mantidimaging/gui/ui/main_window.ui +++ b/mantidimaging/gui/ui/main_window.ui @@ -38,6 +38,7 @@ + @@ -189,6 +190,14 @@ Load log for stack... + + + false + + + Load ShutterCounts file for stack... + + false diff --git a/mantidimaging/gui/windows/image_load_dialog/presenter.py b/mantidimaging/gui/windows/image_load_dialog/presenter.py index 154b98a62ef..bc43029b2df 100644 --- a/mantidimaging/gui/windows/image_load_dialog/presenter.py +++ b/mantidimaging/gui/windows/image_load_dialog/presenter.py @@ -111,6 +111,12 @@ def do_update_shutter_counts(self, field: Field, selected_file: str) -> None: filename_group.find_shutter_count_file() field.set_images(list(filename_group.all_files())) self._update_field_action(field, selected_file) + self.ensure_sample_shuttercount_consistency(field, selected_file) + + def ensure_sample_shuttercount_consistency(self, field: Field, file_name: str) -> None: + if file_name is None or file_name == "": + return + self._update_field_action(field, file_name) def do_update_flat_or_dark(self, field: Field, selected_file: str) -> None: """ @@ -164,8 +170,7 @@ def _update_loading_param(self, file_type: FILE_TYPES, loading_param: LoadingPar if file_type in log_for_file_type: self._update_image_param(file_type, image_param, log_for_file_type, 'log_file') if file_type in shuttercounts_for_file_type: - # self._update_image_param(file_type, image_param, shuttercounts_for_file_type, 'shutter_count_file') - pass + self._update_image_param(file_type, image_param, shuttercounts_for_file_type, 'shutter_count_file') if file_type == FILE_TYPES.SAMPLE: image_param.indices = field.indices diff --git a/mantidimaging/gui/windows/image_load_dialog/view.py b/mantidimaging/gui/windows/image_load_dialog/view.py index dae32a67636..d23267ac97f 100644 --- a/mantidimaging/gui/windows/image_load_dialog/view.py +++ b/mantidimaging/gui/windows/image_load_dialog/view.py @@ -39,8 +39,6 @@ def __init__(self, parent: QWidget) -> None: self.tree.setTabKeyNavigation(True) for n, file_info in enumerate(FILE_TYPES): - if file_info.fname in ["Sample Shutter Counts", "Flat Before Shutter Counts", "Flat After Shutter Counts"]: - continue self.fields[file_info.fname] = self.create_file_input(n, file_info) self.sample = self.fields["Sample"] diff --git a/mantidimaging/gui/windows/main/view.py b/mantidimaging/gui/windows/main/view.py index 6b4f5011c79..b05d79b903d 100644 --- a/mantidimaging/gui/windows/main/view.py +++ b/mantidimaging/gui/windows/main/view.py @@ -88,6 +88,7 @@ class MainWindowView(BaseMainWindowView): actionSpectrumViewer: QAction actionLiveViewer: QAction actionSampleLoadLog: QAction + actionShutterCounts: QAction actionLoadProjectionAngles: QAction actionLoad180deg: QAction actionLoadDataset: QAction @@ -184,6 +185,7 @@ def setup_shortcuts(self): self.actionLoadImages.triggered.connect(self.load_image_stack) self.actionLoadNeXusFile.triggered.connect(self.show_nexus_load_dialog) self.actionSampleLoadLog.triggered.connect(self.load_sample_log_dialog) + self.actionShutterCounts.triggered.connect(self.load_shuttercounts_dialog) self.actionLoad180deg.triggered.connect(self.load_180_deg_dialog) self.actionLoadProjectionAngles.triggered.connect(self.load_projection_angles) self.actionSaveImages.triggered.connect(self.show_image_save_dialog) @@ -227,6 +229,7 @@ def update_shortcuts(self): self.actionSaveImages.setEnabled(has_datasets) self.actionSaveNeXusFile.setEnabled(has_strict_datasets) self.actionSampleLoadLog.setEnabled(has_datasets) + self.actionShutterCounts.setEnabled(has_datasets) self.actionLoad180deg.setEnabled(has_strict_datasets) self.actionLoadProjectionAngles.setEnabled(has_datasets) self.menuWorkflow.setEnabled(has_datasets)