Skip to content

Commit

Permalink
Add implementation of boundary parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kostrykin committed Sep 24, 2024
1 parent bc288c4 commit 55e4840
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
6 changes: 6 additions & 0 deletions tools/spot_detection_2d/spot_detection_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ def spot_detection(
blobs = blob_filter(img, threshold=abs_threshold, threshold_rel=rel_threshold, min_sigma=min_scale, max_sigma=max_scale)
for blob in blobs:
y, x, scale = blob

# Skip the detection if it is too close to the boundary of the image
if y < boundary or x < boundary or y >= img.shape[0] - boundary or x >= img.shape[1] - boundary:
continue

# Add the detection to the list of detections
radius = scale * np.sqrt(2) * 2
intensity = mean_intensity(img, round(y), round(x), round(radius))
detections.append(
Expand Down
2 changes: 0 additions & 2 deletions tools/spot_detection_2d/test-data/output1.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ frame pos_x pos_y scale radius intensity
3 214 178 1.00 2.83 9065.83
3 42 86 1.00 2.83 11837.97
3 265 177 1.56 4.40 20759.84
3 256 188 1.00 2.83 19457.31
3 67 154 1.00 2.83 39978.07
3 318 154 1.33 3.77 9323.84
3 170 176 1.11 3.14 13875.28
Expand Down Expand Up @@ -740,7 +739,6 @@ frame pos_x pos_y scale radius intensity
5 214 178 1.00 2.83 9065.83
5 42 86 1.00 2.83 11837.97
5 265 177 1.56 4.40 20759.84
5 256 188 1.00 2.83 19457.31
5 67 154 1.00 2.83 39978.07
5 318 154 1.33 3.77 9323.84
5 170 176 1.11 3.14 13875.28
Expand Down
9 changes: 0 additions & 9 deletions tools/spot_detection_2d/test-data/output2.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ frame pos_x pos_y scale radius intensity
1 61 27 1.56 4.40 18052.18
1 158 39 1.44 4.09 18377.02
1 190 14 1.33 3.77 18548.86
1 24 75 1.56 4.40 23031.16
1 182 33 1.78 5.03 26467.79
1 39 39 1.44 4.09 14782.43
1 169 26 1.33 3.77 14203.41
1 10 83 2.00 5.66 21493.92
1 61 54 1.33 3.77 23248.06
1 95 52 1.33 3.77 21480.71
1 23 60 1.89 5.34 25203.43
Expand All @@ -20,16 +18,12 @@ frame pos_x pos_y scale radius intensity
1 66 49 1.11 3.14 23858.07
1 115 36 2.00 5.66 16389.10
1 55 51 1.33 3.77 23548.90
1 201 21 2.00 5.66 25498.97
1 130 72 1.67 4.71 15769.02
1 151 78 1.78 5.03 18372.90
1 117 23 1.33 3.77 16763.14
1 45 52 1.56 4.40 22877.61
1 36 71 1.56 4.40 20780.96
1 0 50 1.56 4.40 19538.34
1 78 17 1.33 3.77 16844.51
1 101 38 1.56 4.40 21376.59
1 183 6 1.78 5.03 16774.07
1 147 31 1.78 5.03 16597.14
1 163 55 2.00 5.66 18301.54
1 164 23 1.33 3.77 17073.82
Expand All @@ -40,9 +34,6 @@ frame pos_x pos_y scale radius intensity
1 69 17 1.11 3.14 15601.83
1 83 52 1.33 3.77 18315.00
1 16 54 2.00 5.66 22140.66
1 12 0 2.00 5.66 17703.35
1 175 2 1.11 3.14 14856.11
1 166 61 1.78 5.03 18488.78
1 163 43 1.44 4.09 16925.49
1 130 53 1.78 5.03 15101.96
1 204 32 2.00 5.66 25289.27

0 comments on commit 55e4840

Please sign in to comment.