Commit ef969c11 authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[gui][grainplot] Make transformation origin and scale global and add it to mosaicity map

parent 00edc3fe
Pipeline #48537 passed with stage
in 2 minutes and 11 seconds
......@@ -114,6 +114,13 @@ class GrainPlotWidget(qt.QMainWindow):
for i in range(len(Method)):
self._methodCB.model().item(i).setEnabled(False)
scale = 100
if self.dataset.transformation:
px = self.dataset.transformation[0][0][0]
py = self.dataset.transformation[1][0][0]
xscale = (self.dataset.transformation[0][-1][-1] - px) / len(self.dataset.transformation[0][0])
yscale = (self.dataset.transformation[1][-1][-1] - py) / len(self.dataset.transformation[1][0])
self.origin = (px, py)
self.scale = (xscale, yscale)
if self.dataset.dims.ndim > 1:
self.ori_dist, self.hsv_key = self.dataset.compute_mosaicity_colorkey()
xdim = self.dataset.dims.get(1)
......@@ -232,12 +239,8 @@ class GrainPlotWidget(qt.QMainWindow):
elif method == Method.COM:
self._plotWidget.show()
if self.dataset.transformation is not None:
px = self.dataset.transformation[0][0][0]
py = self.dataset.transformation[1][0][0]
xscale = (self.dataset.transformation[0][-1][-1] - px) / len(self.dataset.transformation[0][0])
yscale = (self.dataset.transformation[1][-1][-1] - py) / len(self.dataset.transformation[1][0])
for i, plot in enumerate(self._plots):
plot.addImage(self._moments[i][0], origin=(px, py), scale=(xscale, yscale), xlabel='µm', ylabel='µm')
plot.addImage(self._moments[i][0], origin=self.origin, scale=self.scale, xlabel='µm', ylabel='µm')
else:
for i, plot in enumerate(self._plots):
plot.addImage(self._moments[i][0], xlabel='pixels', ylabel='pixels')
......@@ -251,7 +254,13 @@ class GrainPlotWidget(qt.QMainWindow):
plot.addImage(self._moments[i][3])
elif method == Method.MOSAICITY:
self._plotWidget.hide()
self._mosaicityPlot.addImage(hsv_to_rgb(self._computeMosaicity()))
if self.dataset.transformation:
self._mosaicityPlot.addImage(hsv_to_rgb(self._computeMosaicity()),
origin=self.origin, scale=self.scale,
xlabel='µm', ylabel='µm')
else:
self._mosaicityPlot.addImage(hsv_to_rgb(self._computeMosaicity()))
self._mosaicityPlot.show()
def _opticolor(self, img, minc, maxc):
......
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