def run(self, ips, img, buf, para = None): if para == None: para = self.para a = para['ang']/180.0*np.pi trans = np.array([[np.cos(a),-np.sin(a)],[np.sin(a),np.cos(a)]]) o = np.array([self.para['oy'], self.para['ox']]) offset = o-trans.dot(o) if self.para['img']: nimg.affine_transform(img, trans, output=buf, offset=offset) if self.para['msk'] and self.bufroi!=None: m, o = trans, o[::-1]-trans.dot(o[::-1]) mat = [m[0,0], m[0,1], m[1,0], m[1,1], o[0], o[1]] ips.roi = ROI(geom2shp(affine_transform(self.bufroi.to_geom(), mat)))
def run(self, ips, img, buf, para = None): if para == None: para = self.para self.count(False) trans = np.array([[1/self.para['ky'],0],[0,1/self.para['kx']]]) o = np.array([self.para['oy'], self.para['ox']]) offset = self.orio[::-1]-trans.dot(o) if self.para['img']: nimg.affine_transform(img, trans, output=buf, offset=offset) trans = np.array([[self.para['kx'],0],[0, self.para['ky']]]) if self.para['msk'] and self.bufroi!=None: m, o = trans, o[::-1]-trans.dot(self.orio) mat = [m[0,0], m[0,1], m[1,0], m[1,1], o[0], o[1]] ips.roi = ROI(geom2shp(affine_transform(self.bufroi.to_geom(), mat)))