diff --git a/modules/advancedSettingsWidget.py b/modules/advancedSettingsWidget.py index 071bd68e98009ce479b9878aacf3cf71c1ace08e..c11186352d905f3ca41d6f3abacdae3b0415ddba 100644 --- a/modules/advancedSettingsWidget.py +++ b/modules/advancedSettingsWidget.py @@ -6,8 +6,6 @@ from PyQt5.QtGui import QPixmap, QImage from PyQt5.QtCore import Qt import numpy as np - - class AdvancedSettingsWidget(QWidget): """ Shows toggle rainbow, circle editor, line smoothing slider, contrast slider, diff --git a/modules/compute_cost_image.py b/modules/compute_cost_image.py index 1da0a6a1978371b8a72c2a7a7d41c444b80d0212..3c88768bd224759efb98c0b5f369f7a878ceca04 100644 --- a/modules/compute_cost_image.py +++ b/modules/compute_cost_image.py @@ -4,12 +4,24 @@ from compute_disk_size import compute_disk_size from load_image import load_image from preprocess_image import preprocess_image from circle_edge_kernel import circle_edge_kernel - -def compute_cost_image(path, user_radius, sigma=3, clip_limit=0.01): - +import numpy as np + +def compute_cost_image(path: str, user_radius: int, sigma: int = 3, clip_limit: float = 0.01) -> np.ndarray: + """ + Compute the cost image for a given image path, user radius, and optional parameters. + + Args: + path: The path to the image file. + user_radius: The radius of the disk. + sigma: The standard deviation for Gaussian smoothing. + clip_limit: The limit for contrasting the image. + + Returns: + The cost image as a NumPy array. + """ disk_size = compute_disk_size(user_radius) - ### Load image + # Load image image = load_image(path) # Apply smoothing @@ -18,7 +30,7 @@ def compute_cost_image(path, user_radius, sigma=3, clip_limit=0.01): # Apply Canny edge detection canny_img = canny(smoothed_img) - # Do disk thing + # Perform disk convolution binary_img = canny_img kernel = circle_edge_kernel(k_size=disk_size) convolved = convolve2d(binary_img, kernel, mode='same', boundary='fill') diff --git a/modules/export_path.py b/modules/export_path.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/modules/mainWindow.py b/modules/mainWindow.py index 5ec3e7160bab532200056e64bbb16eee60cf7f3a..45ca7e8716b4b891b32614580df2e6b3d2240e32 100644 --- a/modules/mainWindow.py +++ b/modules/mainWindow.py @@ -244,8 +244,6 @@ class MainWindow(QMainWindow): print(f"Exported path with {len(full_xy)} points to {file_path}") - - def clear_points(self): self.image_view.clear_guide_points()