PseudoSquareROI.py 文件源码

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

项目:dataArtist 作者: radjkarl 项目源码 文件源码
def getArrayRegion(self, arr, img=None):
        """
        Return the result of ROI.getArrayRegion() masked by the elliptical shape
        of the ROI. Regions outside the ellipse are set to 0.
        """
        # TODO: get right area for pseudosquare
        arr = pg.ROI.getArrayRegion(self, arr, img)
        if arr is None or arr.shape[0] == 0 or arr.shape[1] == 0:
            return None
        w = arr.shape[0]
        h = arr.shape[1]
        # generate an ellipsoidal mask
        mask = np.fromfunction(lambda x,y: ((((x+0.5)/((w/2.)))-1)**2+ (
                        ((y+0.5)/((h/2.)))-1)**2)**0.5 < self._ratioEllispeRectangle, (w, h))

        return arr * mask
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号