Commit 58d97ef4 authored by Wallenfang, Nils's avatar Wallenfang, Nils

fix typo in default config and add validation for preview dir

parent cca15d5c
......@@ -76,6 +76,7 @@ def clicked_browse(frame):
def get_logger_filename(dir_name):
if not os.path.isdir(config['GUI']['log_path']):
# TODO catch error
os.mkdir(config['GUI']['log_path'])
file_name = f"{config['GUI']['log_path']}/{dir_name}.log"
......@@ -159,10 +160,18 @@ def save_preview(preview, frame, dir_name):
plt.imsave(preview_path, preview, cmap='gray')
# open fiji image viewer in a non-blocking way
subprocess.Popen([config['PREVIEWS']['fiji_path'], preview_path])
except PermissionError:
# 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}".')
except FileNotFoundError:
# preview directory doesn't exist, try to create it
try:
os.mkdir(preview_path)
plt.imsave(preview_path, preview, cmap='gray')
# open fiji image viewer in a non-blocking way
subprocess.Popen([config['PREVIEWS']['fiji_path'], preview_path])
except FileNotFoundError:
frame.print(f'Unable to save preview in directory "{preview_root}".')
def process_preview_gen(frame, tiff_path):
......@@ -249,7 +258,7 @@ def process_quality_check(frame, tiff_path, logger_path):
if method_string == 'black bar check':
quality_check = ZeroCheck(threshold=0.0003)
elif method_string == 'sine fit':
thresh = float(config['SINE_FIT']['threshhold'])
thresh = float(config['SINE_FIT']['threshold'])
quality_check = SineCheck(threshold_func=lambda error: error > thresh,
num=int(config['SINE_FIT']['number_of_samples']))
elif method_string == 'new sine fit':
......
[PREVIEWS]
# directory where each preview is saved
preview_path = /home/nils/Arbeit/Previews
preview_path = Previews
# path to fiji executable, used to show previews
fiji_path = /home/nils/Public/Fiji.app/ImageJ-linux64
# the preview will be scaled down so that its dimensions will be less than
# or equal to (resolution_x, resolution_y)
resolution_x = 800
resolution_y = 1200
# unfortunately a path to a true type font has to be provided for insertion of index labels
font_path = /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
[GUI]
# initially selected tiff path, this directory is also used as a starting point when clicking 'browse'
default_tiff_path = /media/nils/7E26098326093DA1/Arbeit/20160216_ReelerMaus_60mu_70ms_s0084/2016-02-25_11-38-12
default_tiff_path =
# Directory where error matrices are saved which contain the error measure for each tile.
# They can be opened with the command 'np.load()'.
error_matrix_path = /home/nils/Arbeit/qsErrorMatrices/
......@@ -22,6 +21,6 @@ log_path = /home/nils/Arbeit/qsLogs/
debug = False
[SINE_FIT]
threshhold = 0.00056
threshold = 0.00056
# number of pixels that are sampled from each tile. For each pixel a sine fit is calculated.
number_of_samples = 400
\ No newline at end of file
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