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
|
=====
Sinks
=====
Sinks are endpoints and have at least one input but no output.
File writer
===========
.. gobj:class:: write
Writes input data to the file system. Support for writing depends on compile
support, however raw (`.raw`) files can always be written. TIFF (`.tif` and
`.tiff`), HDF5 (`.h5`) and JPEG (`.jpg` and `.jpeg`) might be supported
additionally.
.. gobj:prop:: filename:string
Format string specifying the location and filename pattern of the
written data. It must contain at most *one* integer format specifier
that denotes the current index of a series. For example,
``"data-%03i.tif"`` produces ``data-001.tif``, ``data-002.tif`` and so
on. If no specifier is given, the data is written preferably to a single
file (i.e. multi-tiff, HDF5 data set). If no filename is given the data
is written as-is to stdout.
.. gobj:prop:: counter-start:uint
Sets the counter that replaces the format specifier. Initially, it is
set to 0.
.. gobj:prop:: counter-step:uint
Determines the number of steps the counter replacing the format
specifier is incremented. Initially, it is set to 1.
.. gobj:prop:: append:boolean
Append rather than overwrite if ``TRUE``.
.. gobj:prop:: bits:uint
Number of bits to store the data if applicable to the file format.
Possible values are 8 and 16 which are saved as integer types and 32 bit
float. By default, the minimum and maximum for scaling is determined
automatically, however depending on the use case you should override
this with the ``minimum`` and ``maximum`` properties.
.. gobj:prop:: minimum:float
This value will represent zero for discrete bit depths, i.e. 8 and 16
bit.
.. gobj:prop:: minimum:float
This value will represent the largest possible value for discrete bit
depths, i.e. 8 and 16 bit.
For JPEG files the following property applies:
.. gobj:prop:: quality:uint
JPEG quality value between 0 and 100. Higher values correspond to higher
quality and larger file sizes.
Memory writer
=============
.. gobj:class:: memory-out
Writes input to a given memory location. Unlike input and output tasks this
can be used to interface with other code more directly, e.g. to write into a
NumPy buffer::
from gi.repository import Ufo
import numpy as np
import tifffile
ref = tifffile.imread('data.tif')
a = np.zeros_like(ref)
pm = Ufo.PluginManager()
g = Ufo.TaskGraph()
sched = Ufo.Scheduler()
read = pm.get_task('read')
out = pm.get_task('memory-out')
read.props.path = 'data.tif'
out.props.pointer = a.__array_interface__['data'][0]
out.props.max_size = ref.nbytes
g.connect_nodes(read, out)
sched.run(g)
assert np.sum(a - ref) == 0.0
.. gobj:prop:: pointer:ulong
Pointer to pre-allocated memory.
.. gobj:prop:: max-size:ulong
Size of the pre-allocated memory area in bytes. Data is written up to
that point only.
ZeroMQ publisher
================
.. gobj:class:: zmq-pub
Publishes the stream as a ZeroMQ data stream to compatible ZeroMQ
subscribers such as the :gobj:class:`zmq-sub` source.
.. gobj:prop:: expected-subscribers:uint
If set, the publisher will wait until the number of expected subscribers
have connected.
Auxiliary sink
==============
Null
====
.. gobj:class:: null
Eats input and discards it.
.. gobj:prop:: download:boolean
If *TRUE* force final data transfer from device to host if necessary.
.. gobj:prop:: finish:boolean
Call finish on the associated command queue.
.. gobj:prop:: durations:boolean
Print durations computed from timestamps on ``stderr``.
|