diff --git a/datasets/raise/flat-field_pointer.py b/datasets/raise/flat-field_pointer.py index f2f9882..3ec981f 100644 --- a/datasets/raise/flat-field_pointer.py +++ b/datasets/raise/flat-field_pointer.py @@ -3,17 +3,38 @@ import numpy as np from matplotlib.backend_bases import MouseButton import matplotlib.image as mpimg import os +from tqdm import tqdm os.chdir('flat-field/TIF') -def onClick(event): - if event.button is MouseButton.LEFT: - print(event.x, event.y) - plt.close() +fileNames = os.listdir()[:3] +fileNameIndex = 0 +xys = [] +progressBar = tqdm(total = len(fileNames)) -for fileName in os.listdir(): - print(fileName) - image = mpimg.imread(fileName) - plt.imshow(image) - plt.connect('button_press_event', onClick) - plt.show(block = True) \ No newline at end of file +def displayImage(): + global fileNameIndex + if len(fileNames) > fileNameIndex: + fileName = fileNames[fileNameIndex] + image = mpimg.imread(fileName) + plt.imshow(image) + fileNameIndex += 1 + plt.connect('button_press_event', onClick) + + mng = plt.get_current_fig_manager() + mng.full_screen_toggle() + + plt.show() + +def onClick(event): + global xys + if event.button is MouseButton.RIGHT: + xy = [event.x, event.y] + xys += [xy] + #print(fileNameIndex, xy) + plt.close() + displayImage() + progressBar.update(1) + +#print(fileName) +displayImage() \ No newline at end of file