Skip to content
Snippets Groups Projects
Commit 0d235a2d authored by casagran's avatar casagran
Browse files

add roi selection

parent 474a52e7
No related branches found
No related tags found
1 merge request!6Draft: Resolve "py-bkg-rm"
......@@ -148,16 +148,13 @@ class ROISelectionWidget(qt.QWidget):
def applyRoi(self):
"""
todo update all docs here
Function to apply the region of interest at the data of the dataset
and show the new data in the stack. Dataset data is not yet replaced.
A new roi is created in the middle of the new stack.
"""
self.roi = RectangleROI()
self.roi.setGeometry(origin=self.getRoi().getOrigin(), size=self.getRoi().getSize())
# self._update_dataset = self.dataset.apply_roi(size=numpy.flip(self.roi.getSize()),
# center=numpy.flip(self.roi.getCenter()))
# self.setStack(self._update_dataset)
# self.resetROI()
def apply(self):
"""
......@@ -207,7 +204,6 @@ class RoiSelectionWidgetOW(OWWidget):
icon = "icons/one_round.png"
want_main_area = False
# Inputs/Outputs
class Inputs:
data = Input("data", ndarray)
colormap = Input("colormap", Colormap)
......@@ -215,10 +211,7 @@ class RoiSelectionWidgetOW(OWWidget):
class Outputs:
roi_origin = Output("roi_origin", list)
roi_size = Output("roi_size", list)
# data = Output("data", ndarray)
# colormap = Output("colormap", Colormap)
# Settings
roi_origin = Setting(list(), schema_only=True)
roi_size = Setting(list(), schema_only=True)
......@@ -235,28 +228,19 @@ class RoiSelectionWidgetOW(OWWidget):
self._widget.setDataset(data)
else:
self._widget.clearStack()
# Emit None
self.Outputs.roi.send(None)
# Set saved roi
if len(self.roi_origin) and len(self.roi_size):
self._widget.setRoi(origin=self.roi_origin, size=self.roi_size)
# self.open()
@Inputs.colormap
def setColormap(self, colormap):
self._widget.setStackViewColormap(colormap)
def _sendSignal(self, roi_origin=[], roi_size=[]):
"""
Emits the signal with the new data.
"""
"""Emits the signal with the new data."""
self.close()
self.roi_origin = roi_origin
self.roi_size = roi_size
self.Outputs.roi_origin.send(self.roi_origin)
self.Outputs.roi_size.send(self.roi_size)
# roi = (tuple(self.origin), (self.origin[0] + self.roi_size[0], self.origin[1] + self.roi_size[1]))
# self.Outputs.dataset.send(self._widget.getDataset())
# self.Outputs.colormap.send(self._widget.getStackViewColormap())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment