Commit b9ff83e4 authored by Wallenfang, Nils's avatar Wallenfang, Nils

use ImageJ with NO_SHOW option for preview display

parent 0a20fd2d
...@@ -144,18 +144,18 @@ def clicked_start(frame): ...@@ -144,18 +144,18 @@ def clicked_start(frame):
threading.Thread(target=logic_thread_task).start() threading.Thread(target=logic_thread_task).start()
def save_preview(preview, frame, dir_name): def save_preview(preview, frame, file_name):
preview_root = config['PREVIEWS']['preview_path'] preview_root = config['PREVIEWS']['preview_path']
# save preview to a fixed path # save preview to a fixed path
time_stamp = datetime.now(tzlocal()).strftime('%Y%m%d_%H-%M') time_stamp = datetime.now(tzlocal()).strftime('%Y%m%d_%H-%M')
preview_path = f'{preview_root}/{dir_name}_{time_stamp}.png' preview_path = f'{preview_root}/{file_name}_{time_stamp}.png'
# TODO ensure no file overrides happen # TODO ensure no file overrides happen
try: try:
plt.imsave(preview_path, preview, cmap='gray') plt.imsave(preview_path, preview, cmap='gray')
# open fiji image viewer in a non-blocking way # open fiji image viewer in a non-blocking way
subprocess.Popen([config['PREVIEWS']['fiji_path'], preview_path]) subprocess.Popen(f'java -jar utils/imagej_no_show.jar "{preview_path}"', shell=True)
except PermissionError: except PermissionError:
# unable to save preview in given directory # unable to save preview in given directory
frame.print(f'No permission to save preview in directory "{preview_root}".') frame.print(f'No permission to save preview in directory "{preview_root}".')
...@@ -165,7 +165,7 @@ def save_preview(preview, frame, dir_name): ...@@ -165,7 +165,7 @@ def save_preview(preview, frame, dir_name):
os.mkdir(preview_path) os.mkdir(preview_path)
plt.imsave(preview_path, preview, cmap='gray') plt.imsave(preview_path, preview, cmap='gray')
# open fiji image viewer in a non-blocking way # open fiji image viewer in a non-blocking way
subprocess.Popen([config['PREVIEWS']['fiji_path'], preview_path]) subprocess.Popen(f'java -jar utils/imagej_no_show.jar "{preview_path}"', shell=True)
except FileNotFoundError: except FileNotFoundError:
frame.print(f'Unable to save preview in directory "{preview_root}".') frame.print(f'Unable to save preview in directory "{preview_root}".')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment