Skip to content

Commit

Permalink
Fix bug with image quick load
Browse files Browse the repository at this point in the history
Signed-off-by: Brianna Major <[email protected]>
  • Loading branch information
bnmajor committed Dec 20, 2023
1 parent 3dbf837 commit 83b124d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hexrdgui/load_images_dialog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections import Counter # To compare two lists' contents
import re
import os
from pathlib import Path

from PySide6.QtWidgets import QMessageBox, QTableWidgetItem, QComboBox
from hexrdgui.constants import TRANSFORM_OPTIONS
Expand Down Expand Up @@ -49,13 +50,14 @@ def exec(self):
if self.ui.exec():
# Perform some validation before returning
results = self.results()
image_files = [v for f in results.values() for v in f]
matches = [Path(v).name for f in results.values() for v in f]
image_files = [Path(f).name for f in self.image_files]
if Counter(results.keys()) != Counter(self.detectors):
msg = 'Detectors do not match the current detectors'
QMessageBox.warning(self.ui, 'HEXRD', msg)
continue
elif (not self.using_roi and
Counter(image_files) != Counter(self.image_files)):
(Counter(matches) != Counter(image_files))):
msg = 'Image files do not match the selected files'
QMessageBox.warning(self.ui, 'HEXRD', msg)
continue
Expand Down Expand Up @@ -182,7 +184,7 @@ def results(self):
det_idx = i
if not self.using_roi:
imgs_per_det = len(self.image_files) / len(self.detectors)
det_idx = i // imgs_per_det
det_idx = int(i / imgs_per_det)
HexrdConfig().load_panel_state['trans'][det_idx] = idx

return results
Expand Down

0 comments on commit 83b124d

Please sign in to comment.