Hi, so here's what I've done: taken a numpy array and displayed it within an ImageItem, within a PlotItem. In the real world, the data corresponds to roughly 2m x 12m. I have scaled the pixels appropriately, and the image displays correctly with regards to the values on the axes. What I'm having a difficult time with is getting the scene position to be accurate when I record mouse click coordinates. What I'm not sure is how to use the map to view/from view/to scene/from scene etc to get the appropriate coordinates.
Here is the basic code for the image (self.p1 is a PlotItem):
self.p1.vb.scaleBy((10.28/512,2.486/96))
self.image=pg.ImageView(view=self.p1)
image=scipy.ndimage.filters.maximum_filter(frame.data, size=5)
self.image.setImage(image, scale=((10.28/512),(2.486/96)))
self.p1.vb.setXRange(0,2)
self.p1.vb.setYRange(0,14)
if obj is self.p1 and event.type() == event.GraphicsSceneMousePress:
if event.button()==Qt.LeftButton:
pos=event.scenePos()
x=((pos.x()*(2.486/96))-1)
y=(pos.y()*(10.28/512))
self.x=QTableWidgetItem('%0.01f'% x)
self.y=QTableWidgetItem('%0.01f'% y)
I added the scaling again in the x/y pos because it still didn't seem to work in the scaling.... I've attached a screen cap, as well.
Thank you-- I hope this is somewhat clear!