# Extensions¶

Concert integrates third-party software in the ext package. Because the dependencies of these modules are not listed as Concert dependencies, you have to make sure, that the appropriate libraries and modules are installed.

## UFO Processing¶

### Base objects¶

class concert.ext.ufo.PluginManager

Plugin manager that initializes new tasks.

Create a new task from plugin name and initialize with kwargs.

class concert.ext.ufo.InjectProcess(graph, get_output=False)

Process to inject NumPy data into a UFO processing graph.

InjectProcess can also be used as a context manager, in which case it will call start() on entering the manager and wait() on exiting it.

graph must either be a Ufo.TaskGraph or a Ufo.TaskNode object. If it is a graph the input tasks will be connected to the roots, otherwise a new graph will be created.

insert(array, node=None, index=0)

Insert array into the node‘s index input.

Note

array must be a NumPy compatible array.

start()

Run the processing in a new thread.

Use push() to insert data into the processing chaing and wait() to wait until processing has finished.

wait()

Wait until processing has finished.

### Coroutines¶

class concert.ext.ufo.Backproject(axis_pos=None)

Coroutine to reconstruct slices from sinograms using filtered backprojection.

axis_pos specifies the center of rotation in pixels within the sinogram. If not specified, the center of the image is assumed to be the center of rotation.

## Viewers¶

Opening images in external programs.

class concert.ext.viewers.PyplotImageViewer(imshow_kwargs=None, colorbar=True, title='')

Dynamic image viewer using matplotlib.

show(item, force=False)

show item into the redrawing queue. The item is truly inserted only if the queue is empty in order to guarantee that the newest image is drawn or if the force is True.

class concert.ext.viewers.PyplotViewer(style='o', plot_kwargs=None, autoscale=True, title='')

Dynamic plot viewer using matplotlib.

style

One of matplotlib’s linestyle format strings

plt_kwargs

Keyword arguments accepted by matplotlib’s plot()

autoscale

If True, the axes limits will be expanded as needed by the new data, otherwise the user needs to rescale the axes

clear()

Clear the plotted data.

plot(x, y=None, force=False)

Plot x and y, if y is None and x is a scalar the real y is given by x and x is the current iteration of the plotting command, if x is an iterable then it is interpreted as y data array and x is a span [0, len(x)]. If both x and y are given, they are plotted as they are. If force is True the plotting is guaranteed, otherwise it might be skipped for the sake of plotting speed.

Note: if x is not given, the iteration starts at 0.

class concert.ext.viewers.PyplotViewerBase(view_function, blit=False)

A base class for data viewer which sends commands to a matplotlib updater which runs in a separate process.

view_function

The function which updates the figure based on the changed data. Its nomenclature has to be:

foo(data, force=False)


Where force determines whether the redrawing must be done or not. If it is False, the redrawing takes place if the data queue contains only the current data item. This prevents the actual drawer from being overwhelmed by the amount of incoming data.

blit

True if faster redrawing based on canvas blitting should be used.

pause()

Pause, no images are dispayed but image commands work.

resume()

Resume the viewer.

terminate()

Close all communication and terminate child process.

concert.ext.viewers.imagej(*args, **kwargs)

Open image in ImageJ found by path. writer specifies the written image file type.