'Use the position of this ROI relative to an imageItem to pull a slice
from an array.
Since this pulls 1D data from a 2D coordinate system, the return value
will have ndim = data.ndim-1
See ROI.getArrayRegion() for a description of the arguments.'

def getArrayRegion(self, data, img, axes=(0, 1), order=1, returnMappedCoords=False, **kwds):

    imgPts = [self.mapToItem(img, h.pos()) for h in self.endpoints]
    rgns = []
    coords = []
    d = Point((imgPts[1] - imgPts[0]))
    o = Point(imgPts[0])
    rgn = fn.affineSlice(data, shape=(int(d.length()),), vectors=[Point(d.norm())], origin=o, axes=axes, order=order, returnCoords=returnMappedCoords, **kwds)
    return rgn
