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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
==========
Generators
==========
Generators produce data and have at least one output but no input.
File reader
===========
.. gobj:class:: read
The reader loads single files from disk to produce a stream of
two-dimensional data items. Supported file types depend on the compiled
plugin. Raw (`.raw`) and EDF (`.edf`) files can always be read without
additional support. Additionally, loading TIFF (`.tif` and `.tiff`) and HDF5
(`.h5`) files might be supported.
The nominal resolution can be decreased by specifying the :gobj:prop:`y`
coordinate and a :gobj:prop:`height`. Due to reduced I/O, this can
dramatically improve performance.
.. gobj:prop:: path:string
Glob-style pattern that describes the file path. For HDF5 files this
must point to a file and a data set separated by a colon, e.g.
``/path/to/file.h5:/my/data/set``.
.. gobj:prop:: number:uint
Number of files to read.
.. gobj:prop:: start:uint
First index from where files are read.
.. gobj:prop:: image-start:uint
First image index from where images are read in multi-image files.
.. gobj:prop:: step:uint
Number of files to skip.
.. gobj:prop:: image-step:uint
Number of images to skip in a multi-image file.
.. gobj:prop:: y:uint
Vertical coordinate from where to start reading.
.. gobj:prop:: height:uint
Height of the region that is read from the image.
.. gobj:prop:: y-step:uint
Read every ``y-step`` row.
.. gobj:prop:: convert:boolean
Convert input data to float elements, enabled by default.
.. gobj:prop:: raw-width:uint
Specifies the width of raw files.
.. gobj:prop:: raw-height:uint
Specifies the height of raw files.
.. gobj:prop:: raw-bitdepth:uint
Specifies the bit depth of raw files.
.. gobj:prop:: raw-pre-offset:ulong
Offset that is skipped before reading the next frame from the current file.
.. gobj:prop:: raw-post-offset:ulong
Offset that is skipped after reading the last frame from the current file.
.. gobj:prop:: type:enum
Overrides the type detection that is based on the file extension. For
example, to load `.foo` files as raw files, set the ``type`` property to
`raw`.
Memory reader
=============
.. gobj:class:: memory-in
Reads data from a pre-allocated memory region. Unlike input and output tasks
this can be used to interface with other code more directly, e.g. to read
from a NumPy buffer::
from gi.repository import Ufo
import numpy as np
import tifffile
ref = np.random.random((512, 512)).astype(np.float32)
pm = Ufo.PluginManager()
g = Ufo.TaskGraph()
sched = Ufo.Scheduler()
read = pm.get_task('memory-in')
write = pm.get_task('write')
read.props.pointer = ref.__array_interface__['data'][0]
read.props.width = ref.shape[1]
read.props.height = ref.shape[0]
read.props.number = 1
write.props.filename = 'out.tif'
g.connect_nodes(read, write)
sched.run(g)
out = tifffile.imread('out.tif')
assert np.sum(out - ref) == 0.0
.. gobj:prop:: pointer:ulong
Pointer to pre-allocated memory.
.. gobj:prop:: width:uint
Specifies the width of input.
.. gobj:prop:: height:uint
Specifies the height of input.
.. gobj:prop:: number:uint
Specifies the number of items to read.
ZeroMQ subscriber
=================
.. gobj:class:: zmq-sub
Generates a stream from a compatible ZeroMQ data stream, for example
published by the :gobj:class:`zmq-pub` task.
.. gobj:prop:: address:string
Host address of the ZeroMQ publisher. Note, that as of now the publisher
binds to a ``tcp`` endpoint, thus you have to use that as well. By
default, the address is set to the local host address 127.0.0.1.
UcaCamera reader
================
.. gobj:class:: camera
The camera task uses `libuca`_ to read frames from a connected camera and
provides them as a stream.
When :gobj:prop:`name` is provided, the corresponding plugin is instantiated
by the camera task itself. However, an already configured UcaCamera object
can also be passed via :gobj:prop:`camera`.
.. gobj:prop:: name:string
Name of the camera that is used.
.. gobj:prop:: number:uint
Number of frames that are recorded.
.. gobj:prop:: properties:string
Property string, i.e. ``roi-width=512 exposure-time=0.1``.
.. _libuca: https://github.com/ufo-kit/libuca
.. note:: This requires third-party library *libuca*.
stdin reader
============
.. gobj:class:: stdin
Reads data from stdin to produce a valid data stream. :gobj:prop:`width`,
:gobj:prop:`height` and :gobj:prop:`bitdepth` must be set correctly to
ensure correctly sized data items.
.. gobj:prop:: width:uint
Specifies the width of input.
.. gobj:prop:: height:uint
Specifies the height of input.
.. gobj:prop:: bitdepth:uint
Specifies the bit depth of input.
.. gobj:prop:: convert:boolean
Convert input data types to float, enabled by default.
Metaball simulation
===================
.. gobj:class:: metaballs
Generate animated meta balls. In each time step the meta balls move by a
random velocity.
.. gobj:prop:: width:uint
Width of output data stream.
.. gobj:prop:: height:uint
Height of output data stream.
.. gobj:prop:: number-balls:uint
Number of meta balls.
.. gobj:prop:: number:uint
Length of data stream.
Data generation
===============
.. gobj:class:: dummy-data
Only asks for image data sized :gobj:prop:`width` times :gobj:prop:`height`
times :gobj:prop:`depth` and forwards :gobj:prop:`number` of them to the
next filter. The data is never touched if :gobj:prop:`init` is not set, thus
it might be suitable for performance measurements.
.. gobj:prop:: width:uint
Width of image data stream.
.. gobj:prop:: height:uint
Height of image data stream.
.. gobj:prop:: depth:uint
Depth of image data stream.
.. gobj:prop:: number:uint
Number of images to produce.
.. gobj:prop:: init:float
Value to initialize the output buffer.
|