Repository navigation
Expand file tree
/
Copy pathquick.py
More file actions
69 lines (55 loc) · 1.83 KB
/
Copy pathquick.py
File metadata and controls
69 lines (55 loc) · 1.83 KB
1
2
3
4
5
6
7
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
"""
Quick-start helpers
===================
create_default_pipeline() and quick_analysis(): a ThunderSTORM pipeline with
the default settings, and a one-call analysis + Gaussian rendering. Also
importable from the package root and from pipeline.py.
"""
from .pipeline import ThunderSTORM
def create_default_pipeline():
"""Create ThunderSTORM pipeline with default settings.
These are the default settings that work well on many datasets.
Returns
-------
pipeline : ThunderSTORM
Configured pipeline
"""
return ThunderSTORM(
filter_type='wavelet',
filter_params={'scale': 2, 'order': 3},
detector_type='local_maximum',
detector_params={'connectivity': '8-neighbourhood', 'min_distance': 1},
fitter_type='gaussian_lsq',
fitter_params={'integrated': True, 'elliptical': False, 'initial_sigma': 1.3},
threshold_expression='std(Wave.F1)',
pixel_size=100.0, # nm
photons_per_adu=1.0,
baseline=100.0,
em_gain=1.0
)
def quick_analysis(images, **kwargs):
"""Quick analysis with default parameters.
Parameters
----------
images : ndarray
Image stack to analyze
**kwargs : dict
Additional parameters for pipeline
Returns
-------
localizations : dict
Detected localizations
rendered : ndarray
Rendered super-resolution image
"""
# Create pipeline
pipeline = create_default_pipeline()
# Update any custom parameters
for key, value in kwargs.items():
if hasattr(pipeline, key):
setattr(pipeline, key, value)
# Analyze
localizations = pipeline.analyze_stack(images)
# Render
rendered = pipeline.render(renderer_type='gaussian', pixel_size=10)
return localizations, rendered, pipeline