selected region rounds to zero even when data is constant

Asked by Klaus Hasselbach

I want to calculate the mean of the data contained in a circular ROI.
the test pattern is a ckeckerboard with squares of +1 and -1 as values.
each square consists of 16 pixel a side of either 1 or -1.

the average is done:
def update(roi):
    img1b.setImage(roi.getArrayRegion(arr, img1a), levels=(0, arr.max()))
    v1b.autoRange()

    selected = roi.getArrayRegion(arr, img1a, axes=(0, 1), returnMappedCoords=False)
    print("selected={}".format(selected))

selected=[[0. 1. 1. 1. 0.]
 [1. 1. 1. 1. 1.]
 [1. 1. 1. 1. 1.]
 [1. 1. 1. 1. 1.]
 [0. 1. 1. 1. 0.]]
[0.6 1. 1. 1. 0.6] 4.90442528864582 4.90442528864582 339.88891144046164 182.1808594976158 0.0

though the ROI is100% in a region of value 1
where do the 0 values come from?

I learnt:
the zeroes are the intersection pixels, thus add only about the non zero pixel, hoping that zero value does not exist

Question information

Language:
English Edit question
Status:
Expired
For:
pyqtgraph Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.