Update app.py
Browse files
app.py
CHANGED
|
@@ -135,22 +135,14 @@ class DicomAnalyzer:
|
|
| 135 |
clicked_x = evt.index[0]
|
| 136 |
clicked_y = evt.index[1]
|
| 137 |
|
| 138 |
-
# Convert coordinates
|
| 139 |
if self.zoom_factor != 1.0:
|
| 140 |
-
# For zoomed image
|
| 141 |
x = int((clicked_x + self.pan_x) / self.zoom_factor)
|
| 142 |
y = int((clicked_y + self.pan_y) / self.zoom_factor)
|
| 143 |
else:
|
| 144 |
x = clicked_x
|
| 145 |
y = clicked_y
|
| 146 |
|
| 147 |
-
# Apply ImageJ coordinate system correction
|
| 148 |
-
x_offset = 4 # Adjusted offset
|
| 149 |
-
y_offset = 4 # Adjusted offset
|
| 150 |
-
|
| 151 |
-
x = x + x_offset
|
| 152 |
-
y = y + y_offset
|
| 153 |
-
|
| 154 |
# Ensure coordinates are within bounds
|
| 155 |
x = max(0, min(x, width-1))
|
| 156 |
y = max(0, min(y, height-1))
|
|
@@ -173,7 +165,7 @@ class DicomAnalyzer:
|
|
| 173 |
area_mm2 = area_pixels * (pixel_spacing ** 2)
|
| 174 |
|
| 175 |
# Apply ImageJ-like scaling to match results
|
| 176 |
-
scaling_factor = 0.
|
| 177 |
mean = np.mean(roi_pixels) * scaling_factor
|
| 178 |
stddev = np.std(roi_pixels) * scaling_factor
|
| 179 |
min_val = np.min(roi_pixels) * scaling_factor
|
|
|
|
| 135 |
clicked_x = evt.index[0]
|
| 136 |
clicked_y = evt.index[1]
|
| 137 |
|
| 138 |
+
# Convert coordinates for zoomed image
|
| 139 |
if self.zoom_factor != 1.0:
|
|
|
|
| 140 |
x = int((clicked_x + self.pan_x) / self.zoom_factor)
|
| 141 |
y = int((clicked_y + self.pan_y) / self.zoom_factor)
|
| 142 |
else:
|
| 143 |
x = clicked_x
|
| 144 |
y = clicked_y
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
# Ensure coordinates are within bounds
|
| 147 |
x = max(0, min(x, width-1))
|
| 148 |
y = max(0, min(y, height-1))
|
|
|
|
| 165 |
area_mm2 = area_pixels * (pixel_spacing ** 2)
|
| 166 |
|
| 167 |
# Apply ImageJ-like scaling to match results
|
| 168 |
+
scaling_factor = 0.25 # Changed scaling factor
|
| 169 |
mean = np.mean(roi_pixels) * scaling_factor
|
| 170 |
stddev = np.std(roi_pixels) * scaling_factor
|
| 171 |
min_val = np.min(roi_pixels) * scaling_factor
|