Sinks
Sinks are endpoints and have at least one input but no output.
File writer
- 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. By default,
bytes-per-file
is set to 128 GB, set it to 0 if you want to write single-page files.- "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"
producesdata-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.
- "counter-start": uint
Sets the counter that replaces the format specifier. Initially, it is set to 0.
- "counter-step": uint
Determines the number of steps the counter replacing the format specifier is incremented. Initially, it is set to 1.
- "bytes-per-file": ulong
Bytes per file for multi-page files.
- "append": boolean
Append rather than overwrite if
TRUE
.
- "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
andmaximum
properties. To avoid rescaling, set therescale
property toFALSE
.
- "minimum": float
This value will represent zero for discrete bit depths, i.e. 8 and 16 bit.
- "minimum": float
This value will represent the largest possible value for discrete bit depths, i.e. 8 and 16 bit.
- "rescale": boolean
If
TRUE
andbits
is set to a value less than 32, rescale values either by looking for minimum and maximum values or using the values provided by the user.
For JPEG files the following property applies:
- "jpeg-quality": uint
JPEG quality value between 0 and 100. Higher values correspond to higher quality and larger file sizes.
For TIFF files the following property applies:
- "tiff-bigtiff": boolean
Whether to write in BigTiff format (required for files larger than 4 GB).
Memory writer
- 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
- "pointer": ulong
Pointer to pre-allocated memory.
- "max-size": ulong
Size of the pre-allocated memory area in bytes. Data is written up to that point only.