Handle the case where the user selects a Pos<n> directory as raw image root

- although a Pos<n> directory as raw image root is disputable, before this fix, an assert failed which was not very nice...
This commit is contained in:
Guillaume Raffy 2022-01-25 16:16:31 +01:00
parent ebcfb1747f
commit 5b107236c9
2 changed files with 8 additions and 2 deletions

View File

@ -7,7 +7,7 @@ TEMP_PATH:=$(shell echo ~/work/lipase/tmp)
TESTS_OUTPUT_DATA_PATH:=$(TEMP_PATH) TESTS_OUTPUT_DATA_PATH:=$(TEMP_PATH)
LIB_SRC_FILES=$(shell find ./src/lipase -name "*.py") LIB_SRC_FILES=$(shell find ./src/lipase -name "*.py")
PLUGINS_SRC_FILES=$(shell find ./src/ij-plugins -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 BUILD_ROOT_PATH:=$(TEMP_PATH)/build
PACKAGE_FILE_PATH=$(BUILD_ROOT_PATH)/lipase-$(LIPASE_VERSION).zip PACKAGE_FILE_PATH=$(BUILD_ROOT_PATH)/lipase-$(LIPASE_VERSION).zip

View File

@ -226,11 +226,17 @@ class ImageCatalog(object):
""" """
sequence_paths = find_dirs_containing_file('metadata.txt', self.raw_images_root) 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 ] 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) # 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: 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<n> 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' # micro_manager_metadata_file_path = '/tmp/toto.json'
self.sequences[sequence_id] = Sequence(self, sequence_id, micro_manager_metadata_file_path) self.sequences[sequence_id] = Sequence(self, sequence_id, micro_manager_metadata_file_path)