summaryrefslogtreecommitdiff
path: root/silx/gui/plot/tools/profile/rois.py
diff options
context:
space:
mode:
authorPicca Frédéric-Emmanuel <picca@debian.org>2021-09-07 14:39:36 +0200
committerPicca Frédéric-Emmanuel <picca@debian.org>2021-09-07 14:39:36 +0200
commitd3194b1a9c4404ba93afac43d97172ab24c57098 (patch)
treea1604130e1401dc1cbd084518ed72869dc92b86f /silx/gui/plot/tools/profile/rois.py
parentb3bea947efa55d2c0f198b6c6795b3177be27f45 (diff)
New upstream version 0.15.2+dfsg
Diffstat (limited to 'silx/gui/plot/tools/profile/rois.py')
-rw-r--r--silx/gui/plot/tools/profile/rois.py28
1 files changed, 8 insertions, 20 deletions
diff --git a/silx/gui/plot/tools/profile/rois.py b/silx/gui/plot/tools/profile/rois.py
index 9e651a7..eb7e975 100644
--- a/silx/gui/plot/tools/profile/rois.py
+++ b/silx/gui/plot/tools/profile/rois.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2018-2020 European Synchrotron Radiation Facility
+# Copyright (c) 2018-2021 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -33,7 +33,7 @@
__authors__ = ["V. Valls"]
__license__ = "MIT"
-__date__ = "03/04/2020"
+__date__ = "01/12/2020"
import numpy
import weakref
@@ -137,11 +137,7 @@ class _ImageProfileArea(items.Shape):
if not isinstance(item, items.ImageBase):
raise TypeError("Unexpected class %s" % type(item))
- if isinstance(item, items.ImageRgba):
- rgba = item.getData(copy=False)
- currentData = rgba[..., 0]
- else:
- currentData = item.getData(copy=False)
+ currentData = item.getValueData(copy=False)
roi = self.getParentRoi()
origin = item.getOrigin()
@@ -288,7 +284,7 @@ class _DefaultImageProfileRoiMixIn(core.ProfileRoiMixIn):
roiStart, roiEnd = self.getEndPoints()
else:
assert False
-
+
return roiStart, roiEnd, lineProjectionMode
def computeProfile(self, item):
@@ -310,15 +306,7 @@ class _DefaultImageProfileRoiMixIn(core.ProfileRoiMixIn):
method=method)
return coords, profile, profileName, xLabel
- if isinstance(item, items.ImageRgba):
- rgba = item.getData(copy=False)
- is_uint8 = rgba.dtype.type == numpy.uint8
- # luminosity
- if is_uint8:
- rgba = rgba.astype(numpy.float64)
- currentData = 0.21 * rgba[..., 0] + 0.72 * rgba[..., 1] + 0.07 * rgba[..., 2]
- else:
- currentData = item.getData(copy=False)
+ currentData = item.getValueData(copy=False)
yLabel = "%s" % str(method).capitalize()
coords, profile, title, xLabel = createProfile2(currentData)
@@ -427,7 +415,7 @@ class ProfileImageDirectedLineROI(roi_items.LineROI,
scale = item.getScale()
method = self.getProfileMethod()
lineWidth = self.getProfileLineWidth()
- currentData = item.getData(copy=False)
+ currentData = item.getValueData(copy=False)
roiInfo = self._getRoiInfo()
roiStart, roiEnd, _lineProjectionMode = roiInfo
@@ -448,8 +436,8 @@ class ProfileImageDirectedLineROI(roi_items.LineROI,
method=method)
# Compute the line size
- lineSize = numpy.sqrt((roiEnd[1] - roiStart[1])**2 +
- (roiEnd[0] - roiStart[0])**2)
+ lineSize = numpy.sqrt((roiEnd[1] - roiStart[1]) ** 2 +
+ (roiEnd[0] - roiStart[0]) ** 2)
coords = numpy.linspace(0, lineSize, len(profile),
endpoint=True,
dtype=numpy.float32)