Detection in volumetric data
The qim3d
library provides a set of detection methods for volumes.
qim3d.detection
qim3d.detection.blobs
blobs(vol, background='dark', min_sigma=1, max_sigma=50, sigma_ratio=1.6, threshold=0.5, overlap=0.5, threshold_rel=None, exclude_border=False)
Extract blobs from a volume using Difference of Gaussian (DoG) method, and retrieve a binary volume with the blobs marked as True
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vol |
ndarray
|
The volume to detect blobs in. |
required |
background |
str
|
'dark' if background is darker than the blobs, 'bright' if background is lighter than the blobs. Defaults to 'dark'. |
'dark'
|
min_sigma |
float
|
The minimum standard deviation for Gaussian kernel. Defaults to 1. |
1
|
max_sigma |
float
|
The maximum standard deviation for Gaussian kernel. Defaults to 50. |
50
|
sigma_ratio |
float
|
The ratio between the standard deviation of Gaussian Kernels. Defaults to 1.6. |
1.6
|
threshold |
float
|
The absolute lower bound for scale space maxima. Reduce this to detect blobs with lower intensities. Defaults to 0.5. |
0.5
|
overlap |
float
|
The fraction of area of two blobs that overlap. Defaults to 0.5. |
0.5
|
threshold_rel |
float or None
|
The relative lower bound for scale space maxima. Defaults to None. |
None
|
exclude_border |
bool
|
If True, exclude blobs that are too close to the border of the image. Defaults to False. |
False
|
Returns:
Name | Type | Description |
---|---|---|
blobs |
ndarray
|
The blobs found in the volume as (p, r, c, radius) |
binary_volume |
ndarray
|
A binary volume with the blobs marked as True |
Example
import qim3d
import qim3d.detection
# Get data
vol = qim3d.examples.cement_128x128x128
vol_blurred = qim3d.filters.gaussian(vol, sigma=2)
# Detect blobs, and get binary_volume
blobs, binary_volume = qim3d.detection.blobs(
vol_blurred,
min_sigma=1,
max_sigma=8,
threshold=0.001,
overlap=0.1,
background="bright"
)
# Visualize detected blobs
qim3d.viz.circles(blobs, vol, alpha=0.8, color='blue')
Source code in qim3d/detection/_common_detection_methods.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|