Skip to content

Commit 927317b

Browse files
author
joeljonsson
committed
added viewer demo
1 parent 8a997b7 commit 927317b

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

demo/viewer_demo.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import pyapr
2+
import numpy as np
3+
from demo.io import read_tiff
4+
5+
6+
def main():
7+
# Read in an image
8+
fpath = '../LibAPR/test/files/Apr/sphere_120/sphere_original.tif'
9+
img = read_tiff(fpath).astype(np.uint16)
10+
11+
# Initialize objects
12+
apr = pyapr.APR()
13+
parts = pyapr.ShortParticles()
14+
par = pyapr.APRParameters()
15+
converter = pyapr.converter.ShortConverter()
16+
17+
# Set some parameters
18+
par.auto_parameters = False
19+
par.rel_error = 0.1
20+
par.Ip_th = 0
21+
par.gradient_smoothing = 2
22+
par.sigma_th = 50
23+
par.sigma_th_max = 20
24+
converter.set_parameters(par)
25+
converter.set_verbose(True)
26+
27+
# Compute APR and sample particle values
28+
converter.get_apr(apr, img)
29+
parts.sample_image(apr, img)
30+
apr.init_tree()
31+
32+
pyapr.viewer.parts_viewer(apr, parts)
33+
34+
35+
if __name__ == '__main__':
36+
main()

pyapr/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
from .converter import *
2929
from .io import *
3030
from .numerics import *
31-
#from .viewer import *
31+
from .viewer import *
3232

3333
__all__ = ['data_containers', 'io', 'nn', 'viewer', 'converter', 'numerics', 'tests']

0 commit comments

Comments
 (0)