Update app.py
Browse files
app.py
CHANGED
|
@@ -143,6 +143,13 @@ class DicomAnalyzer:
|
|
| 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,11 +172,11 @@ class DicomAnalyzer:
|
|
| 165 |
area_mm2 = area_pixels * (pixel_spacing ** 2)
|
| 166 |
|
| 167 |
# Apply ImageJ-like scaling to match results
|
| 168 |
-
scaling_factor = 0.
|
| 169 |
mean = np.mean(roi_pixels) * scaling_factor
|
| 170 |
stddev = np.std(roi_pixels) * scaling_factor
|
| 171 |
-
min_val = np.min(roi_pixels)
|
| 172 |
-
max_val = np.max(roi_pixels)
|
| 173 |
|
| 174 |
# Store results
|
| 175 |
result = {
|
|
@@ -459,5 +466,4 @@ if __name__ == "__main__":
|
|
| 459 |
)
|
| 460 |
except Exception as e:
|
| 461 |
print(f"Error launching application: {str(e)}")
|
| 462 |
-
raise e
|
| 463 |
-
|
|
|
|
| 143 |
x = clicked_x
|
| 144 |
y = clicked_y
|
| 145 |
|
| 146 |
+
# Apply ImageJ coordinate system correction
|
| 147 |
+
x_offset = 4 # Adjusted offset
|
| 148 |
+
y_offset = 4 # Adjusted offset
|
| 149 |
+
|
| 150 |
+
x = x + x_offset
|
| 151 |
+
y = y + y_offset
|
| 152 |
+
|
| 153 |
# Ensure coordinates are within bounds
|
| 154 |
x = max(0, min(x, width-1))
|
| 155 |
y = max(0, min(y, height-1))
|
|
|
|
| 172 |
area_mm2 = area_pixels * (pixel_spacing ** 2)
|
| 173 |
|
| 174 |
# Apply ImageJ-like scaling to match results
|
| 175 |
+
scaling_factor = 0.3 # Reverted scaling factor
|
| 176 |
mean = np.mean(roi_pixels) * scaling_factor
|
| 177 |
stddev = np.std(roi_pixels) * scaling_factor
|
| 178 |
+
min_val = np.min(roi_pixels) # No scaling for min/max
|
| 179 |
+
max_val = np.max(roi_pixels) # No scaling for min/max
|
| 180 |
|
| 181 |
# Store results
|
| 182 |
result = {
|
|
|
|
| 466 |
)
|
| 467 |
except Exception as e:
|
| 468 |
print(f"Error launching application: {str(e)}")
|
| 469 |
+
raise e
|
|
|