Display Sequence now displays an informative messagebox inseatd of crashing when the list of sequence is empty

fixes #7
This commit is contained in:
Guillaume Raffy 2022-01-25 12:33:09 +01:00
parent 74d78d21e2
commit dbc22ea3b1
2 changed files with 18 additions and 15 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.04 LIPASE_VERSION=1.05
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

@ -101,22 +101,25 @@ def run_script():
user_settings = UserSettings() user_settings = UserSettings()
IImageEngine.set_instance(IJImageEngine()) IImageEngine.set_instance(IJImageEngine())
catalog = ImageCatalog(user_settings.raw_images_root_path) catalog = ImageCatalog(user_settings.raw_images_root_path)
if len(catalog.sequences) > 0:
user_selection = ask_for_sequence(catalog)
if len(user_selection) == 0:
return
sequence = user_selection['sequence']
channel_id = str(user_selection['channel_id'])
IJ.log("channel_id = %s (type = %s)" % (channel_id, str(type(channel_id))))
if channel_id == 'all':
sequence_as_stack = open_sequence_in_imagej(sequence)
else:
hyperstack = sequence.as_hyperstack(selected_channel_ids=[channel_id], selected_frames=None, selected_slices=None)
sequence_as_stack = hyperstack.hyperstack
user_selection = ask_for_sequence(catalog) print(type(sequence_as_stack))
if len(user_selection) == 0: global SEQUENCE
return SEQUENCE = sequence_as_stack
sequence = user_selection['sequence'] else:
channel_id = str(user_selection['channel_id']) IJ.runMacro('waitForUser("Warning", "No sequences have been found in raw images root dir (%s)"' % user_settings.raw_images_root_path)
IJ.log("channel_id = %s (type = %s)" % (channel_id, str(type(channel_id))))
if channel_id == 'all':
sequence_as_stack = open_sequence_in_imagej(sequence)
else:
hyperstack = sequence.as_hyperstack(selected_channel_ids=[channel_id], selected_frames=None, selected_slices=None)
sequence_as_stack = hyperstack.hyperstack
print(type(sequence_as_stack))
global SEQUENCE
SEQUENCE = sequence_as_stack
# note : when launched from fiji, __name__ doesn't have the value "__main__", as when launched from python # note : when launched from fiji, __name__ doesn't have the value "__main__", as when launched from python
run_script() run_script()