fishdist.spot_validation
find_corresponding_dilated_ROIs(rps_to_search_for, lab_dilated, rps_dilated=None)
Identify the corresponding dilated ROIs for a list of original regions.
For each region in rps_to_search_for, this function finds the matching region
in a dilated labeled image (lab_dilated). Optionally, it can return the
matching RegionProperties if rps_dilated is provided.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example
from skimage.measure import label, regionprops
import numpy as np
spots = np.random.rand(5, 10, 10) > 0.9
lab = label(spots)
rps = regionprops(lab)
# simulate dilation
spots_dilated = np.copy(spots)
lab_dilated = label(spots_dilated)
extended_rois = find_corresponding_dilated_ROIs(rps, lab_dilated)
print(len(extended_rois))
validate_spots(spots, discard_spot_size_rule=None, dilate_spot_size_rule=None, intensity_image_for_regions_optional=None)
Validate and optionally dilate 3D spot ROIs based on size criteria.
This function labels connected components in a 3D spot image, computes region properties, discards small spots, and optionally dilates spots below a size threshold. Returns a list of validated (and potentially dilated) ROIs.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example
import numpy as np
from skimage.measure import regionprops
spots = np.random.rand(10, 20, 20) > 0.95
valid_rois = validate_spots(spots, discard_spot_size_rule=2, dilate_spot_size_rule=4)
print(len(valid_rois))