-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathvaila.py
More file actions
3271 lines (2717 loc) · 113 KB
/
Copy pathvaila.py
File metadata and controls
3271 lines (2717 loc) · 113 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
===============================================================================
vaila.py
===============================================================================
Author: Paulo Roberto Pereira Santiago
Email: paulosantiago@usp.br
GitHub: https://github.com/vaila-multimodaltoolbox/vaila
Creation Date: 07 October 2024
Update Date: 23 June 2026
Version: 0.3.56
Example of usage:
uv run vaila.py
Description:
------------
vailá (Versatile Anarcho Integrated Liberation Ánalysis) is an open-source,
Python-based multimodal toolbox designed to streamline biomechanical data
analysis. It integrates multiple types of biomechanical data (e.g., IMU, motion
capture, markerless tracking, force plates, GNSS/GPS, EMG and more. Use your imagination!) into a unified,
flexible platform for advanced human movement analysis. The software was
developed with a modular architecture to ensure easy expansion, transparency,
and community-driven contributions.
vailá offers batch processing of large datasets, multimodal data analysis,
and cross-platform compatibility (Linux, macOS, Windows). It is developed to
handle complex biomechanical workflows, including kinematic and kinetic data
processing, visualization, and data conversion, as discussed in the associated
paper. The system fosters a collaborative, transparent environment for research,
allowing users to customize and expand the toolbox with new functionalities.
Usage:
------
- Run this script to launch the main graphical user interface (GUI) built with
Tkinter.
- The GUI offers:
- **File Management (Frame A)**: Tools for renaming, importing, exporting, and
manipulating large sets of files.
- **Multimodal Analysis (Frame B)**: Tools for analyzing biomechanical data
(e.g., MoCap, IMU, and markerless tracking).
- **Available Tools (Frame C)**: Data conversion, video/image processing,
DLT-based 2D/3D reconstructions, and visualization tools.
- **Open Field Test Analysis (Frame D)**: Tools for analyzing open field test
data, providing insights into animal behavior and movement patterns.
License:
--------
This program is licensed under the GNU Affero General Public License v3.0.
For more details, visit: https://www.gnu.org/licenses/agpl-3.0.html
Visit the project repository: https://github.com/vaila-multimodaltoolbox
===============================================================================
"""
# Standard library imports
import contextlib
import importlib.util
import os
import platform
import signal
import subprocess
import sys
# Third-party imports
import tkinter as tk
import webbrowser
from pathlib import Path
from tkinter import Button, Label, Radiobutton, Toplevel, messagebox, simpledialog, ttk
from PIL import Image, ImageTk
from rich import print
def _sam3_install_instructions() -> str:
"""SAM 3 setup text shared by terminal output and GUI error dialogs."""
return (
"SAM 3 is not installed.\n\n"
"Install the optional stack, then restart vailá:\n"
" uv sync --extra sam\n\n"
"NVIDIA CUDA workstation:\n"
" bash bin/setup_pyproject.sh --target=linux-cuda --extras=gpu,sam --yes\n"
" # or, after CUDA template is active:\n"
" uv sync --extra gpu --extra sam\n\n"
"Windows NVIDIA CUDA workstation:\n"
" pwsh bin/setup_pyproject.ps1 -Target win-cuda -Extras gpu,sam -Yes\n\n"
"After install, accept the gated Hugging Face model and authenticate:\n"
" uv run hf auth login\n"
" uv run vaila/vaila_sam.py --download-weights\n\n"
"CLI help / examples:\n"
" uv run vaila/vaila_sam.py --open-help\n"
" uv run vaila/vaila_sam.py --print-examples\n\n"
"Runtime note: SAM 3 video requires NVIDIA CUDA. CPU and macOS Metal/MPS are "
"not supported for this integration.\n"
"See also: AGENTS.md - Hybrid CPU vs NVIDIA workstation."
)
def _print_sam3_install_instructions() -> None:
print("\n" + "=" * 72, file=sys.stderr)
print(_sam3_install_instructions(), file=sys.stderr)
print("=" * 72 + "\n", file=sys.stderr)
# Add the vaila directory to Python path to ensure modules can be found
# This is especially important when vaila is installed and not run from the source directory
vaila_dir = os.path.dirname(os.path.abspath(__file__))
if vaila_dir not in sys.path:
sys.path.insert(0, vaila_dir)
def run_vaila_module(module_name, script_path=None, *, extra_py_flags=()):
"""
Helper function to run vaila modules with proper path configuration.
Args:
module_name (str): The module name to run (e.g., "vaila.markerless_2d_analysis")
script_path (str, optional): Alternative script path if module import fails
extra_py_flags: Extra flags after ``sys.executable`` (e.g. ``("-u",)`` for unbuffered SAM subprocess logs)
"""
def _activate_pid_macos(pid):
if platform.system() == "Darwin" and pid:
try:
cmd = f"sleep 0.5 && osascript -e 'tell application \"System Events\" to set frontmost of the first process whose unix id is {pid} to true'"
subprocess.Popen(
cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
)
except Exception:
pass
# If script_path is provided, try to run it directly first (avoids __init__.py import issues)
if script_path:
try:
full_script_path = os.path.join(vaila_dir, "vaila", script_path)
if not os.path.exists(full_script_path):
# Try without vaila prefix
full_script_path = os.path.join(vaila_dir, script_path)
if os.path.exists(full_script_path):
print(f"Running script directly: {full_script_path}")
proc = subprocess.Popen(
[sys.executable, *extra_py_flags, full_script_path],
cwd=vaila_dir,
env={**os.environ, "PYTHONPATH": vaila_dir},
)
_activate_pid_macos(proc.pid)
return
else:
print(f"Warning: Script path not found: {full_script_path}")
except Exception as e:
print(f"Error running script directly: {e}")
# Fall through to try module import
try:
# Try to run the module directly (will import __init__.py)
print(f"Running module: {module_name}")
proc = subprocess.Popen(
[sys.executable, *extra_py_flags, "-m", module_name],
cwd=vaila_dir,
env={**os.environ, "PYTHONPATH": vaila_dir},
)
_activate_pid_macos(proc.pid)
except Exception as e:
print(f"Error launching {module_name}: {e}")
if script_path:
# Fallback: try to run the script file directly
try:
full_script_path = os.path.join(vaila_dir, "vaila", script_path)
if not os.path.exists(full_script_path):
full_script_path = os.path.join(vaila_dir, script_path)
proc = subprocess.Popen(
[sys.executable, *extra_py_flags, full_script_path],
cwd=vaila_dir,
env={**os.environ, "PYTHONPATH": vaila_dir},
)
_activate_pid_macos(proc.pid)
except Exception as e2:
print(f"Fallback also failed: {e2}")
import traceback
traceback.print_exc()
messagebox.showerror("Error", f"Could not launch {module_name}:\n{e}\n\n{e2}")
else:
import traceback
traceback.print_exc()
messagebox.showerror("Error", f"Could not launch {module_name}: {e}")
# Conditionally import platform-specific functionality
# Define a global variable to track if AppKit is available
# This is used to set the application name in the dock for macOS
APPKIT_AVAILABLE = False
if platform.system() == "Darwin": # macOS
try:
import AppKit # macOS only ignore this line in other OS # type: ignore
APPKIT_AVAILABLE = True
except ImportError:
# Silently continue if AppKit is not available
print("AppKit not available. Application name in dock might not be set correctly.")
pass
text = r"""
vailá - 23.Jun.2026 v0.3.56 (Python 3.12.13)
o
_, o |\ _,/
| |_/ | | |/ / |
\/ \/|_/|/|_/\/|_/
##########################################################################
Mocap fullbody_c3d Markerless_3D Markerless_2D_MP and YOLO
\ | /
v v v
CUBE2D --> +---------------------------------------+ <-- Vector Coding
IMU_csv --> | | <-- Cluster_csv
Open Field --> | vailá - multimodal toolbox | <-- Force Plate
StartBlock -->| | <-- GRF Analysis
etc, etc. --> +---------------------------------------+ <-- etc, etc, etc.
|
V
+---------------------------------------------------+
| Processed Data, Figures and Reports etc, etc, etc.|
+---------------------------------------------------+
============================ File Manager (Frame A) ========================
A_r1_c1 - Rename A_r1_c2 - Import A_r1_c3 - Export
A_r1_c4 - Copy A_r1_c5 - Move A_r1_c6 - Remove
A_r1_c7 - Tree A_r1_c8 - Find A_r1_c9 - Transfer
========================== Multimodal Analysis (Frame B) ===================
B1_r1_c1 - IMU B1_r1_c2 - Motion Capture Cluster
B1_r1_c3 - Motion Capture Full Body B1_r1_c4 - Markerless 2D
B1_r1_c5 - Markerless 3D
B2_r2_c1 - Vector Coding B2_r2_c2 - EMG B2_r2_c3 - Force Plate
B2_r2_c4 - GNSS/GPS B2_r2_c5 - MEG/EEG
B3_r3_c1 - HR/ECG B3_r3_c2 - Yolo + Markerless_MP
B3_r3_c3 - Vertical Jump
B3_r3_c4 - Cube2D B3_r3_c5 - Animal Open Field
B4_r4_c1 - YOLO + SAM B4_r4_c2 - ML Walkway B4_r4_c3 - Markerless Hands
B4_r4_c4 - MP Angles B4_r4_c5 - Markerless Live
B5_r5_c1 - Ultrasound B5_r5_c2 - Brainstorm B5_r5_c3 - Scout
B5_r5_c4 - Start Block B5_r5_c5 - Pynalty
B5_r6_c1 - Sprint B5_r6_c2 - Face Mesh B5_r6_c3 - tugturn
B5_r6_c4 - Soccer Tools B5_r6_c5 - vailá
B6_r7_c1 - vailá B6_r7_c2 - vailá B6_r7_c3 - vailá
B6_r7_c4 - vailá B6_r7_c5 - vailá
============================== Tools Available (Frame C) ===================
-> C_A: Data Files
C_A_r1_c1 - Edit CSV C_A_r1_c2 - C3D <--> CSV C_A_r1_c3 - Smooth & Filter
C_A_r2_c1 - Make DLT2D C_A_r2_c2 - Rec2D 1DLT C_A_r2_c3 - Rec2D MultiDLT
C_A_r3_c1 - Make DLT3D C_A_r3_c2 - Rec3D 1DLT C_A_r3_c3 - Rec3D MultiDLT
C_A_r4_c1 - ReID Marker C_A_r4_c2 - vailá C_A_r4_c3 - vailá
-> C_B: Video and Image
C_B_r1_c1 - Video<-->PNG C_B_r1_c2 - Crop Face C_B_r1_c3 - Draw Box
C_B_r2_c1 - Compress Video C_B_r2_c2 - vailá C_B_r2_c3 - Make Sync file
C_B_r3_c1 - GetPixelCoord C_B_r3_c2 - Metadata info C_B_r3_c3 - Merge|Split Video
C_B_r4_c1 - Distort Video/data C_B_r4_c2 - Cut Video C_B_r4_c3 - Resize Video
C_B_r5_c1 - YT Downloader C_B_r5_c2 - Insert Audio C_B_r5_c3 - rm Dup PNG
-> C_C: Visualization
C_C_r1_c1 - Show C3D C_C_r1_c2 - Show CSV 3D C_C_r2_c1 - Plot 2D
C_C_r2_c2 - Plot 3D C_C_r3_c1 - Draw Sports C_C_r3_c2 - Stroboscopic
C_C_r4_c1 - vailá C_C_r4_c2 - vailá C_C_r4_c3 - vailá
C_C_r5_c1 - vailá C_C_r5_c2 - vailá C_C_r5_c3 - vailá
Type 'h' for help or 'exit' to quit.
Use the button 'imagination!' to access command-line (xonsh) tools for advanced multimodal analysis!
"""
print(text)
def open_folder_cross_platform(path):
if platform.system() == "Windows":
os.startfile(path) # type: ignore
elif platform.system() == "Darwin":
subprocess.Popen(["open", path])
else: # Linux
# Try different file managers for Linux
try:
subprocess.Popen(["dolphin", path]) # KDE file manager first
except FileNotFoundError:
try:
subprocess.Popen(["nautilus", path]) # GNOME file manager
except FileNotFoundError:
try:
subprocess.Popen(["thunar", path]) # XFCE file manager
except FileNotFoundError:
try:
subprocess.Popen(["xdg-open", path]) # fallback to xdg-open
except FileNotFoundError:
print(f"Could not open folder: {path}")
class Vaila(tk.Tk):
def __init__(self):
"""
Initializes the Vaila application.
- Sets the window title, geometry, button dimensions, and font size based on the operating system.
- Configures the window icon based on the operating system.
- For macOS, sets the application name in the dock if AppKit is available.
- Creates the widgets for the application.
"""
super().__init__(className="vaila")
self.title("vailá - 23.Jun.2026 v0.3.56 (Python 3.12.13)")
# wm class is set via className above, which results in class "Vaila"
# This is needed for proper icon association in Linux docks/taskbars
# Adjust dimensions and layout based on the operating system
self.set_dimensions_based_on_os()
self.resizable(True, True)
# Configure the window icon based on the operating system
icon_path_ico = os.path.join(os.path.dirname(__file__), "vaila", "images", "vaila.ico")
icon_path_png = os.path.join(
os.path.dirname(__file__), "vaila", "images", "vaila_ico_mac.png"
)
if platform.system() == "Windows":
self.iconbitmap(icon_path_ico) # Set .ico file for Windows
else:
# Set .png icon for macOS and Linux
try:
icon = tk.PhotoImage(file=icon_path_png)
self.iconphoto(True, icon)
except Exception as e:
print(f"Could not set icon: {e}")
# For macOS, set the application name in the dock if AppKit is available
if platform.system() == "Darwin" and APPKIT_AVAILABLE: # macOS with AppKit
try:
AppKit.NSBundle.mainBundle().infoDictionary()["CFBundleName"] = "vailá"
except Exception as e:
print(f"Could not set application name: {e}")
# Call method to create the widgets
self.create_widgets()
def set_dimensions_based_on_os(self):
"""
Adjusts the window dimensions, button width, and font size based on the operating system.
"""
if platform.system() == "Darwin": # macOS
self.geometry("1280x800") # Adjusted window for macOS laptop screens
self.button_width = 10 # Wider buttons for better layout
self.font_size = 11 # Standard font size
elif platform.system() == "Windows": # Windows
self.geometry("1024x920") # Compact horizontal size for Windows
self.button_width = 13 # Narrower buttons for reduced width
self.font_size = 11 # Standard font size
elif platform.system() == "Linux": # Linux
self.geometry("1300x920") # Similar to macOS dimensions for Linux
self.button_width = 15 # Wider buttons
self.font_size = 11 # Standard font size
else: # Default for other systems
self.geometry("1024x920") # Default dimensions
self.button_width = 15 # Default button width
self.font_size = 11 # Default font size
def create_widgets(self):
"""
Creates the widgets of the application.
"""
button_width = self.button_width # Use the adjusted button width
font = ("default", self.font_size) # Use the length-adjusted font
# Header with program name and description
header_frame = tk.Frame(self)
header_frame.pack(pady=10)
# Load and place the image
image_path_preto = os.path.join(
os.path.dirname(__file__), "vaila", "images", "vaila_logo.png"
)
preto_image = Image.open(image_path_preto)
# Resize the image in the most compatible way
preto_image = preto_image.resize((87, 87)) # Use default filter
# Create and keep a reference to the PhotoImage
preto_photo = ImageTk.PhotoImage(preto_image)
# Create the label with the image
preto_label = tk.Label(header_frame, image=preto_photo)
self._preto_photo = preto_photo # Store as instance attribute to prevent garbage collection
preto_label.pack(side="left", padx=10)
# Label clickable 'vailá'
vaila_click = tk.Label(
header_frame,
text="vailá",
font=("default", self.font_size, "italic"),
fg="blue",
cursor="hand2",
)
vaila_click.pack(side="left")
# When clicked, open the execution directory
vaila_click.bind(
"<Button-1>",
lambda e: open_folder_cross_platform(os.getcwd()),
)
# Static label restante
toolbox_label = tk.Label(
header_frame,
text=" - Multimodal Toolbox",
font=font,
anchor="center",
)
toolbox_label.pack(side="left")
# Subheader with hyperlink for "vailá"
subheader_frame = tk.Frame(self)
subheader_frame.pack(pady=5)
subheader_label1 = tk.Label(
subheader_frame,
text="Versatile Anarcho Integrated Liberation Ánalysis in Multimodal Toolbox",
font=font, # Correct font adjustment
anchor="center",
)
subheader_label1.pack()
subheader_label2_frame = tk.Frame(subheader_frame)
subheader_label2_frame.pack()
vaila_link = tk.Label(
subheader_label2_frame,
text="vailá",
font=("default", self.font_size, "italic"),
fg="blue",
cursor="hand2",
)
vaila_link.pack(side="left")
vaila_link.bind("<Button-1>", lambda e: self.open_link())
# Keep the button imagination in mind
unleash_label1 = tk.Label(
subheader_label2_frame,
text=" and unleash your ",
font=font,
anchor="center",
)
unleash_label1.pack(side="left")
unleash_button = tk.Button(
subheader_label2_frame,
text="imagination!",
font=font,
command=self.open_terminal_shell,
)
unleash_button.pack(side="left")
# Create a canvas to add scrollbar
canvas = tk.Canvas(self)
# Create scrollbars
v_scrollbar = ttk.Scrollbar(self, orient="vertical", command=canvas.yview)
h_scrollbar = ttk.Scrollbar(self, orient="horizontal", command=canvas.xview)
# Pack scrollbars and canvas
# Pack horizontal scrollbar at the bottom first
h_scrollbar.pack(side=tk.BOTTOM, fill="x")
# Pack vertical scrollbar at the right
v_scrollbar.pack(side=tk.RIGHT, fill="y")
# Pack canvas to fill the rest
canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
# Configure canvas
canvas.configure(yscrollcommand=v_scrollbar.set, xscrollcommand=h_scrollbar.set)
# Create a frame inside the canvas to hold all content
scrollable_frame = tk.Frame(canvas)
scrollable_frame.bind(
"<Configure>", lambda e: canvas.configure(scrollregion=canvas.bbox("all"))
)
# Add the scrollable frame to the canvas
canvas.create_window((0, 0), window=scrollable_frame, anchor="nw")
"""
A - File Manager Avaliable:
- Rename
- Import
- Export
- Copy
- Move
- Remove
- Tree
- Find
- Transfer
"""
# A - File Manager Block FRAME
file_manager_frame = tk.LabelFrame(
scrollable_frame,
text="File Manager",
padx=5,
pady=5,
font=("default", 17),
labelanchor="n",
)
file_manager_frame.pack(pady=10, fill="x")
file_manager_btn_frame = tk.Frame(file_manager_frame)
file_manager_btn_frame.pack(pady=5)
## VVVVVVVVVV File Manager Buttons VVVVVVVVV
# A_r1_c1 - File Manager Button: Rename
rename_btn = tk.Button(
file_manager_btn_frame,
text="Rename",
command=self.rename_files,
width=button_width,
)
# A_r1_c2 - File Manager Button: Import
import_btn = tk.Button(
file_manager_btn_frame,
text="Import",
command=self.import_file,
width=button_width,
)
# A_r1_c3 - File Manager Button: Export
export_btn = tk.Button(
file_manager_btn_frame,
text="Export",
command=self.export_file,
width=button_width,
)
# A_r1_c4 - File Manager Button: Copy
copy_btn = tk.Button(
file_manager_btn_frame,
text="Copy",
command=self.copy_file,
width=button_width,
)
# A_r1_c5 - File Manager Button: Move
move_btn = tk.Button(
file_manager_btn_frame,
text="Move",
command=self.move_file,
width=button_width,
)
# A_r1_c6 - File Manager Button: Remove
remove_btn = tk.Button(
file_manager_btn_frame,
text="Remove",
command=self.remove_file,
width=button_width,
)
# A_r1_c7 - File Manager Button: Tree
tree_btn = tk.Button(
file_manager_btn_frame,
text="Tree",
command=self.tree_file,
width=button_width,
)
# A_r1_c8 - File Manager Button: Find
find_btn = tk.Button(
file_manager_btn_frame,
text="Find",
command=self.find_file,
width=button_width,
)
# A_r1_c9 - File Manager Button: Transfer
transfer_btn = tk.Button(
file_manager_btn_frame,
text="Transfer",
command=self.transfer_file,
width=button_width,
)
## VVVVVVVVVV FILE MANAGER BUTTON VVVVVVVVV
rename_btn.pack(side="left", padx=2, pady=2)
import_btn.pack(side="left", padx=2, pady=2)
export_btn.pack(side="left", padx=2, pady=2)
copy_btn.pack(side="left", padx=2, pady=2)
move_btn.pack(side="left", padx=2, pady=2)
remove_btn.pack(side="left", padx=2, pady=2)
tree_btn.pack(side="left", padx=2, pady=2)
find_btn.pack(side="left", padx=2, pady=2)
transfer_btn.pack(side="left", padx=2, pady=2)
"""
B - Multimodal Analysis Available:
B1:
- IMU
- Motion Capture Cluster
- Motion Capture Full Body
- Markerless 2D
- Markerless 3D
B2:
- Vector Coding
- EMG
- Force Plate
- GNSS/GPS
- MEG/EEG
B3:
- HR/ECG
- Markerless_MP_Yolo
- vailá_and_jump
- Cube2D
- Animal Open Field
B4:
- Tracker
- ML Walkway
- Markerless Hands
- MP Angles
- Markerless Live
B5:
- Ultrasound
- Brainstorm
- Scout
- Start Block
- Pynalty
B6:
- Sprint
- Face Mesh
- tugturn
- SAM
- Soccer-Field Calib
B6_r7:
- vailá (×5 placeholders)
"""
# B - Multimodal Analysis FRAME
analysis_frame = tk.LabelFrame(
scrollable_frame,
text="Multimodal Analysis",
padx=5,
pady=5,
font=("default", 17),
labelanchor="n",
)
analysis_frame.pack(pady=10, fill="x")
# Define row4_frame before using it
row4_frame = tk.Frame(analysis_frame)
row4_frame.pack(fill="x")
# Create row5_frame
row5_frame = tk.Frame(analysis_frame)
row5_frame.pack(fill="x")
# VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
## Insert the buttons for each Multimodal Toolbox Analysis
# Buttons for each Multimodal Toolbox Analysis
# B - Multimodal Analysis Buttons
# B1_r1_c1 - IMU
row1_frame = tk.Frame(analysis_frame)
row1_frame.pack(fill="x")
imu_analysis_btn = tk.Button(
row1_frame, text="IMU", width=button_width, command=self.imu_analysis
)
# B1_r1_c2 - Motion Capture Cluster
cluster_analysis_btn = tk.Button(
row1_frame,
text="Motion Capture Cluster",
width=button_width,
command=self.cluster_analysis,
)
# B1_r1_c3 - Motion Capture Full Body
mocap_analysis_btn = tk.Button(
row1_frame,
text="Motion Capture Full Body",
width=button_width,
command=self.mocap_analysis,
)
# B1_r1_c4 - Markerless 2D
markerless_2d_analysis_btn = tk.Button(
row1_frame,
text="Markerless 2D",
width=button_width,
command=self.markerless_2d_analysis,
)
# B1_r1_c5 - Markerless 3D
markerless_3d_analysis_btn = tk.Button(
row1_frame,
text="Markerless 3D",
width=button_width,
command=self.markerless_3d_analysis,
)
# Pack the buttons
imu_analysis_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
cluster_analysis_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
mocap_analysis_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
markerless_2d_analysis_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
markerless_3d_analysis_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
# B2 - Multimodal Toolbox: Second row of buttons (EMG, Force Plate, GNSS/GPS, MEG/EEG)
row2_frame = tk.Frame(analysis_frame)
row2_frame.pack(fill="x")
# B2_r2_c1 - Vector Coding
vector_coding_btn = tk.Button(
row2_frame,
text="Vector Coding",
width=button_width,
command=self.vector_coding,
)
# B2_r2_c2 - EMG
emg_analysis_btn = tk.Button(
row2_frame,
text="EMG",
width=button_width,
command=self.emg_analysis,
)
# B2_r2_c3 - Force Plate
forceplate_btn = tk.Button(
row2_frame,
text="Force Plate",
width=button_width,
command=self.force_analysis,
)
# B2_r2_c4 - GNSS/GPS
gnss_btn = tk.Button(
row2_frame,
text="GNSS/GPS",
width=button_width,
command=self.gnss_analysis,
)
# B2_r2_c5 - MEG/EEG
vaila_btn3 = tk.Button(
row2_frame,
text="MEG/EEG",
width=button_width,
# Provisory button redirecting to https://mne.tools/dev/auto_tutorials/intro/10_overview.html
command=lambda: webbrowser.open(
"https://mne.tools/dev/auto_tutorials/intro/10_overview.html"
),
# command=self.meg_eeg_analysis,
)
# Pack the buttons
vector_coding_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
emg_analysis_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
forceplate_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
gnss_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
vaila_btn3.pack(side="left", expand=True, fill="x", padx=2, pady=2)
# 3 - Multimodal Toolbox Analysis: Third row of buttons (HR/ECG, vailá, vailá_and_jump, vailá)
# B3_r3_c1 - HR/ECG
row3_frame = tk.Frame(analysis_frame)
row3_frame.pack(fill="x")
ecg_btn = tk.Button(
row3_frame,
text="HR/ECG",
width=button_width,
# Provisory button redirecting to https://github.com/paulvangentcom/heartrate_analysis_python
command=lambda: webbrowser.open(
"https://github.com/paulvangentcom/heartrate_analysis_python"
),
# command=self.heart_rate_analysis,
)
# B3_r3_c2 - markerless2d_mpyolo
markerless2d_mpyolo_btn = tk.Button(
row3_frame,
text="Yolo + Markerless_MP",
width=button_width,
command=self.markerless2d_mpyolo,
)
# B3_r3_c3 - vaila_and_jump
vailajump_btn = tk.Button(
row3_frame,
text="Vertical Jump",
width=button_width,
command=self.vailajump,
)
# B3_r3_c4 - Cube2D
cube2d_btn = tk.Button(
row3_frame,
text="Cube2D",
width=button_width,
command=self.cube2d_kinematics,
)
# B3_r3_c5 - Animal Open Field
vaila_animalof = tk.Button(
row3_frame,
text="Animal Open Field",
width=button_width,
command=self.animal_open_field,
)
# Pack row3 buttons
ecg_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
markerless2d_mpyolo_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
vailajump_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
cube2d_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
vaila_animalof.pack(side="left", expand=True, fill="x", padx=2, pady=2)
# Create row4_frame
row4_frame = tk.Frame(analysis_frame)
row4_frame.pack(fill="x")
# B4_r4_c1 - YOLO + SAM
yolo_and_sam_btn = tk.Button(
row4_frame,
text="YOLO + SAM",
width=button_width,
command=self.yolo_and_sam,
)
# B4_r4_c2 - ML Walkway
mlwalkway_btn = tk.Button(
row4_frame,
text="ML Walkway",
width=button_width,
command=self.ml_walkway,
)
# B4_r4_c3 - Markerless Hands
mphands_btn = tk.Button(
row4_frame,
text="Markerless Hands",
width=button_width,
command=self.markerless_hands,
)
# B4_r4_c4 - MP Angles
mpangles_btn = tk.Button(
row4_frame,
text="MP Angles",
width=button_width,
command=self.mp_angles_calculation,
)
# B4_r4_c5 - Markerless Live
markerlesslive_btn = tk.Button(
row4_frame,
text="Markerless Live",
width=button_width,
command=self.markerless_live,
)
# Pack row4 buttons
yolo_and_sam_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
mlwalkway_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
mphands_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
mpangles_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
markerlesslive_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
# B5 - Fifth row of buttons (Ultrasound, vailá, vailá, vailá, vailá)
row5_frame = tk.Frame(analysis_frame)
row5_frame.pack(fill="x")
# B5_r5_c1 - Ultrasound
ultrasound_btn = tk.Button(
row5_frame,
text="Ultrasound",
width=button_width,
command=self.ultrasound,
)
# B5_r5_c2 - Brainstorm
brainstorm_btn = tk.Button(
row5_frame,
text="Brainstorm",
width=button_width,
command=self.brainstorm,
)
# B5_r5_c3 - Scout
scout_btn = tk.Button(
row5_frame,
text="Scout",
width=button_width,
command=self.scout,
)
# B5_r5_c4 - Start Block
startblock_btn = tk.Button(
row5_frame,
text="Start Block",
width=button_width,
command=self.startblock,
)
# B5_r5_c5 - Pynalty
pynalty_btn = tk.Button(
row5_frame,
text="Pynalty",
width=button_width,
command=self.pynalty,
)
# Pack row5 buttons
ultrasound_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
brainstorm_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
scout_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
startblock_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
pynalty_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
# B6 - Sixth row of buttons (Sprint, vailá, vailá, vailá, vailá)
row6_frame = tk.Frame(analysis_frame)
row6_frame.pack(fill="x")
# B5_r6_c1 - Sprint
sprint_btn = tk.Button(
row6_frame,
text="Sprint",
width=button_width,
command=self.sprint,
)
# B5_r6_c2 - Face Mesh
face_mesh_btn = tk.Button(
row6_frame,
text="Face Mesh",
width=button_width,
command=self.face_mesh_analysis,
)
# B5_r6_c3 - tugturn
tugturn_btn = tk.Button(
row6_frame,
text="tugturn",
command=self.tugturn,
width=button_width,
)
# B5_r6_c4 - vailá placeholder
soccer_tools_btn = tk.Button(
row6_frame,
text="Soccer Tools",
command=self.soccer_tools,
width=button_width,
)
# B5_r6_c5 - Deadlift
deadlift_btn = tk.Button(
row6_frame,
text="Deadlift",
command=self.deadlift_analysis,
width=button_width,
)
# Pack row6 buttons
sprint_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
face_mesh_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
tugturn_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
soccer_tools_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
deadlift_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
# B6_r7 — seventh row: generic vailá placeholders (B6_r7_c1 .. B6_r7_c5)
row7_frame = tk.Frame(analysis_frame)
row7_frame.pack(fill="x")
vaila_b6_r7_c1 = tk.Button(
row7_frame,
text="vailá",
width=button_width,
command=self.show_vaila_message,
)
vaila_b6_r7_c2 = tk.Button(
row7_frame,
text="vailá",
width=button_width,
command=self.show_vaila_message,
)
vaila_b6_r7_c3 = tk.Button(
row7_frame,
text="vailá",
width=button_width,
command=self.show_vaila_message,
)
vaila_b6_r7_c4 = tk.Button(
row7_frame,
text="vailá",
width=button_width,
command=self.show_vaila_message,
)
vaila_b6_r7_c5 = tk.Button(
row7_frame,