spacr 0.1.1__py3-none-any.whl → 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spacr/__init__.py +19 -12
- spacr/annotate_app.py +258 -99
- spacr/annotate_app_v2.py +163 -4
- spacr/app_annotate.py +538 -0
- spacr/app_classify.py +8 -0
- spacr/app_make_masks.py +925 -0
- spacr/app_make_masks_v2.py +686 -0
- spacr/app_mask.py +8 -0
- spacr/app_measure.py +8 -0
- spacr/app_sequencing.py +8 -0
- spacr/app_umap.py +8 -0
- spacr/classify_app.py +201 -0
- spacr/core.py +8 -6
- spacr/deep_spacr.py +3 -1
- spacr/gui.py +50 -31
- spacr/gui_annotate.py +145 -0
- spacr/gui_classify_app.py +20 -6
- spacr/gui_core.py +608 -0
- spacr/gui_elements.py +322 -0
- spacr/gui_make_masks_app.py +927 -0
- spacr/gui_make_masks_app_v2.py +688 -0
- spacr/gui_mask_app.py +8 -4
- spacr/gui_measure_app.py +15 -5
- spacr/gui_run.py +58 -0
- spacr/gui_utils.py +71 -1027
- spacr/gui_wrappers.py +137 -0
- spacr/make_masks_app.py +929 -0
- spacr/make_masks_app_v2.py +688 -0
- spacr/mask_app.py +239 -915
- spacr/measure.py +24 -3
- spacr/measure_app.py +246 -0
- spacr/sequencing.py +1 -17
- spacr/settings.py +441 -6
- spacr/sim_app.py +0 -0
- spacr/utils.py +60 -7
- {spacr-0.1.1.dist-info → spacr-0.1.6.dist-info}/METADATA +13 -22
- spacr-0.1.6.dist-info/RECORD +60 -0
- spacr-0.1.6.dist-info/entry_points.txt +8 -0
- spacr-0.1.1.dist-info/RECORD +0 -40
- spacr-0.1.1.dist-info/entry_points.txt +0 -9
- {spacr-0.1.1.dist-info → spacr-0.1.6.dist-info}/LICENSE +0 -0
- {spacr-0.1.1.dist-info → spacr-0.1.6.dist-info}/WHEEL +0 -0
- {spacr-0.1.1.dist-info → spacr-0.1.6.dist-info}/top_level.txt +0 -0
spacr/gui_mask_app.py
CHANGED
@@ -174,13 +174,15 @@ def initiate_mask_root(parent_frame):
|
|
174
174
|
vars_dict['Test mode'] = (None, None, tk.BooleanVar(value=False))
|
175
175
|
|
176
176
|
# Button section
|
177
|
-
test_mode_button = CustomButton(scrollable_frame.scrollable_frame, text="Test Mode", command=toggle_test_mode)
|
177
|
+
test_mode_button = CustomButton(scrollable_frame.scrollable_frame, text="Test Mode", command=toggle_test_mode, font=('Helvetica', 10))
|
178
|
+
#CustomButton(buttons_frame, text=app_name, command=lambda app_name=app_name: self.load_app(app_name, app_func), font=('Helvetica', 12))
|
179
|
+
|
178
180
|
test_mode_button.grid(row=47, column=1, pady=10, padx=10)
|
179
|
-
import_btn = CustomButton(scrollable_frame.scrollable_frame, text="Import", command=lambda: import_settings(scrollable_frame))
|
181
|
+
import_btn = CustomButton(scrollable_frame.scrollable_frame, text="Import", command=lambda: import_settings(scrollable_frame), font=('Helvetica', 10))
|
180
182
|
import_btn.grid(row=47, column=0, pady=10, padx=10)
|
181
183
|
run_button = CustomButton(scrollable_frame.scrollable_frame, text="Run", command=lambda: start_process(q, fig_queue))
|
182
184
|
run_button.grid(row=45, column=0, pady=10, padx=10)
|
183
|
-
abort_button = CustomButton(scrollable_frame.scrollable_frame, text="Abort", command=initiate_abort)
|
185
|
+
abort_button = CustomButton(scrollable_frame.scrollable_frame, text="Abort", command=initiate_abort, font=('Helvetica', 10))
|
184
186
|
abort_button.grid(row=45, column=1, pady=10, padx=10)
|
185
187
|
progress_label = ttk.Label(scrollable_frame.scrollable_frame, text="Processing: 0%", background="black", foreground="white")
|
186
188
|
progress_label.grid(row=50, column=0, columnspan=2, sticky="ew", pady=(5, 0), padx=10)
|
@@ -223,7 +225,9 @@ def initiate_mask_root(parent_frame):
|
|
223
225
|
|
224
226
|
def gui_mask():
|
225
227
|
root = tk.Tk()
|
226
|
-
root.
|
228
|
+
width = root.winfo_screenwidth()
|
229
|
+
height = root.winfo_screenheight()
|
230
|
+
root.geometry(f"{width}x{height}")
|
227
231
|
root.title("SpaCr: generate masks")
|
228
232
|
|
229
233
|
# Clear previous content if any
|
spacr/gui_measure_app.py
CHANGED
@@ -19,6 +19,15 @@ from .gui_utils import measure_variables, measure_crop_wrapper, clear_canvas, ch
|
|
19
19
|
|
20
20
|
thread_control = {"run_thread": None, "stop_requested": False}
|
21
21
|
|
22
|
+
def import_settings(scrollable_frame):
|
23
|
+
global vars_dict
|
24
|
+
|
25
|
+
csv_file_path = filedialog.askopenfilename(filetypes=[("CSV files", "*.csv")])
|
26
|
+
csv_settings = read_settings_from_csv(csv_file_path)
|
27
|
+
variables = measure_variables()
|
28
|
+
new_settings = update_settings_from_csv(variables, csv_settings)
|
29
|
+
vars_dict = generate_fields(new_settings, scrollable_frame)
|
30
|
+
|
22
31
|
def toggle_test_mode():
|
23
32
|
global vars_dict
|
24
33
|
current_state = vars_dict['test_mode'][2].get()
|
@@ -166,11 +175,11 @@ def initiate_measure_root(parent_frame):
|
|
166
175
|
# Button section
|
167
176
|
test_mode_button = CustomButton(scrollable_frame.scrollable_frame, text="Test Mode", command=toggle_test_mode)
|
168
177
|
test_mode_button.grid(row=47, column=1, pady=10, padx=10)
|
169
|
-
import_btn = CustomButton(scrollable_frame.scrollable_frame, text="Import
|
178
|
+
import_btn = CustomButton(scrollable_frame.scrollable_frame, text="Import", command=lambda: import_settings(scrollable_frame), font=('Helvetica', 10))
|
170
179
|
import_btn.grid(row=47, column=0, pady=20, padx=20)
|
171
|
-
run_button = CustomButton(scrollable_frame.scrollable_frame, text="Run", command=lambda: start_process(q, fig_queue))
|
180
|
+
run_button = CustomButton(scrollable_frame.scrollable_frame, text="Run", command=lambda: start_process(q, fig_queue), font=('Helvetica', 10))
|
172
181
|
run_button.grid(row=45, column=0, pady=20, padx=20)
|
173
|
-
abort_button = CustomButton(scrollable_frame.scrollable_frame, text="Abort", command=initiate_abort)
|
182
|
+
abort_button = CustomButton(scrollable_frame.scrollable_frame, text="Abort", command=initiate_abort, font=('Helvetica', 10))
|
174
183
|
abort_button.grid(row=45, column=1, pady=20, padx=20)
|
175
184
|
progress_label = ttk.Label(scrollable_frame.scrollable_frame, text="Processing: 0%", background="black", foreground="white") # Create progress field
|
176
185
|
progress_label.grid(row=50, column=0, columnspan=2, sticky="ew", pady=(5, 0), padx=10)
|
@@ -211,10 +220,11 @@ def initiate_measure_root(parent_frame):
|
|
211
220
|
|
212
221
|
return parent_frame, vars_dict
|
213
222
|
|
214
|
-
|
215
223
|
def gui_measure():
|
216
224
|
root = tk.Tk()
|
217
|
-
root.
|
225
|
+
width = root.winfo_screenwidth()
|
226
|
+
height = root.winfo_screenheight()
|
227
|
+
root.geometry(f"{width}x{height}")
|
218
228
|
root.title("SpaCr: measure objects")
|
219
229
|
|
220
230
|
# Clear previous content if any
|
spacr/gui_run.py
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
import traceback
|
2
|
+
from .gui_wrappers import measure_crop_wrapper, preprocess_generate_masks_wrapper, train_test_model_wrapper, umap_wrapper, sequencing_wrapper
|
3
|
+
|
4
|
+
def run_mask_gui(settings, q, fig_queue, stop_requested):
|
5
|
+
from .gui_utils import process_stdout_stderr
|
6
|
+
process_stdout_stderr(q)
|
7
|
+
try:
|
8
|
+
preprocess_generate_masks_wrapper(settings, q, fig_queue)
|
9
|
+
except Exception as e:
|
10
|
+
q.put(f"Error during processing: {e}")
|
11
|
+
traceback.print_exc()
|
12
|
+
finally:
|
13
|
+
stop_requested.value = 1
|
14
|
+
|
15
|
+
def run_sequencing_gui(settings, q, fig_queue, stop_requested):
|
16
|
+
from .gui_utils import process_stdout_stderr
|
17
|
+
process_stdout_stderr(q)
|
18
|
+
try:
|
19
|
+
sequencing_wrapper(settings, q, fig_queue)
|
20
|
+
except Exception as e:
|
21
|
+
q.put(f"Error during processing: {e}")
|
22
|
+
traceback.print_exc()
|
23
|
+
finally:
|
24
|
+
stop_requested.value = 1
|
25
|
+
|
26
|
+
def run_umap_gui(settings, q, fig_queue, stop_requested):
|
27
|
+
from .gui_utils import process_stdout_stderr
|
28
|
+
process_stdout_stderr(q)
|
29
|
+
try:
|
30
|
+
umap_wrapper(settings, q, fig_queue)
|
31
|
+
except Exception as e:
|
32
|
+
q.put(f"Error during processing: {e}")
|
33
|
+
traceback.print_exc()
|
34
|
+
finally:
|
35
|
+
stop_requested.value = 1
|
36
|
+
|
37
|
+
def run_measure_gui(settings, q, fig_queue, stop_requested):
|
38
|
+
from .gui_utils import process_stdout_stderr
|
39
|
+
process_stdout_stderr(q)
|
40
|
+
try:
|
41
|
+
settings['input_folder'] = settings['src']
|
42
|
+
measure_crop_wrapper(settings=settings, q=q, fig_queue=fig_queue)
|
43
|
+
except Exception as e:
|
44
|
+
q.put(f"Error during processing: {e}")
|
45
|
+
traceback.print_exc()
|
46
|
+
finally:
|
47
|
+
stop_requested.value = 1
|
48
|
+
|
49
|
+
def run_classify_gui(settings, q, fig_queue, stop_requested):
|
50
|
+
from .gui_utils import process_stdout_stderr
|
51
|
+
process_stdout_stderr(q)
|
52
|
+
try:
|
53
|
+
train_test_model_wrapper(settings['src'], settings)
|
54
|
+
except Exception as e:
|
55
|
+
q.put(f"Error during processing: {e}")
|
56
|
+
traceback.print_exc()
|
57
|
+
finally:
|
58
|
+
stop_requested.value = 1
|