Skip to content

Commit 2f74697

Browse files
committed
remove tkinter
1 parent e1fdf94 commit 2f74697

3 files changed

Lines changed: 16 additions & 56 deletions

File tree

src/cardiotensor/orientation/orientation_computation_functions.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@
88
import tifffile
99
from scipy.interpolate import CubicSpline
1010

11-
# try:
12-
# import sys
13-
# from PyQt5.QtWidgets import QApplication
14-
# app = QApplication.instance()
15-
# if app is None:
16-
# app = QApplication(sys.argv)
17-
# except:
18-
# pass
1911
from structure_tensor.multiprocessing import parallel_structure_tensor_analysis
2012
from tqdm import tqdm
2113

@@ -446,6 +438,7 @@ def plot_images(
446438
None
447439
"""
448440

441+
449442
# Default colormaps
450443
if colormap_angle is None:
451444
colormap_angle = helix_angle_cmap

src/cardiotensor/scripts/compute_orientation.py

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@
22
import os
33
import sys
44
import time
5-
from tkinter import Tk
6-
from tkinter.filedialog import askopenfilename
75

86
from cardiotensor.orientation.orientation_computation_pipeline import (
97
compute_orientation,
108
)
119
from cardiotensor.utils.DataReader import DataReader
1210
from cardiotensor.utils.utils import read_conf_file
1311

14-
1512
def script() -> None:
1613
"""
1714
Main entry point for the orientation computation pipeline.
@@ -48,30 +45,11 @@ def script() -> None:
4845
help="Process slices in reverse order starting from the end.",
4946
)
5047

51-
# --- Interactive Mode ---
52-
if len(sys.argv) < 2:
53-
parser.print_help()
54-
print("\nNo configuration file provided. Launching interactive mode...")
55-
Tk().withdraw()
56-
conf_file_path: str = askopenfilename(
57-
initialdir=f"{os.getcwd()}/param_files",
58-
title="Select a configuration file",
59-
filetypes=[
60-
("Config files", "*.conf *.json *.yaml *.yml"),
61-
("All files", "*.*"),
62-
],
63-
)
64-
if not conf_file_path:
65-
sys.exit("❌ No file selected! Exiting.")
66-
start_index: int = 0
67-
end_index: int | None = None
68-
reverse: bool = False
69-
else:
70-
args = parser.parse_args()
71-
conf_file_path = args.conf_file_path
72-
start_index = args.start_index
73-
end_index = args.end_index
74-
reverse = args.reverse
48+
args = parser.parse_args()
49+
conf_file_path = args.conf_file_path
50+
start_index = args.start_index
51+
end_index = args.end_index
52+
reverse = args.reverse
7553

7654
# --- Read configuration ---
7755
try:

src/cardiotensor/scripts/slurm_launcher.py

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import argparse
66
import os
77
import sys
8-
from tkinter import Tk # from tkinter import Tk for Python 3.x
9-
from tkinter.filedialog import askopenfilename
108

119
from cardiotensor.launcher.slurm_launcher import slurm_launcher
1210

@@ -16,25 +14,16 @@ def script() -> None:
1614
Main script to process 3D data. Reads configuration files, launches processing tasks,
1715
and logs processing time.
1816
"""
19-
if len(sys.argv) < 2:
20-
# If no argument is passed, show file dialog to select a configuration file
21-
Tk().withdraw()
22-
conf_file_path: str = askopenfilename(
23-
initialdir=f"{os.getcwd()}/param_files", title="Select file"
24-
) # Show an "Open" dialog box and return the path to the selected file
25-
if not conf_file_path:
26-
sys.exit("No file selected!")
27-
28-
else:
29-
# Parse the configuration file path from command-line arguments
30-
parser = argparse.ArgumentParser(
31-
description="Process 3D data using the specified configuration file."
32-
)
33-
parser.add_argument(
34-
"conf_file_path", type=str, help="Path to the input configuration file."
35-
)
36-
args = parser.parse_args()
37-
conf_file_path = args.conf_file_path
17+
18+
# Parse the configuration file path from command-line arguments
19+
parser = argparse.ArgumentParser(
20+
description="Process 3D data using the specified configuration file."
21+
)
22+
parser.add_argument(
23+
"conf_file_path", type=str, help="Path to the input configuration file."
24+
)
25+
args = parser.parse_args()
26+
conf_file_path = args.conf_file_path
3827

3928
# Launch processing using slurm_launcher
4029
slurm_launcher(conf_file_path)

0 commit comments

Comments
 (0)