Commit 8abe583d authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[gui][roi] Use same directory for consecutive roi applies

parent dcef57ae
Pipeline #45616 passed with stage
in 4 minutes and 9 seconds
......@@ -61,6 +61,7 @@ class ROISelectionWidget(qt.QWidget):
self.indices = None
self.bg_indices = None
self.bg_dataset = None
self._original_dataset = True
self.setLayout(qt.QVBoxLayout())
self._sv = StackViewMainWindow()
......@@ -179,8 +180,10 @@ class ROISelectionWidget(qt.QWidget):
self.roi = RectangleROI()
self.roi.setGeometry(origin=self.getRoi().getOrigin(), size=self.getRoi().getSize())
self.thread = OperationThread(self, self._update_dataset.apply_roi)
roi_dir = self._update_dataset.dir if not self._original_dataset else None
self.thread.setArgs(size=numpy.flip(self.roi.getSize()),
center=numpy.flip(self.roi.getCenter()))
center=numpy.flip(self.roi.getCenter()),
roi_dir=roi_dir)
self.thread.finished.connect(self._updateData)
self.thread.start()
......@@ -199,6 +202,7 @@ class ROISelectionWidget(qt.QWidget):
self._okB.setEnabled(True)
if self.thread.data:
self._update_dataset = self.thread.data
self._original_dataset = False
assert self._update_dataset is not None
self.setStack(self._update_dataset)
self.resetROI()
......@@ -218,7 +222,7 @@ class ROISelectionWidget(qt.QWidget):
def getDataset(self):
bg_dataset = (self.bg_dataset.apply_roi(size=numpy.flip(self.roi.getSize()),
center=numpy.flip(self.roi.getCenter()))
center=numpy.flip(self.roi.getCenter()))
if self.bg_dataset is not None else None)
return self._update_dataset, self.indices, self.bg_indices, bg_dataset
......@@ -254,6 +258,7 @@ class ROISelectionWidget(qt.QWidget):
"""
self.roi = None
self._update_dataset = self.dataset
self._original_dataset = True
self.setStack(self.dataset)
def clearStack(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment