From f7e7fe337aece6fa2b17b77d62df968e5537ffd7 Mon Sep 17 00:00:00 2001 From: Pranjal Dhole <pranjal.dhole@dzne.de> Date: Tue, 26 Oct 2021 16:05:51 +0200 Subject: [PATCH 1/2] upgrading h5py version to recent since needed by tensorflow --- .gitignore | 2 ++ setup.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e013bd8..ddfab69 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ +# Auxiliary directories .cache/ +.vscode/ # compiled python files *.pyc diff --git a/setup.py b/setup.py index 5e77a19..eb8a614 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages -reqs = ['h5py==2.10.0', +reqs = ['h5py>=2.10.0', 'numpy>=1.12.1', 'docopt>=0.6.2', 'tifffile'] @@ -14,7 +14,7 @@ def readme(): setup(name='pyilastik', - version='0.0.9', + version='0.1.0', description='Read ilastik labels in python', author='Manuel Schoelling, Christoph Moehl', author_email='manuel.schoelling@dzne.de, christoph.oliver.moehl@gmail.com', From 54b5b05bb9ee9cd882ac39860e7ffbf18bbad193 Mon Sep 17 00:00:00 2001 From: Pranjal Dhole <pranjal.dhole@dzne.de> Date: Tue, 26 Oct 2021 16:30:52 +0200 Subject: [PATCH 2/2] decoding utf-8 object is no longer required, all strings are unicode objects --- pyilastik/ilastik_storage_version_01.py | 10 +++++----- pyilastik/ilastik_version_05.py | 2 +- pyilastik/lib.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyilastik/ilastik_storage_version_01.py b/pyilastik/ilastik_storage_version_01.py index d9bad55..05d7505 100644 --- a/pyilastik/ilastik_storage_version_01.py +++ b/pyilastik/ilastik_storage_version_01.py @@ -117,14 +117,14 @@ def __init__(self, h5_handle, image_path=None, prediction=False, self.skip_image = skip_image try: - version = self.f.get('/Input Data/StorageVersion')[()].decode() + version = self.f.get('/Input Data/StorageVersion')[()] except AttributeError: # for ilastik release > 1.3.0 version = self.f.get('/Input Data/StorageVersion')[()] assert version == '0.2' def ilastik_version(self): - version_str = self.f.get('ilastikVersion')[()].decode() + version_str = self.f.get('ilastikVersion')[()] return int(version_str.replace('.', '')[:3]) def __iter__(self): @@ -164,7 +164,7 @@ def image_path_list(self): path = self.f.get( '/Input Data/infos/{lane}/Raw Data/filePath'.format(lane=lane)) - path = path[()].decode() + path = path[()] path_list.append(path) @@ -184,7 +184,7 @@ def __getitem__(self, i): lane = 'lane{:04}'.format(i) path = f.get( '/Input Data/infos/{lane}/Raw Data/filePath'.format(lane=lane)) - path = path[()].decode() + path = path[()] original_path = path prediction = None # TODO @@ -419,7 +419,7 @@ def _get_block_slices(self, item_index): slice_list = [] for block in self._get_blocks(item_index): slices = re.findall('([0-9]+):([0-9]+)', - block.attrs['blockSlice'].decode('ascii')) + block.attrs['blockSlice']) slice_list.append(slices) return np.array(slice_list).astype('int') diff --git a/pyilastik/ilastik_version_05.py b/pyilastik/ilastik_version_05.py index 6dd4188..644dad2 100644 --- a/pyilastik/ilastik_version_05.py +++ b/pyilastik/ilastik_version_05.py @@ -21,7 +21,7 @@ def __getitem__(self, i): f = self.f dset = f.get('/DataSets/dataItem{:02}'.format(i)) - path = utils.basename(dset.attrs['fileName'].decode('ascii')) + path = utils.basename(dset.attrs['fileName']) img = np.array(dset.get('data')) if not self.skip_image else None labels = np.array(dset.get('labels/data')) diff --git a/pyilastik/lib.py b/pyilastik/lib.py index 9a77e7e..1d86627 100644 --- a/pyilastik/lib.py +++ b/pyilastik/lib.py @@ -18,7 +18,7 @@ def read_project(ilastik_file, image_path=None, prediction=False, version = f.get('/PixelClassification/StorageVersion') if version is not None: try: - version = version[()].decode() + version = version[()] except AttributeError: # for ilastik releases >1.3.0 version = version[()]