-
Notifications
You must be signed in to change notification settings - Fork 6
/
extract_select_features.py
32 lines (26 loc) · 1015 Bytes
/
extract_select_features.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import PySimpleGUI as sg
from utils import *
def main():
# Define the layout
layout = [
[sg.Text("SEM Image Analyzer")],
[sg.Text("Enter the path to the image:"), sg.Input(key="-IMAGE-"), sg.FileBrowse()],
[sg.Text("Enter the pixel scale (default is 370):"), sg.Input(default_text="370", key="-SCALE-")],
[sg.Text("Enter the number of clicks needed to extract the feature:"), sg.Input(key="-INPUTS-")],
[sg.Button("Submit"), sg.Button("Exit")]
]
# Create the window
window = sg.Window("SEM Image Analyzer", layout)
# Event loop
while True:
event, values = window.read()
if event == "Exit" or event == sg.WIN_CLOSED:
break
elif event == "Submit":
image_path = values["-IMAGE-"]
pixel_scale = int(values["-SCALE-"])
num_input = int(values["-INPUTS-"])
process_image(image_path, pixel_scale, num_input)
window.close()
if __name__ == "__main__":
main()