Skip to content

Commit

Permalink
Merge bb2e2f4 into eae8b87
Browse files Browse the repository at this point in the history
  • Loading branch information
JackEAllen committed May 20, 2024
2 parents eae8b87 + bb2e2f4 commit 9f92dd3
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#2094: Front-end for loading ShutterCount files into Mantid Imaging.
3 changes: 0 additions & 3 deletions mantidimaging/core/io/instrument_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions mantidimaging/core/utility/data_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 22 additions & 16 deletions mantidimaging/gui/ui/image_load_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>690</width>
<height>497</height>
<height>530</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -129,24 +129,30 @@
</property>
</item>
<item>
<property name="text">
<string>Flat Before Log</string>
</property>
<property name="text">
<string/>
</property>
<property name="text">
<string/>
</property>
<property name="text">
<string/>
</property>
<property name="text">
<string>Sample Shutter Counts</string>
</property>
</item>
<item>
<property name="text">
<string>Flat After Log</string>
</property>
<property name="text">
<string>Flat Before Shutter Counts</string>
</property>
</item>
<item>
<property name="text">
<string>Flat After Shutter Counts</string>
</property>
</item>
<item>
<property name="text">
<string>Flat Before Log</string>
</property>
</item>
<item>
<property name="text">
<string>Flat After Log</string>
</property>
</item>
</widget>
</item>
<item>
Expand Down
9 changes: 9 additions & 0 deletions mantidimaging/gui/ui/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<addaction name="actionLoadImages"/>
<addaction name="actionLoadNeXusFile"/>
<addaction name="actionSampleLoadLog"/>
<addaction name="actionShutterCounts"/>
<addaction name="actionLoadProjectionAngles"/>
<addaction name="actionLoad180deg"/>
<addaction name="separator"/>
Expand Down Expand Up @@ -189,6 +190,14 @@
<string>Load log for stack...</string>
</property>
</action>
<action name="actionShutterCounts">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Load ShutterCounts file for stack...</string>
</property>
</action>
<action name="actionLoad180deg">
<property name="enabled">
<bool>false</bool>
Expand Down
9 changes: 7 additions & 2 deletions mantidimaging/gui/windows/image_load_dialog/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions mantidimaging/gui/windows/image_load_dialog/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
3 changes: 3 additions & 0 deletions mantidimaging/gui/windows/main/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class MainWindowView(BaseMainWindowView):
actionSpectrumViewer: QAction
actionLiveViewer: QAction
actionSampleLoadLog: QAction
actionShutterCounts: QAction
actionLoadProjectionAngles: QAction
actionLoad180deg: QAction
actionLoadDataset: QAction
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9f92dd3

Please sign in to comment.