File: points_example_smlm.py

package info (click to toggle)
napari 0.6.6-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,036 kB
  • sloc: python: 112,264; xml: 72; makefile: 44; sh: 5
file content (32 lines) | stat: -rw-r--r-- 971 bytes parent folder | download
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
import csv

import numpy as np
import pooch

import napari

"""
This data comes from the Neurocyto Lab's description of the ThunderSTORM format.
This file format is used to represent single molecule localizations.

With respect to the napari async slicing work, this dataset is small enough that it performs well in synchronous mode.

If someone is interested, then you can use the uncertainty_xy attribute from the STORM data to change the point size.

More information is available here: http://www.neurocytolab.org/tscolumns/
"""

storm_path = pooch.retrieve(
    url='http://www.neurocytolab.org/wp-content/uploads/2018/06/ThunderSTORM_TS3D.csv',
    known_hash='665a28b2fad69dbfd902e4945df04667f876d33a91167614c280065212041a29',
    progressbar=True
)

with open(storm_path) as csvfile:
    data = list(csv.reader(csvfile))

data = np.array(data[1:]).astype(float)
data = data[:, 1:4]
viewer = napari.Viewer()
layer = viewer.add_points(data, size = 50)
napari.run()