To do...
Figure: Visualization of soma detection pipeline. See "Inference" section for description of each step.
Here is an example of calling the main routine to run the full inference pipeline.
if __name__ == "__main__":
# Initializations
brain_id = "unique-identifier-of-dataset"
img_prefix = "path-to-image"
save_proposals_bool = True
save_somas_bool = True
# Parameters ~ Proposal Generation
multiscale_1 = 4
patch_shape_1 = (64, 64, 64)
bright_threshold = 100
overlap = (28, 28, 28)
# Parameters ~ Proposal Classification
multiscale_2 = 1
patch_shape_2 = (102, 102, 102)
accept_threshold = 0.4
model_path = "path-to-model"
# Main
main()
The objective of this step is to generate initial proposals for potential soma locations by detecting blob-like structures in the image. Our proposal generation algorithm consists the following steps:
a. Smooth image with Gaussian filter to reduce false positives.
b. Laplacian of Gaussian (LoG) with multiple sigmas to enhance regions where the gradient changes rapidly, then apply a non-linear maximum filter.
c. Generate initial set of proposals by detecting local maximas.
d. Shift each proposal to the brightest voxel in its neighborhood. If the brightness is below a threshold, reject the proposal.
Figure: Example of proposals generated across a large region.
The initial proposal generation step is tuned to prioritize high recall which often results in a large number of false positives. The purpose of this step is to use prior knowledge, such as somas having a Gaussian-like appearance and an expected size range, to filter out trivial false positives.
a. Compute distances between proposals and merges proposals within a given distance threshold.
b. If the number of proposals exceeds a certain threshold, the top k brightest proposals are kept.
c. Fit Gaussian to neighborhood centered at proposal and compute fitness score by comparing fitted Gaussian to image values. Proposals are discarded if (1) fitness score is below threshold or (2) estimated standard deviation is out of range.
Figure: Examples of filtered proposals.
To do...
Figure: Example of detected somas across a large region.
To do...
To use the software, in the root directory, run
pip install -e .