-
Notifications
You must be signed in to change notification settings - Fork 1
/
vaila.py
executable file
·1731 lines (1425 loc) · 62.4 KB
/
vaila.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
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 R. P. Santiago
Date: 21 Nov 2024
Version: 0.07
Python Version: 3.11
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) 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.
Key Features:
-------------
1. **Multimodal Data Integration**:
- Supports data from IMUs, markerless tracking (2D and 3D), MoCap systems,
force plates, GNSS/GPS, EMG, and other biomechanical sensors.
2. **Data Processing and Batch Operations**:
- Batch processing for large datasets across modalities, including video
synchronization, pixel extraction, DLT-based 2D/3D reconstructions, and
force analysis.
3. **Data Conversion and File Management**:
- Converts between multiple data formats (C3D <--> CSV), automates renaming,
copying, and managing large sets of biomechanical files.
4. **Visualization**:
- Includes 2D and 3D plotting of biomechanical data using libraries such as
Matplotlib and Plotly.
5. **Cross-Platform**:
- Designed for macOS, Linux, and Windows, with full transparency of execution
flow through rich terminal outputs and print statements for debugging.
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.
License:
--------
This program is licensed under the GNU Lesser General Public License v3.0.
For more details, visit: https://www.gnu.org/licenses/lgpl-3.0.html
===============================================================================
"""
import os
import signal
import platform
import subprocess
from rich import print
import tkinter as tk
from tkinter import messagebox, filedialog, ttk, Toplevel, Label, Button
from PIL import Image, ImageTk
import webbrowser
# Conditionally import AppKit only for macOS
if platform.system() == "Darwin":
try:
from AppKit import NSBundle
except ImportError:
NSBundle = None
from vaila import (
cluster_analysis,
imu_analysis,
markerless_2D_analysis,
markerless_3D_analysis,
mocap_analysis,
forceplate_analysis,
gnss_analysis,
convert_c3d_to_csv,
convert_csv_to_c3d,
rearrange_data_in_directory,
run_drawboxe,
count_frames_in_videos,
import_file,
export_file,
copy_file,
move_file,
remove_file,
rename_files,
tree_file,
find_file,
transfer_file,
show_c3d,
sync_videos,
VideoProcessor,
compress_videos_h264_gui,
compress_videos_h265_gui,
cut_videos,
show_csv,
getpixelvideo,
dlt2d,
rec2d,
rec2d_one_dlt2d,
show_vaila_message,
emg_labiocom,
plot_2d,
plot_3d,
process_videos_gui,
run_fill_split_dialog,
vaila_and_jump,
)
text = """
:::::::::'##::::'##::::'###::::'####:'##::::::::::'###::::'####::::::::::
::::::::: ##:::: ##:::'## ##:::. ##:: ##:::::::::'## ##::: ####::::::::::
::::::::: ##:::: ##::'##:. ##::: ##:: ##::::::::'##:. ##::. ##:::::::::::
::::::::: ##:::: ##:'##:::. ##:: ##:: ##:::::::'##:::. ##:'##::::::::::::
:::::::::. ##:: ##:: #########:: ##:: ##::::::: #########:..:::::::::::::
::::::::::. ## ##::: ##.... ##:: ##:: ##::::::: ##.... ##::::::::::::::::
:::::::::::. ###:::: ##:::: ##:'####: ########: ##:::: ##::::::::::::::::
::::::::::::...:::::..:::::..::....::........::..:::::..:::::::::::::::::
Mocap fullbody_c3d Markerless_3D_videos Markerless_2D_video
\\ | /
v v v
+-------------------------------------------+
IMU_csv --> | vailá - multimodal toolbox | <-- Cluster_csv
+-------------------------------------------+
|
v
+-----------------------------+
| Results |
+-----------------------------+
|
v
+---------------------+
| Visualization/Graph |
+---------------------+
============================ 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 - MoCapCluster B1_r1_c3 - MoCapFullBody
B1_r1_c4 - Markerless2D B1_r1_c5 - Markerless3D
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 - vailá B3_r3_c3 - vailá_and_jump
B3_r3_c4 - vailá B3_r3_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 - Gapfill | split
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 - vailá 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 - Cut Videos C_B_r1_c3 - Draw Box
C_B_r2_c1 - CompressH264 C_B_r2_c2 - Compress H265 C_B_r2_c3 - Make Sync file
C_B_r3_c1 - GetPixelCoord C_B_r3_c2 - Metadata info C_B_r3_c3 - Merge Videos
C_B_r4_c1 - vailá C_B_r4_c2 - vailá C_B_r4_c3 - vailá
C_C: Visualization
C_C_r1_c1 - Show C3D C_C_r1_c2 - Show CSV C_C_r2_c1 - Plot 2D
C_C_r2_c2 - Plot 3D C_C_r3_c1 - vailá C_C_r3_c2 - vailá
C_C_r4_c1 - vailá C_C_r4_c2 - vailá C_C_r4_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)
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__()
self.title("vailá - 21.11.20224")
# Adjust dimensions and layout based on the operating system
self.set_dimensions_based_on_os()
# 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
img = Image.open(icon_path_png)
img = ImageTk.PhotoImage(img)
self.iconphoto(True, img)
# For macOS, set the application name in the dock if AppKit is available
if platform.system() == "Darwin" and NSBundle is not None:
NSBundle.mainBundle().infoDictionary()["CFBundleName"] = "Vaila"
# 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("1280x725") # Wider window for macOS
self.button_width = 12 # Slightly wider buttons
self.font_size = 11 # Standard font size
elif platform.system() == "Windows": # Windows
self.geometry("1024x725") # 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("1280x725") # 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("1280x725") # 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)
preto_image = preto_image.resize((87, 87), Image.LANCZOS)
preto_photo = ImageTk.PhotoImage(preto_image)
preto_label = tk.Label(header_frame, image=preto_photo)
preto_label.image = preto_photo
preto_label.pack(side="left", padx=10)
header_label = tk.Label(
header_frame,
text="vailá - Multimodal Toolbox",
font=font, # Correct font adjustment
anchor="center",
)
header_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)
canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
# Add a scrollbar to the canvas
scrollbar = ttk.Scrollbar(self, orient="vertical", command=canvas.yview)
scrollbar.pack(side=tk.RIGHT, fill="y")
# 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")
canvas.configure(yscrollcommand=scrollbar.set)
"""
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
- vailá
- vailá_and_jump
- vailá
- vailá
"""
# 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")
# VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
## Insert the buttons for each Multimodal Toolbox Analysis
# Buttons for each Multimodal Toolbox Analysis
# 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)
# B2_r2_c1 - Vector Coding
row2_frame = tk.Frame(analysis_frame)
row2_frame.pack(fill="x")
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 - vailá
vaila_btn5 = tk.Button(
row3_frame,
text="vailá",
width=button_width,
command=self.show_vaila_message,
)
# B3_r3_c3 - vaila_and_jump
vailajump_btn = tk.Button(
row3_frame,
text="Vertical Jump",
width=button_width,
command=self.vailajump,
)
# B3_r3_c4 - vailá
vaila_btn7 = tk.Button(
row3_frame,
text="vailá",
width=button_width,
command=self.show_vaila_message,
)
# B3_r3_c5 - vailá
vaila_btn8 = tk.Button(
row3_frame,
text="vailá",
width=button_width,
command=self.show_vaila_message,
)
# Pack the buttons
ecg_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
vaila_btn5.pack(side="left", expand=True, fill="x", padx=2, pady=2)
vailajump_btn.pack(side="left", expand=True, fill="x", padx=2, pady=2)
vaila_btn7.pack(side="left", expand=True, fill="x", padx=2, pady=2)
vaila_btn8.pack(side="left", expand=True, fill="x", padx=2, pady=2)
## VVVVVVVVVVVVVVV TOOLS BUTTONS VVVVVVVVVVVVVVVV
# Tools Frame
# Create a frame for the tools
"""
C - Tools Available:
C_A: Data Files
C_B: Video and Image
C_C: Visualization
"""
# Create a frame for the tools
tools_frame = tk.LabelFrame(
scrollable_frame,
text="Available Tools",
padx=5,
pady=5,
font=("default", 17),
labelanchor="n",
)
tools_frame.pack(pady=10, fill="x")
tools_col1 = tk.LabelFrame(
tools_frame, text="Data Files", padx=5, pady=5, font=("default", 14)
)
tools_col2 = tk.LabelFrame(
tools_frame, text="Video and Image", padx=5, pady=5, font=("default", 14)
)
tools_col3 = tk.LabelFrame(
tools_frame, text="Visualization", padx=5, pady=5, font=("default", 14)
)
## VVVVVVVVVVVVVVV DATA BUTTONS VVVVVVVVVVVVVVVV
# C_A - Data Files sub-columns
# C_A_r1_c1 - Data Files: Edit CSV
reorder_csv_btn = tk.Button(
tools_col1,
text="Edit CSV",
command=self.reorder_csv_data,
width=button_width,
)
# C_A_r1_c2 - Data Files: C3D <--> CSV
convert_btn = tk.Button(
tools_col1,
text="C3D <--> CSV",
command=self.convert_c3d_csv,
width=button_width,
)
# C_A_r1_c3 - Data Files: GapFill - interpolation and split data csv
gapfill_btn = tk.Button(
tools_col1,
text="GapFill - split",
command=self.gapfill_split, # Assuming this correctly calls the method in the Vaila class
width=button_width,
)
# C_A_r1_c4 - Data Files: vailá
vaila_btn8to9 = tk.Button(
tools_col1,
text="vailá",
command=self.show_vaila_message,
width=button_width,
)
# C_A_r2_c1 - Data Files: Make DLT2D
dlt2d_btn = tk.Button(
tools_col1, text="Make DLT2D", command=self.dlt2d, width=button_width
)
# C_A_r2_c2 - Data Files: Rec2D 1DLT
rec2d_one_btn = tk.Button(
tools_col1,
text="Rec2D 1DLT",
command=self.rec2d_one_dlt2d,
width=button_width,
)
# C_A_r2_c3 - Data Files: Rec2D MultiDLT
rec2d_multiple_btn = tk.Button(
tools_col1, text="Rec2D MultiDLT", command=self.rec2d, width=button_width
)
# C_A_r3_c1 - Data Files: Make DLT3D
dlt3d_btn = tk.Button(
tools_col1, text="Make DLT3D", command=self.dlt3d, width=button_width
)
# C_A_r3_c2 - Data Files: Rec3D 1DLT
rec3d_one_btn = tk.Button(
tools_col1,
text="Rec3D 1DLT",
command=self.rec3d_one_dlt3d,
width=button_width,
)
# C_A_r3_c3 - Data Files: Rec3D MultiDLT
rec3d_multiple_btn = tk.Button(
tools_col1, text="Rec3D MultiDLT", command=self.rec3d, width=button_width
)
# Avaliable blank (vailá) buttons for future tools (10-11)
# C_A_r4_c1 - Data Files: vailá
vaila_btn9 = tk.Button(
tools_col1,
text="vailá",
command=self.show_vaila_message,
width=button_width,
)
# C_A_r4_c2 - Data Files: vailá
vaila_btn10 = tk.Button(
tools_col1,
text="vailá",
command=self.show_vaila_message,
width=button_width,
)
# C_A_r4_c3 - Data Files: vailá
vaila_btn11 = tk.Button(
tools_col1,
text="vailá",
command=self.show_vaila_message,
width=button_width,
)
# Packing Data Files buttons
reorder_csv_btn.grid(row=0, column=0, padx=2, pady=2)
convert_btn.grid(row=0, column=1, padx=2, pady=2)
gapfill_btn.grid(row=0, column=2, padx=2, pady=2)
dlt2d_btn.grid(row=1, column=0, padx=2, pady=2)
rec2d_one_btn.grid(row=1, column=1, padx=2, pady=2)
rec2d_multiple_btn.grid(row=1, column=2, padx=2, pady=2)
dlt3d_btn.grid(row=2, column=0, padx=2, pady=2)
rec3d_one_btn.grid(row=2, column=1, padx=2, pady=2)
rec3d_multiple_btn.grid(row=2, column=2, padx=2, pady=2)
vaila_btn9.grid(row=3, column=0, padx=2, pady=2)
vaila_btn10.grid(row=3, column=1, padx=2, pady=2)
vaila_btn11.grid(row=3, column=2, padx=2, pady=2)
tools_col1.pack(side="left", fill="both", expand=True, padx=5, pady=5)
## VVVVVVVVVVVVVVV VIDEO BUTTONS VVVVVVVVVVVVVVVV
# Video sub-columns
# C_B_r1_c1 - Video: Video <--> PNG
extract_png_btn = tk.Button(
tools_col2,
text="Video <--> PNG",
command=self.extract_png_from_videos,
width=button_width,
)
# C_B_r1_c2 - Video: Cut Videos
cut_videos_btn = tk.Button(
tools_col2,
text="Cut|Sync Video",
command=self.cut_videos,
width=button_width,
)
# C_B_r1_c3 - Video: Draw Box
draw_box_btn = tk.Button(
tools_col2, text="Draw Box", command=self.draw_box, width=button_width
)
# C_B_r2_c1 - Video: Compress H.264
compress_videos_h264_btn = tk.Button(
tools_col2,
text="Compress H264",
command=self.compress_videos_h264_gui,
width=button_width,
)
# C_B_r2_c2 - Video: Compress H.265
compress_videos_h265_btn = tk.Button(
tools_col2,
text="Compress H265",
command=self.compress_videos_h265_gui,
width=button_width,
)
# C_B_r2_c3 - Video: Make Sync Videos
sync_videos_btn = tk.Button(
tools_col2,
text="Make Sync file",
command=self.sync_videos,
width=button_width,
)
# C_B_r3_c1 - Video: Get Pixel Coords
getpixelvideo_btn = tk.Button(
tools_col2,
text="Get Pixel Coord",
command=self.getpixelvideo,
width=button_width,
)
# C_B_r3_c2 - Video: Metadata info
count_frames_btn = tk.Button(
tools_col2,
text="Metadata info",
command=self.count_frames_in_videos,
width=button_width,
)
# C_B_r3_c3 - Video: Merge Videos
video_processing_btn = tk.Button(
tools_col2,
text="Merge|Split Video",
command=self.process_videos_gui,
width=button_width,
)
# Avaliable blank (vailá) buttons for future tools (12-15)
# C_B_r4_c1 - Video: vailá
vaila_btn13 = tk.Button(
tools_col2,
text="vailá",
command=self.show_vaila_message,
width=button_width,
)
# C_B_r4_c2 - Video: vailá
vaila_btn14 = tk.Button(
tools_col2,
text="vailá",
command=self.show_vaila_message,
width=button_width,
)
# C_B_r4_c3 - Video: vailá
vaila_btn15 = tk.Button(
tools_col2,
text="vailá",
command=self.show_vaila_message,
width=button_width,
)
# Packing Video buttons
extract_png_btn.grid(row=0, column=0, padx=2, pady=2)
cut_videos_btn.grid(row=0, column=1, padx=2, pady=2)
draw_box_btn.grid(row=0, column=2, padx=2, pady=2)
compress_videos_h264_btn.grid(row=1, column=0, padx=2, pady=2)
compress_videos_h265_btn.grid(row=1, column=1, padx=2, pady=2)
sync_videos_btn.grid(row=1, column=2, padx=2, pady=2)
getpixelvideo_btn.grid(row=2, column=0, padx=2, pady=2)
count_frames_btn.grid(row=2, column=1, padx=2, pady=2)
video_processing_btn.grid(row=2, column=2, padx=2, pady=2)
vaila_btn13.grid(row=3, column=0, padx=2, pady=2)
vaila_btn14.grid(row=3, column=1, padx=2, pady=2)
vaila_btn15.grid(row=3, column=2, padx=2, pady=2)
tools_col2.pack(side="left", fill="both", expand=True, padx=5, pady=5)
## VVVVVVVVVVVVVVV VISUALIZATION BUTTONS VVVVVVVVVVVVVVVV
# Visualization sub-columns (3-6)
# C_C_r1_c1 - Visualization: Show C3D
show_c3d_btn = tk.Button(
tools_col3, text="Show C3D", command=self.show_c3d_data, width=button_width
)
# C_C_r1_c2 - Visualization: Show CSV
show_csv_btn = tk.Button(
tools_col3, text="Show CSV", command=self.show_csv_file, width=button_width
)
# C_C_r2_c1 - Visualization: Plot 2D
plot_2d_btn = tk.Button(
tools_col3, text="Plot 2D", command=self.plot_2d_data, width=button_width
)
# C_C_r2_c2 - Visualization: Plot 3D
plot_3d_btn = tk.Button(
tools_col3,
text="Plot 3D",
command=self.plot_3d_data,
width=button_width,
)
# C_C_r3_c1 - Visualization: vailá
vaila_btn16 = tk.Button(
tools_col3,
text="vailá",
command=self.show_vaila_message,
width=button_width,
)
# C_C_r3_c2 - Visualization: vailá
vaila_btn17 = tk.Button(
tools_col3,
text="vailá",
command=self.show_vaila_message,
width=button_width,
)
# C_C_r4_c1 - Visualization: vailá
vaila_btn18 = tk.Button(
tools_col3,
text="vailá",
command=self.show_vaila_message,
width=button_width,
)
# C_C_r4_c2 - Visualization: vailá
vaila_btn19 = tk.Button(
tools_col3,
text="vailá",
command=self.show_vaila_message,
width=button_width,
)
# C_C_r4_c2 - Visualization: vailá
vaila_btn19 = tk.Button(
tools_col3,
text="vailá",
command=self.show_vaila_message,
width=button_width,
)
# Packing Visualization buttons
show_c3d_btn.grid(row=0, column=0, padx=2, pady=2)
show_csv_btn.grid(row=0, column=1, padx=2, pady=2)
plot_2d_btn.grid(row=1, column=0, padx=2, pady=2)
plot_3d_btn.grid(row=1, column=1, padx=2, pady=2)
vaila_btn16.grid(row=2, column=0, padx=2, pady=2)
vaila_btn17.grid(row=2, column=1, padx=2, pady=2)
vaila_btn18.grid(row=3, column=0, padx=2, pady=2)
vaila_btn19.grid(row=3, column=1, padx=2, pady=2)
tools_col3.pack(side="left", fill="both", expand=True, padx=5, pady=5)
# Help and Exit Buttons Frame
bottom_frame = tk.Frame(scrollable_frame)
bottom_frame.pack(pady=10)
help_btn = tk.Button(bottom_frame, text="Help", command=self.display_help)
exit_btn = tk.Button(bottom_frame, text="Exit", command=self.quit_app)
help_btn.pack(side="left", padx=5)
exit_btn.pack(side="left", padx=5)
license_label = tk.Label(
scrollable_frame,
text="© 2024 vailá - Multimodal Toolbox. Licensed under the GNU Lesser General Public License v3.0.",
font=("default", 11),
anchor="center",
)
license_label.pack(pady=5)
# Class definition
def show_vaila_message(self):
"""Display a message with information about vailá
This function creates a new window and displays a message with
information about vailá, including the name, version and a short
description. The window is non-modal and stays open until the user
closes it.
"""
show_vaila_message()
# A First FRAME Block
# A_r1_c1
def rename_files(self):