Hi,
I managed to make an example of my issue . For some reason I cannot get
the range to adjust for each color, but I put a border around the image, to
make it clear where it ends.
I fill in arrays representing rgba, and I stack that to form my data.
If you set the configuration to row major, rescale the roi to an uneven
rectangle, then you should get my issue. You can also see in the pictures,
because of the error the plots stop updating.
I expected it to work the same as in column major. ( you can move around
the roi, and when the roi overlaps an area outside the image, the plot data
corresponding to it is 0)
Any thoughts?
On Tuesday, May 19, 2020 at 5:57:41 PM UTC+2, megan wrote:
>
> Okay, I've not been able to replicate this. Can you post some example code
> that produces this error?
>
> On Tue, May 19, 2020 at 9:43 AM Lavinia B <[email protected] <javascript:>>
> wrote:
>
>> Hi,
>> The numbers correspond to the dimensions of the ROI rectangle I drag. I
>> am pretty sure it's that, as the exception modifies with my changes... and
>> goes away when I create a perfect square.
>> For example:
>> Exception: X and Y arrays must be the same shape--got (38,) and
>> (22,).
>>
>>
>> On Tuesday, May 19, 2020 at 5:26:24 PM UTC+2, megan wrote:
>>>
>>> Hi,
>>>
>>> That is an error that occurs when you attempt to plot data that has a
>>> different number of x and y values. I need more information in order to
>>> understand why you're getting that error though. What are the shapes in the
>>> error? Can you post the whole traceback?
>>>
>>> Megan
>>>
>>> On Tue, May 19, 2020 at 9:17 AM Lavinia B <[email protected]> wrote:
>>>
>>>> Hi,
>>>> I have an ImageView in which I set data with mode=rgba. When I try to
>>>> use the ROI , the plot gives me warnings if the ROI is not perfectly
>>>> square.
>>>> "..\src\pyqtgraph\pyqtgraph\graphicsItems\PlotCurveItem.py", line 385,
>>>> in updateData
>>>> raise Exception("X and Y arrays must be the same shape--got %s and
>>>> %s." % (self.xData.shape, self.yData.shape))
>>>>
>>>> I don't understand why is this enforced. Can somebody explain?
>>>>
>>>> Note: this does not happen for mono images, or if I keep my selection
>>>> shape square.
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "pyqtgraph" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/pyqtgraph/03453f45-80b6-4e4c-8589-0ca26e131205%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/pyqtgraph/03453f45-80b6-4e4c-8589-0ca26e131205%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "pyqtgraph" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pyqtgraph/5c8c6bbd-3989-42d6-91e6-fa7dc729d527%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/pyqtgraph/5c8c6bbd-3989-42d6-91e6-fa7dc729d527%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/22b1cce2-a9da-45e2-849d-bd4271a240a3%40googlegroups.com.
import numpy as np
import pyqtgraph as pg
from PySide2 import QtGui, QtCore
from PySide2.QtWidgets import QFileDialog, QAction, QWidget, QVBoxLayout
from pyqtgraph import ImageView
#pg.setConfigOptions(imageAxisOrder='row-major') #<---comment this out
# NOTE: if you want to see the color, for some reason the range needs to be dragged by hand as well- the color is irrelevant
class RGBView(QWidget):
def __init__(self):
super(RGBView, self).__init__()
self.setMinimumSize(400,300)
self.rgb_imgView = ImageView()
self.rgb_imgView.imageItem.setBorder('w')
self.layout = QVBoxLayout()
self.layout.addWidget(self.rgb_imgView)
self.ctx_menu = self.rgb_imgView.view.menu
self.setLayout(self.layout)
def make_data(self):
r = np.full((100, 200), 150)
g = np.full((100, 200), 200)
b = np.full((100, 200), 10)
a = np.full((100, 200), 255)
# stacking the array to make an rgba image
f1 = np.dstack((r, g))
f1 = np.dstack((f1, b))
f1 = np.dstack((f1, a))
return f1
def load_data(self):
data = self.make_data()
print("shape", data.shape, "type", data.dtype)
self.rgb_imgView.setImage(data, levelMode="rgba")
if __name__ == '__main__':
import sys
app = QtGui.QApplication()
test = RGBView()
test.load_data()
test.show()
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()