Update app.py
Browse files
app.py
CHANGED
|
@@ -128,7 +128,7 @@ def calculate_blue_intensity(image_np, masks):
|
|
| 128 |
# Calculate mean blue intensity (blue channel is index 2)
|
| 129 |
blue_intensity = np.mean(cell_pixels[:, 2]) # Blue channel
|
| 130 |
cell_blue_intensities[cell_id] = blue_intensity
|
| 131 |
-
|
| 132 |
print(f"DEBUG: Total cells with blue intensity: {len(cell_blue_intensities)}")
|
| 133 |
return cell_blue_intensities
|
| 134 |
|
|
@@ -163,18 +163,18 @@ def create_viability_overlay(image_np, masks, blue_threshold):
|
|
| 163 |
for cell_id, blue_intensity in cell_blue_intensities.items():
|
| 164 |
cell_mask = masks == cell_id
|
| 165 |
|
| 166 |
-
|
| 167 |
|
| 168 |
if blue_intensity > blue_threshold:
|
| 169 |
# Dead cell - color in red
|
| 170 |
overlay[cell_mask] = [255, 0, 0] # Red
|
| 171 |
dead_count += 1
|
| 172 |
-
|
| 173 |
else:
|
| 174 |
# Live cell - color in green
|
| 175 |
overlay[cell_mask] = [0, 255, 0] # Green
|
| 176 |
live_count += 1
|
| 177 |
-
|
| 178 |
print(f"DEBUG: Final counts - Live: {live_count}, Dead: {dead_count}")
|
| 179 |
|
| 180 |
# Blend with original image
|
|
|
|
| 128 |
# Calculate mean blue intensity (blue channel is index 2)
|
| 129 |
blue_intensity = np.mean(cell_pixels[:, 2]) # Blue channel
|
| 130 |
cell_blue_intensities[cell_id] = blue_intensity
|
| 131 |
+
print(f"DEBUG: Cell {cell_id}: {len(cell_pixels)} pixels, blue intensity: {blue_intensity:.2f}") # Too verbose, uncomment if needed
|
| 132 |
print(f"DEBUG: Total cells with blue intensity: {len(cell_blue_intensities)}")
|
| 133 |
return cell_blue_intensities
|
| 134 |
|
|
|
|
| 163 |
for cell_id, blue_intensity in cell_blue_intensities.items():
|
| 164 |
cell_mask = masks == cell_id
|
| 165 |
|
| 166 |
+
print(f"DEBUG: Processing cell {cell_id}, blue intensity: {blue_intensity:.2f}, threshold: {blue_threshold}") # Too verbose
|
| 167 |
|
| 168 |
if blue_intensity > blue_threshold:
|
| 169 |
# Dead cell - color in red
|
| 170 |
overlay[cell_mask] = [255, 0, 0] # Red
|
| 171 |
dead_count += 1
|
| 172 |
+
print(f"DEBUG: Cell {cell_id} classified as DEAD") # Too verbose
|
| 173 |
else:
|
| 174 |
# Live cell - color in green
|
| 175 |
overlay[cell_mask] = [0, 255, 0] # Green
|
| 176 |
live_count += 1
|
| 177 |
+
print(f"DEBUG: Cell {cell_id} classified as LIVE") # Too verbose
|
| 178 |
print(f"DEBUG: Final counts - Live: {live_count}, Dead: {dead_count}")
|
| 179 |
|
| 180 |
# Blend with original image
|