Example #1
0
    def run(self, para=None):
        root_dir = osp.abspath(osp.dirname(self.path))
        print(root_dir)
        path = osp.join(root_dir, self.name)
        if osp.isfile(path):
            fp, fn = osp.split(path)
            fn, fe = osp.splitext(fn)
            read = ReaderManager.get(fe[1:])
            view = ViewerManager.get(fe[1:]) or IPy.show_img

            group, read = (True,
                           read[0]) if isinstance(read, tuple) else (False,
                                                                     read)
            img = read(path)
            if img.dtype == np.uint8 and img.ndim == 3 and img.shape[2] == 4:
                img = img[:, :, :3].copy()
            if not group: img = [img]
        else:
            names = [i for i in os.listdir(path) if '.' in i]
            read = ReaderManager.get(names[0].split('.')[1])
            view = ViewerManager.get(names[0].split('.')[1]) or IPy.show_img
            imgs = []
            for i in range(len(names)):
                self.progress(i, len(names))
                imgs.append(read(osp.join(path, names[i])))
            img = imgs
        view(img, self.title)
Example #2
0
    def run(self, para=None):
        fp, fn = os.path.split(para['path'])
        fn, fe = os.path.splitext(fn)
        read = ReaderManager.get(fe[1:])
        view = ViewerManager.get(fe[1:]) or show

        try:
            img = read(para['path'])
        except:
            IPy.alert('unknown img format!')
            return

        files = self.getfiles(para['path'])
        files.sort()
        imgs = self.readimgs(files[para['start']:para['end'] + 1:para['step']],
                             read, img.shape, img.dtype)
        view(imgs, para['title'])
Example #3
0
 def load(self):
     self.filt = sorted(ReaderManager.get())
     return True