Skip to content
Snippets Groups Projects

3d blob detection - Difference of Gaussian (DoG) method

1 file
+ 4
4
Compare changes
  • Side-by-side
  • Inline
+ 4
4
@@ -4,12 +4,12 @@ import numpy as np
@@ -4,12 +4,12 @@ import numpy as np
from skimage import img_as_float
from skimage import img_as_float
class blob_detection():
class blob_detection():
def __init__(self, volume, background=0, min_sigma=1, max_sigma=50, sigma_ratio=1.6, threshold=0.5, overlap=0.5, threshold_rel=None, exclude_border=False):
def __init__(self, volume, background='dark', min_sigma=1, max_sigma=50, sigma_ratio=1.6, threshold=0.5, overlap=0.5, threshold_rel=None, exclude_border=False):
"""
"""
Initialize the blob detection object
Initialize the blob detection object
Args:
Args:
volume: The volume to detect blobs in
volume: The volume to detect blobs in
background: 0 if background is darker than the blobs, 1 if background is lighter than the blobs
background: 'dark' if background is darker than the blobs, 'bright' if background is lighter than the blobs
min_sigma: The minimum standard deviation for Gaussian kernel
min_sigma: The minimum standard deviation for Gaussian kernel
max_sigma: The maximum standard deviation for Gaussian kernel
max_sigma: The maximum standard deviation for Gaussian kernel
num_sigma: The number of standard deviations between min and max
num_sigma: The number of standard deviations between min and max
@@ -17,7 +17,7 @@ class blob_detection():
@@ -17,7 +17,7 @@ class blob_detection():
overlap: The fraction of area of two blobs that overlap
overlap: The fraction of area of two blobs that overlap
"""
"""
self.volume = volume
self.volume = volume
if background != 0:
if background == 'bright':
self.volume = np.invert(self.volume)
self.volume = np.invert(self.volume)
self.volume = img_as_float(self.volume)
self.volume = img_as_float(self.volume)
self.min_sigma = min_sigma
self.min_sigma = min_sigma
@@ -35,7 +35,7 @@ class blob_detection():
@@ -35,7 +35,7 @@ class blob_detection():
Args:
Args:
None
None
Returns:
Returns:
blobs: The blobs found in the volume
blobs: The blobs found in the volume as (p, r, c, radius)
"""
"""
blobs = blob_dog(self.volume, min_sigma=self.min_sigma, max_sigma=self.max_sigma, sigma_ratio=self.sigma_ratio, threshold=self.threshold, overlap=self.overlap, threshold_rel=self.threshold_rel, exclude_border=self.exclude_border)
blobs = blob_dog(self.volume, min_sigma=self.min_sigma, max_sigma=self.max_sigma, sigma_ratio=self.sigma_ratio, threshold=self.threshold, overlap=self.overlap, threshold_rel=self.threshold_rel, exclude_border=self.exclude_border)
blobs[:, 3] = blobs[:, 3] * np.sqrt(3) # Change sigma to radius
blobs[:, 3] = blobs[:, 3] * np.sqrt(3) # Change sigma to radius
Loading