From 5b107236c98f0a72c2e4b0c07b7dc76ff0239521 Mon Sep 17 00:00:00 2001 From: Guillaume Raffy Date: Tue, 25 Jan 2022 16:16:31 +0100 Subject: [PATCH] Handle the case where the user selects a Pos directory as raw image root - although a Pos directory as raw image root is disputable, before this fix, an assert failed which was not very nice... --- Makefile | 2 +- src/lipase/catalog.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 31c5db7..4c18626 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ TEMP_PATH:=$(shell echo ~/work/lipase/tmp) TESTS_OUTPUT_DATA_PATH:=$(TEMP_PATH) LIB_SRC_FILES=$(shell find ./src/lipase -name "*.py") PLUGINS_SRC_FILES=$(shell find ./src/ij-plugins -name "*.py") -LIPASE_VERSION=1.06 +LIPASE_VERSION=1.07 BUILD_ROOT_PATH:=$(TEMP_PATH)/build PACKAGE_FILE_PATH=$(BUILD_ROOT_PATH)/lipase-$(LIPASE_VERSION).zip diff --git a/src/lipase/catalog.py b/src/lipase/catalog.py index a0e29c3..705da33 100644 --- a/src/lipase/catalog.py +++ b/src/lipase/catalog.py @@ -226,11 +226,17 @@ class ImageCatalog(object): """ sequence_paths = find_dirs_containing_file('metadata.txt', self.raw_images_root) + logger.debug('sequence_paths : %s' % sequence_paths) sequence_ids = [ os.path.relpath(sequence_path, raw_images_root) for sequence_path in sequence_paths ] + logger.debug('sequence_ids : %s' % sequence_ids) # nb : we use the path as sequence id because the "Comment" field in the summary section of the metadata file is not guaranteed to be unique (eg they are the same in res_soleil2018/white/white_24112018_1/Pos0 and in res_soleil2018/white/white_24112018_2/Pos0) for sequence_id in sequence_ids: - micro_manager_metadata_file_path = os.path.join(raw_images_root, sequence_id, 'metadata.txt') + if sequence_id == '.': + # special degenerate case: when raw_images_root points to a Pos directory, sequence_id is '.', which means there's no intemediate directories between raw_images_root and metadata.txt + micro_manager_metadata_file_path = os.path.join(raw_images_root, 'metadata.txt') + else: + micro_manager_metadata_file_path = os.path.join(raw_images_root, sequence_id, 'metadata.txt') # micro_manager_metadata_file_path = '/tmp/toto.json' self.sequences[sequence_id] = Sequence(self, sequence_id, micro_manager_metadata_file_path)