Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
388 changes: 240 additions & 148 deletions FISH_segmentation/Application_Qt/Application_Qt_.py

Large diffs are not rendered by default.

534 changes: 357 additions & 177 deletions FISH_segmentation/Application_Qt/Application_Qt_module_ui.py

Large diffs are not rendered by default.

1,178 changes: 770 additions & 408 deletions FISH_segmentation/Application_Qt/Application_Qt_module_ui.ui

Large diffs are not rendered by default.

18 changes: 3 additions & 15 deletions FISH_segmentation/Application_Qt/ChromosomePatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ def __init__(self, image: np.ndarray):
self.image: np.ndarray = image
self.cells: list[Cell] = []
self.Radius = []
self.MyMask = []

def plot(self, ax=None):
ax.imshow(self.image)
for cell in self.cells:
mask = np.invert(cell.masked_area.mask[..., 0]).astype(np.uint8)
contour_color = 'green' if cell.cell_type == Cell.CellType.WHOLE else 'red'
ax.contour(mask, colors=contour_color, linewidths=0.5, alpha=0.5)
self.MyMask.append(mask)

for p in cell.red_chromosomes:
circle = plt.Circle((p[1], p[0]), radius=3, color='red', fill=False, linestyle='--')
Expand All @@ -68,21 +70,7 @@ def plot(self, ax=None):
for p in cell.green_chromosomes:
circle = plt.Circle((p[1], p[0]), radius=3, color='green', fill=False, linestyle='--')
ax.add_patch(circle)
return ax

def rgba2rgb(self, rgba, background=(255, 255, 255)):
row, col, ch = rgba.shape
if ch == 3:
return rgba
assert ch == 4, 'RGBA image has 4 channels.'
rgb = np.zeros((row, col, 3), dtype='float32')
r, g, b, a = rgba[:, :, 0], rgba[:, :, 1], rgba[:, :, 2], rgba[:, :, 3]
a = np.asarray(a, dtype='float32') / 255.0
R, G, B = background
rgb[:, :, 0] = r * a + (1.0 - a) * R
rgb[:, :, 1] = g * a + (1.0 - a) * G
rgb[:, :, 2] = b * a + (1.0 - a) * B
return np.asarray(rgb, dtype='uint8')
return ax, self.MyMask

def find_cells(self, confidence: float = 0.5):
if self.cells:
Expand Down
24 changes: 24 additions & 0 deletions FISH_segmentation/Application_Qt/ClickableLabel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from PyQt6.QtCore import pyqtSignal
from PyQt6.QtWidgets import QLabel


# Класс, необходимый для переопределения метода "mousePressEvent";
class ClickableLabel(QLabel):
# Создаем новый сигнал;
clicked = pyqtSignal(float, float)

def __init__(self, parent=None):
super(ClickableLabel, self).__init__(parent)

def mousePressEvent(self, event):
# Учет растяжения картинки в окне:
pos = self.mapFromParent(event.position())
label_size = self.size()
scale_x = 512 / label_size.width()
scale_y = 512 / label_size.height()
original_x = pos.x() * scale_x
original_y = pos.y() * scale_y
# print(f"Координаты на исходном изображении: ({original_x}, {original_y})")

# Излучаем сигнал при нажатии кнопки мыши;
self.clicked.emit(original_x, original_y)
Binary file modified FISH_segmentation/Application_Qt/resources/Background4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FISH_segmentation/Example_czi_imege/Snap-1633.czi
Binary file not shown.
Binary file added FISH_segmentation/Example_czi_imege/Snap-1634.czi
Binary file not shown.
Binary file added FISH_segmentation/Example_czi_imege/Snap-1635.czi
Binary file not shown.
Binary file added FISH_segmentation/Example_czi_imege/Snap-1636.czi
Binary file not shown.
Binary file added FISH_segmentation/Example_czi_imege/Snap-1637.czi
Binary file not shown.