Commit 5e8f4e6a authored by payno's avatar payno

[orange add-on][roiselection] add Setting

parent 4b146b4b
...@@ -33,7 +33,7 @@ from silx.gui import qt ...@@ -33,7 +33,7 @@ from silx.gui import qt
from Orange.canvas.registry.description import InputSignal, OutputSignal from Orange.canvas.registry.description import InputSignal, OutputSignal
from Orange.widgets import gui from Orange.widgets import gui
from Orange.widgets.widget import OWWidget from Orange.widgets.widget import OWWidget
from Orange.widgets.settings import Setting
from id06workflow.core.experiment import Experiment from id06workflow.core.experiment import Experiment
from id06workflow.core.operation.roi import RoiOperation from id06workflow.core.operation.roi import RoiOperation
from id06workflow.gui.roiselection import ROIOnStackView from id06workflow.gui.roiselection import ROIOnStackView
...@@ -63,6 +63,9 @@ class RoiSelectionOW(OWWidget): ...@@ -63,6 +63,9 @@ class RoiSelectionOW(OWWidget):
resizing_enabled = True resizing_enabled = True
compress_signal = False compress_signal = False
_roi_origin = Setting(tuple())
_roi_size = Setting(tuple())
def __init__(self): def __init__(self):
super().__init__() super().__init__()
...@@ -83,6 +86,11 @@ class RoiSelectionOW(OWWidget): ...@@ -83,6 +86,11 @@ class RoiSelectionOW(OWWidget):
# expose API # expose API
self.setROI = self._widget.setROI self.setROI = self._widget.setROI
if len(self._roi_size) is 2:
self._widget.getROI().setSize(size=self._roi_size)
if len(self._roi_origin) is 2:
self._widget.getROI().setOrigin(self._roi_origin)
def _process(self, experiment): def _process(self, experiment):
if experiment.dataset is None or experiment.dataset.is_valid() is False: if experiment.dataset is None or experiment.dataset.is_valid() is False:
_logger.warning('cannot process roi selection, need a valid dataset for this') _logger.warning('cannot process roi selection, need a valid dataset for this')
...@@ -116,3 +124,11 @@ class RoiSelectionOW(OWWidget): ...@@ -116,3 +124,11 @@ class RoiSelectionOW(OWWidget):
else: else:
OWWidget.accept(self) OWWidget.accept(self)
# TODO: what can be the image to send to show roi selection (z sum ?) # TODO: what can be the image to send to show roi selection (z sum ?)
def updateProperties(self):
# as dim are named tuple we have to cast them to dict
self._roi_origin = tuple(self._widget.getROI().getOrigin())
self._roi_size = tuple(self._widget.getROI().getSize())
print(self._roi_origin)
print(self._roi_size)
Markdown is supported
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