Skip to content

Commit

Permalink
Merge pull request #418 from GSTT-CSC/ACR_detect_circle
Browse files Browse the repository at this point in the history
improve circle detection in ACR Object
  • Loading branch information
mollybuckley authored Feb 29, 2024
2 parents ac28318 + 0c32d9c commit 5ad4963
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions hazenlib/ACRObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,28 @@ def find_phantom_center(img, dx, dy):
img_blur = cv2.GaussianBlur(img, (1, 1), 0)
img_grad = cv2.Sobel(img_blur, 0, dx=1, dy=1)

detected_circles = cv2.HoughCircles(
img_grad,
cv2.HOUGH_GRADIENT,
1,
param1=50,
param2=30,
minDist=int(180 / dy),
minRadius=int(180 / (2 * dy)),
maxRadius=int(200 / (2 * dx)),
).flatten()
try:
detected_circles = cv2.HoughCircles(
img_grad,
cv2.HOUGH_GRADIENT,
1,
param1=50,
param2=30,
minDist=int(180 / dy),
minRadius=int(180 / (2 * dy)),
maxRadius=int(200 / (2 * dx)),
).flatten()
except AttributeError:
detected_circles = cv2.HoughCircles(
img_grad,
cv2.HOUGH_GRADIENT,
1,
param1=50,
param2=30,
minDist=int(180 / dy),
minRadius=80,
maxRadius=200,
).flatten()

centre_x = round(detected_circles[0])
centre_y = round(detected_circles[1])
Expand Down

2 comments on commit 5ad4963

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
hazenlib
   ACRObject.py1121388%45, 80–86, 122, 137–140, 168–169, 206–209
   HazenTask.py28389%67–71
   __init__.py561573%102, 135–144, 146–155, 157–159, 176–180, 184
   exceptions.py21576%19–23, 42
   utils.py2225973%77, 81, 102, 115, 148, 163–176, 195, 202–209, 226–228, 243–247, 263–267, 287, 292, 303, 375–376, 378–379, 384–409, 462, 465, 473–478, 481, 536, 545, 574
hazenlib/tasks
   acr_geometric_accuracy.py1115848%53–100, 124–239
   acr_ghosting.py1064260%42–58, 104–107, 154–157, 201–283
   acr_slice_position.py1364865%56–80, 281–348
   acr_slice_thickness.py1386156%45–64, 163, 241–325
   acr_snr.py1325757%60–111, 131, 227–242, 287–305, 355–380
   acr_spatial_resolution.py2066867%70–100, 187, 285, 302–313, 460–539
   acr_uniformity.py803260%43–60, 150–202
   ghosting.py1495166%28–47, 67, 171–172, 179, 196–197, 252–256, 271–275, 346–387
   relaxometry.py2908969%210–211, 213, 226–231, 238–246, 277–326, 375, 409–431, 609, 655–659, 726, 811–833, 851–866
   slice_position.py1244068%30, 43–71, 129–130, 157, 273, 283–306
   slice_width.py3515385%44–48, 52, 123, 188–213, 383, 555, 560–561, 567, 572, 648–649, 1020–1084
   snr.py1736960%45–48, 87, 103–113, 206–225, 237–247, 287–302, 330–340, 345–361, 399–415, 428–434, 477–495
   snr_map.py107199%159
   spatial_resolution.py2464582%50–54, 58, 90, 191, 213, 294, 460–503
   uniformity.py791976%59–63, 67, 118–119, 126, 174–204
TOTAL289282871% 

Tests Skipped Failures Errors Time
208 0 💤 0 ❌ 0 🔥 2m 14s ⏱️

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
hazenlib
   ACRObject.py1121388%45, 80–86, 122, 137–140, 168–169, 206–209
   HazenTask.py29390%67–71
   __init__.py571574%102, 135–144, 146–155, 157–159, 176–180, 184
   exceptions.py21576%19–23, 42
   utils.py2225973%77, 81, 102, 115, 148, 163–176, 195, 202–209, 226–228, 243–247, 263–267, 287, 292, 303, 375–376, 378–379, 384–409, 462, 465, 473–478, 481, 536, 545, 574
hazenlib/tasks
   acr_geometric_accuracy.py1115848%53–100, 124–239
   acr_ghosting.py1064260%42–58, 104–107, 154–157, 201–283
   acr_slice_position.py1364865%56–80, 281–348
   acr_slice_thickness.py1386156%45–64, 163, 241–325
   acr_snr.py1325757%60–111, 131, 227–242, 287–305, 355–380
   acr_spatial_resolution.py2066867%70–100, 187, 285, 302–313, 460–539
   acr_uniformity.py803260%43–60, 150–202
   ghosting.py1495166%28–47, 67, 171–172, 179, 196–197, 252–256, 271–275, 346–387
   relaxometry.py2918969%210–211, 213, 226–231, 238–246, 277–326, 375, 409–431, 609, 655–659, 726, 811–833, 851–866
   slice_position.py1244068%30, 43–71, 129–130, 157, 273, 283–306
   slice_width.py3525285%44–48, 52, 123, 188–213, 555, 560–561, 567, 572, 648–649, 1020–1084
   snr.py1736960%45–48, 87, 103–113, 206–225, 237–247, 287–302, 330–340, 345–361, 399–415, 428–434, 477–495
   snr_map.py108199%159
   spatial_resolution.py2464482%50–54, 58, 90, 213, 294, 460–503
   uniformity.py791976%59–63, 67, 118–119, 126, 174–204
TOTAL289782671% 

Tests Skipped Failures Errors Time
208 0 💤 0 ❌ 0 🔥 2m 26s ⏱️

Please sign in to comment.