Exemple #1
0
    def run(self, ips, imgs, para=None):
        idx = ['red', 'green', 'blue']
        imr, img, imb = [WindowsManager.get(para[i]).ips for i in idx]
        sr, sg, sb = [i.get_nslices() for i in [imr, img, imb]]

        if imr.imgtype != '8-bit' or img.imgtype != '8-bit' or imb.imgtype != '8-bit':
            IPy.alert('must be three 8-bit image!')
            return
        if imr.size != img.size or img.size != imb.size or sr != sg or sg != sb:
            IPy.alert(
                'three image must be in same size and have the same slices!')
            return

        rgb = []
        w, h = imr.size
        rgbs = list(zip(imr.imgs, img.imgs, imb.imgs))
        for i in range(sr):
            self.progress(i, sr)
            img = np.zeros((w, h, 3), dtype=np.uint8)
            for j in (0, 1, 2):
                img[:, :, j] = rgbs[i][j]
            rgb.append(img)
        IPy.show_img(rgb, 'rgb-merge')
        if self.para['destory']:
            for title in [para[i] for i in idx]:
                WindowsManager.close(title)
Exemple #2
0
 def run(self, ips, imgs, para=None):
     r, g, b = [], [], []
     for i, n in zip(imgs, list(range(ips.get_nslices()))):
         self.progress(i, n)
         for c, ci in zip((r, g, b), (0, 1, 2)):
             if self.para['copy']: c.append(i[:, :, ci].copy())
             else: c.append(i[:, :, ci])
     for im, tl in zip([r, g, b], ['red', 'green', 'blue']):
         IPy.show_img(im, ips.title + '-' + tl)
     if self.para['destory']:
         WindowsManager.close(ips.title)
Exemple #3
0
 def run(self, ips, imgs, para=None):
     r, g, b = [], [], []
     for i, n in zip(imgs, list(range(ips.get_nslices()))):
         IPy.curapp.set_progress(round((n + 1) * 100.0 / len(imgs)))
         for c, ci in zip((r, g, b), (0, 1, 2)):
             if self.para['copy']: c.append(i[:, :, ci].copy())
             else: c.append(i[:, :, ci])
     IPy.curapp.set_progress(0)
     for im, tl in zip([r, g, b], ['red', 'green', 'blue']):
         ip = ImagePlus(im, ips.title + '-' + tl)
         frame = CanvasFrame(IPy.curapp)
         frame.set_ips(ip)
         frame.Show()
     if self.para['destory']:
         WindowsManager.close(ips.title)
Exemple #4
0
    def run(self, ips, imgs, para=None):
        idx = ['red', 'green', 'blue']
        imr, img, imb = [WindowsManager.get(para[i]).ips for i in idx]
        sr, sg, sb = [i.get_nslices() for i in [imr, img, imb]]

        if imr.imgtype!='8-bit' or img.imgtype!='8-bit' or imb.imgtype!='8-bit' or \
            imr.size!=img.size or img.size!=imb.size or sr!=sg or sg!=sb:
            IPy.alert(
                'three images must be 8-bit image, with the same size and  slices!'
            )
            return

        rgbs = []
        w, h = imr.size
        for i in range(sr):
            self.progress(i, sr)
            rgbs.append(self.trans(imr.imgs[i], img.imgs[i], imb.imgs[i]))
        IPy.show_img(rgbs, self.titles()[0])
        if self.para['destory']:
            for title in [para[i] for i in idx]:
                WindowsManager.close(title)
Exemple #5
0
 def run(self, para=None):
     if para['name'] == 'All':
         for i in WindowsManager.get_titles():
             WindowsManager.close(i)
     else:
         WindowsManager.close(para['name'])