getArrayRegion returns incorrect data

30 views
Skip to first unread message

Nicholas Earl

unread,
Feb 15, 2015, 11:08:32 PM2/15/15
to pyqt...@googlegroups.com
It seems that when using getArrayRegion on a 3d data array, only the first slice of the returned data cube is correct when the ROI is out-of-bounds of the image. Using a simple example that's been offered here on the mailing list:

win = pg.GraphicsWindow()
view = win.addViewBox()
data = np.random.normal(size=(100,100,100))
img = pg.ImageItem()
img.setImage(data.mean(axis=0)) # img x and y axes are data axes 1 and 2
roi = pg.RectROI(pos=[120, 120], size=[20, 20])
view.addItem(img)
view.addItem(roi)

## let user move ROI, then pull out selected region:
roiData = roi.getArrayRegion(data, img, axes=(1,2))

print roiData.shape  # returns (100, 20, 20)
print roiData[0]  # returns all zeros
print roiData[1]  # returns data


The first slice of roiData (roiData[0]) is correctly blank. However, all subsequent slices contain data that should not exist.

Luke Campagnola

unread,
Feb 16, 2015, 12:00:05 PM2/16/15
to pyqt...@googlegroups.com
Thanks for the report! 
This should now be fixed in the latest develop branch. Please let me know if there are further issues.

Luke

--
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 pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/b8c845ca-569e-4a78-ae13-9b898808bb62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages