Exemplo n.º 1
0
 def run(self, ips, imgs, para = None):
     if ips.isarray: imgs = imgs.copy()
     else: imgs = [i.copy() for i in imgs]
     back = Image(imgs)
     back.cn, back.rg = ips.cn, ips.rg
     ips.back = back
     ips.mode = para['k'] if para['mode']=='ratial' else para['mode']
Exemplo n.º 2
0
def image_canvas_test():
    obj = Image()
    obj.img = camera()
    obj.cn = 0

    frame = wx.Frame(None, title='gray test')
    canvas = ICanvas(frame, autofit=True)
    canvas.set_img(obj)
    frame.Show()
Exemplo n.º 3
0
def image_mcanvas_test():
    obj = Image()
    obj.imgs = [astronaut(), 255 - astronaut()]
    obj.cn = 0

    frame = wx.Frame(None, title='gray test')
    canvas = MCanvas(frame, autofit=True)
    canvas.set_img(obj)
    frame.Show()
Exemplo n.º 4
0
 def run(self, ips, imgs, para=None):
     if not para['stack']: imgs = [ips.img]
     sli = ips.rect
     imgs = [i[sli].copy() for i in imgs]
     if ips.isarray: imgs = np.array(imgs)
     new = Image(imgs, ips.name + '-duplicate')
     if not ips.roi is None:
         new.roi = ROI(mark2shp(ips.roi.to_mark()))
         offset(new.roi, new.roi.box[0] * -1, new.roi.box[1] * -1)
         new.roi.dirty = True
     if not ips.back is None and not ips.back.imgs is None:
         back = [i[sli].copy() for i in ips.back.imgs]
         if ips.isarray: back = np.array(back)
         back = Image(back, ips.back.name + '-duplicate')
         back.cn, back.rg, back.mode = ips.back.cn, ips.back.rg, ips.back.mode
         new.back, new.mode = back, ips.mode
         self.app.show_img(back)
     self.app.show_img(new)
Exemplo n.º 5
0
def complex_test():
    frame = wx.Frame(None, title='blend')
    canvas = Canvas(frame, autofit=True)
    canvas.set_img(fftshift(fft2(camera())))
    canvas.set_rg((0, 31015306))
    canvas.set_log(True)
    frame.Show()


if __name__ == '__main__':
    app = wx.App()
    #gray_test()
    #rgb_test()
    #rgb_gray_blend()
    #complex_test()
    frame = wx.Frame(None, title='blend')
    canvas = Canvas(frame, autofit=True)
    image = Image()
    image.img = camera()
    image.pos = (0, 0)
    canvas.images.append(image)

    image = Image()
    image.img = astronaut()
    image.pos = (100, 200)
    image.cn = (0, 1, 2)
    canvas.images.append(image)
    frame.Show()
    app.MainLoop()