Skip to content

Commit 3725229

Browse files
committed
added tabs for orientation
1 parent 3cb3665 commit 3725229

File tree

5 files changed

+215
-207
lines changed

5 files changed

+215
-207
lines changed

saenopy/gui/orientation/modules/BatchEvaluate.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
from saenopy.examples import get_examples_orientation
88
from .AddFilesDialog import AddFilesDialog
99
from saenopy.gui.common.AddFilesDialog import FileExistsDialog
10+
from .TabAngle import TabAngle
1011
from .TabCellOutline import TabCellOutline
12+
from .TabCoherence import TabCoherence
1113
from .TabOrientationField import TabOrientationField
1214
from .result import ResultOrientation, get_orientation_files
1315
from .Detection import DeformationDetector
@@ -33,7 +35,9 @@ def add_modules(self):
3335
self.modules = [self.sub_module_segmentation, self.sub_module_deformation]
3436

3537
self.tab1 = TabCellOutline(self)
36-
self.tab2 = TabOrientationField(self)
38+
self.tab2 = TabAngle(self)
39+
self.tab3 = TabCoherence(self)
40+
self.tab4 = TabOrientationField(self)
3741

3842
def add_measurement(self):
3943
last_decision = None
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
from saenopy.gui.common.TabModule import TabModule
2+
from saenopy.gui.orientation.modules.result import ResultOrientation
3+
from qtpy import QtCore, QtWidgets, QtGui
4+
from qimage2ndarray import array2qimage
5+
from saenopy.gui.common import QtShortCuts, QExtendedGraphicsView
6+
7+
from saenopy.gui.common.ModuleScaleBar import ModuleScaleBar
8+
from saenopy.gui.common.ModuleColorBar import ModuleColorBar
9+
from saenopy.gui.solver.modules.exporter.ExporterRender2D import render_2d
10+
11+
12+
class TabAngle(TabModule):
13+
result: ResultOrientation = None
14+
15+
def __init__(self, parent: "BatchEvaluate"):
16+
super().__init__(parent)
17+
18+
with self.parent.tabs.createTab("Angle (x-axis)") as self.tab:
19+
with QtShortCuts.QVBoxLayout() as layout:
20+
#self.label_tab = QtWidgets.QLabel(
21+
# "The deformations from the piv algorithm at every window where the crosscorrelation was evaluated.").addToLayout()
22+
23+
with QtShortCuts.QHBoxLayout() as layout:
24+
self.label = QExtendedGraphicsView.QExtendedGraphicsView().addToLayout()
25+
self.scale1 = ModuleScaleBar(self, self.label)
26+
self.color1 = ModuleColorBar(self, self.label)
27+
28+
self.pixmap = QtWidgets.QGraphicsPixmapItem(self.label.origin)
29+
self.contour = QtWidgets.QGraphicsPathItem(self.label.origin)
30+
pen = QtGui.QPen(QtGui.QColor(255, 0, 0))
31+
pen.setCosmetic(True)
32+
pen.setWidth(2)
33+
self.contour.setPen(pen)
34+
35+
def check_evaluated(self, result: ResultOrientation) -> bool:
36+
# whether the tab should be enabled for this Result object
37+
return self.result.orientation_map is not None
38+
39+
def update_display(self, *, plotter=None):
40+
if self.result is None:
41+
return
42+
im = render_2d({
43+
"image": {
44+
"scale": 1,
45+
"scale_overlay": 1,
46+
"antialiase": 1,
47+
"logo_size": 0,
48+
},
49+
"stack": {
50+
"image": 1,
51+
"channel": "cells",
52+
"colormap": "gray",
53+
"alpha": 1,
54+
"channel_B": "fibers",
55+
"colormap_B": "gray",
56+
"alpha_B": 1,
57+
"use_reference_stack": False,
58+
"contrast_enhance": None,
59+
"z_proj": False,
60+
"z": 0,
61+
"use_contrast_enhance": True,
62+
},
63+
"time": {
64+
"t": 0
65+
},
66+
"maps": "orientation_x_axis",
67+
"maps_cmap": "gist_rainbow",
68+
"maps_alpha": 0.5,
69+
70+
"colorbar": {
71+
"hide": True,
72+
},
73+
74+
"scalebar": {
75+
"hide": True,
76+
},
77+
"theme": "dark",
78+
}, self.result)
79+
self.pixmap.setPixmap(QtGui.QPixmap(array2qimage(im)))
80+
self.label.setExtend(im.shape[1], im.shape[0])
81+
self.scale1.setScale([self.result.pixel_size])
82+
self.color1.setScale(-90, 90, "gist_rainbow")
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
from saenopy.gui.common.TabModule import TabModule
2+
from saenopy.gui.orientation.modules.result import ResultOrientation
3+
from qtpy import QtCore, QtWidgets, QtGui
4+
from qimage2ndarray import array2qimage
5+
from saenopy.gui.common import QtShortCuts, QExtendedGraphicsView
6+
7+
from saenopy.gui.common.ModuleScaleBar import ModuleScaleBar
8+
from saenopy.gui.common.ModuleColorBar import ModuleColorBar
9+
from saenopy.gui.solver.modules.exporter.ExporterRender2D import render_2d
10+
11+
12+
class TabCoherence(TabModule):
13+
result: ResultOrientation = None
14+
15+
def __init__(self, parent: "BatchEvaluate"):
16+
super().__init__(parent)
17+
18+
with self.parent.tabs.createTab("Coherence") as self.tab:
19+
with QtShortCuts.QVBoxLayout() as layout:
20+
#self.label_tab = QtWidgets.QLabel(
21+
# "The deformations from the piv algorithm at every window where the crosscorrelation was evaluated.").addToLayout()
22+
23+
with QtShortCuts.QHBoxLayout() as layout:
24+
self.label = QExtendedGraphicsView.QExtendedGraphicsView().addToLayout()
25+
self.scale1 = ModuleScaleBar(self, self.label)
26+
self.color1 = ModuleColorBar(self, self.label)
27+
28+
self.pixmap = QtWidgets.QGraphicsPixmapItem(self.label.origin)
29+
self.contour = QtWidgets.QGraphicsPathItem(self.label.origin)
30+
pen = QtGui.QPen(QtGui.QColor(255, 0, 0))
31+
pen.setCosmetic(True)
32+
pen.setWidth(2)
33+
self.contour.setPen(pen)
34+
35+
def check_evaluated(self, result: ResultOrientation) -> bool:
36+
# whether the tab should be enabled for this Result object
37+
return self.result.orientation_map is not None
38+
39+
def update_display(self, *, plotter=None):
40+
if self.result is None:
41+
return
42+
im = render_2d({
43+
"image": {
44+
"scale": 1,
45+
"scale_overlay": 1,
46+
"antialiase": 1,
47+
"logo_size": 0,
48+
},
49+
"stack": {
50+
"image": 1,
51+
"channel": "cells",
52+
"colormap": "gray",
53+
"alpha": 1,
54+
"channel_B": "fibers",
55+
"colormap_B": "gray",
56+
"alpha_B": 1,
57+
"use_reference_stack": False,
58+
"contrast_enhance": None,
59+
"z_proj": False,
60+
"z": 0,
61+
"use_contrast_enhance": True,
62+
},
63+
"time": {
64+
"t": 0
65+
},
66+
"maps": "coherence",
67+
"maps_cmap": "turbo",
68+
"maps_alpha": 0.5,
69+
70+
"colorbar": {
71+
"hide": True,
72+
},
73+
74+
"scalebar": {
75+
"hide": True,
76+
},
77+
"theme": "dark",
78+
}, self.result)
79+
self.pixmap.setPixmap(QtGui.QPixmap(array2qimage(im)))
80+
self.label.setExtend(im.shape[1], im.shape[0])
81+
self.scale1.setScale([self.result.pixel_size])
82+
self.color1.setScale(0, 1, "turbo")

0 commit comments

Comments
 (0)