Ejemplo n.º 1
0
 def run(self, ips, imgs, para=None):
     n = ips.get_nslices()
     if ips.is3d:
         img8 = np.zeros(ips.size + (n, ), dtype=np.uint8)
         for i in range(n):
             IPy.curapp.set_progress(round((i + 1) * 100.0 / len(imgs)))
             img8[i] = imgs[i].mean(axis=2)
     else:
         img8 = []
         for i in range(n):
             IPy.set_progress(round((i + 1) * 100.0 / len(imgs)))
             img8.append(imgs[i].mean(axis=2).astype(np.uint8))
     IPy.set_progress(0)
     ips.set_imgs(img8)
Ejemplo n.º 2
0
    def run(self, ips, imgs, para=None):
        titles = ['Max', 'Min', 'Mean', 'Variance', 'Standard']
        key = {
            'Max': 'max',
            'Min': 'min',
            'Mean': 'mean',
            'Variance': 'var',
            'Standard': 'std'
        }
        titles = [i for i in titles if para[key[i]]]

        if self.para['stack']:
            data = []
            for n in range(ips.get_nslices()):
                data.append(self.count(imgs[n], para))
                IPy.set_progress(round((n + 1) * 100.0 / len(imgs)))
            IPy.set_progress(0)
        else:
            data = [self.count(ips.get_img(), para)]
        IPy.table(ips.title + '-statistic', data, titles)
Ejemplo n.º 3
0
    def run(self, ips, imgs, para=None):
        ips1 = WindowsManager.get(para['img1']).ips
        ips2 = WindowsManager.get(para['img2']).ips

        sl1, sl2 = ips1.get_nslices(), ips2.get_nslices()
        cn1, cn2 = ips1.get_nchannels(), ips2.get_nchannels()
        if ips1.dtype != ips2.dtype:
            IPy.alert('Two stack must be equal dtype!')
            return
        elif sl1 > 1 and sl2 > 1 and sl1 != sl2:
            IPy.alert('Two stack must have equal slices!')
            return
        elif cn1 > 1 and cn2 > 1 and cn1 != cn2:
            IPy.alert('Two stack must have equal chanels!')
            return

        w, h = ips1.size, ips2.size
        w, h = min(w[0], h[0]), min(w[1], h[1])
        if sl1 == 1:
            bliter.blit(ips1.get_img(), ips2.get_img(), mode=para['op'])
        elif sl1 > 1 and sl2 == 1:
            for i in range(sl1):
                IPy.set_progress(round(i * 100.0 / sl1))
                bliter.blit(ips1.imgs[i], ips2.get_img(), mode=para['op'])
        elif sl1 > 1 and sl2 > 1:
            for i in range(sl1):
                IPy.set_progress(round(i * 100.0 / sl1))
                bliter.blit(ips1.imgs[i], ips2.imgs[i], mode=para['op'])
        IPy.set_progress(0)
        ips1.update = 'pix'