Adds improvements in the inputs and outputs API of widgets. This included changes made to WidgetModel as well as DataSink and DataSource interfaces.
added a widget.inputs object which maps inputs to data sinks, allowing you to do something like widget.inputs.image.next(img). This makes it possible to pipe a data source to a widget input or to pass the input to an observable.
added a widget.outputs object which maps outputs to data sources, allowing you to do something like widget.outputs.image.pipe(dest). This allows you to pipe outputs to data sinks or to use them as observables.
you can also use the widget itself as a data source or observable via widget.pipe(outputs) or widget.subscribe(observer). In this case the value is the entire outputs objects returned by onUpdate(ctx)
the DataSink interface has been changed, it now only contains a next method
DataSource has been changed, it now has pipe and subscribe methods, in addition to exposing an observable
There are new widget.setInputs(inputs: object) and setParams(params: object) methods which allow you to set multiple inputs/params at a go
ImageViewer now implements the DataSink interface. So you can pipe a widget output directly to the imviewer. The imviewer's next implementation calls .delete() on the image matrix it receives to make sure memory is cleaned, assuming it will be used as the last sink in the pipeline.
Addresses #27
Adds improvements in the inputs and outputs API of widgets. This included changes made to
WidgetModel
as well asDataSink
andDataSource
interfaces.widget.inputs
object which maps inputs to data sinks, allowing you to do something likewidget.inputs.image.next(img)
. This makes it possible to pipe a data source to a widget input or to pass the input to an observable.widget.outputs
object which maps outputs to data sources, allowing you to do something likewidget.outputs.image.pipe(dest)
. This allows you to pipe outputs to data sinks or to use them as observables.widget.pipe(outputs)
orwidget.subscribe(observer)
. In this case the value is the entire outputs objects returned byonUpdate(ctx)
DataSink
interface has been changed, it now only contains anext
methodDataSource
has been changed, it now haspipe
andsubscribe
methods, in addition to exposing anobservable
widget.setInputs(inputs: object)
andsetParams(params: object)
methods which allow you to set multiple inputs/params at a goImageViewer
now implements theDataSink
interface. So you can pipe a widget output directly to theimviewer
. Theimviewer
'snext
implementation calls.delete()
on the image matrix it receives to make sure memory is cleaned, assuming it will be used as the last sink in the pipeline.