ROI.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:NeoAnalysis 作者: neoanalysis 项目源码 文件源码
def getArrayRegion(self, data, img, axes=(0,1), order=1, **kwds):
        """
        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.
        """

        imgPts = [self.mapToItem(img, h['item'].pos()) for h in self.handles]
        rgns = []
        for i in range(len(imgPts)-1):
            d = Point(imgPts[i+1] - imgPts[i])
            o = Point(imgPts[i])
            r = fn.affineSlice(data, shape=(int(d.length()),), vectors=[Point(d.norm())], origin=o, axes=axes, order=order, **kwds)
            rgns.append(r)

        return np.concatenate(rgns, axis=axes[0])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号