Inviwo
0.9.10.1
Inviwo documentation
|
#include <imageport.h>
Public Member Functions | |
ImageOutport (std::string identifier, const DataFormatBase *format=DataVec4UInt8::get(), bool handleResizeEvents=true) | |
ImageOutport (std::string identifier, bool handleResizeEvents) | |
virtual std::string | getClassIdentifier () const override |
virtual void | setData (std::shared_ptr< const Image >) override |
virtual void | setData (const Image *data) override |
void | setData (std::shared_ptr< Image >) |
void | setData (Image *data) |
bool | hasEditableData () const |
std::shared_ptr< Image > | getEditableData () const |
std::shared_ptr< const Image > | getDataForPort (const Inport *port) const |
void | propagateEvent (Event *event, Inport *source) override |
const DataFormatBase * | getDataFormat () const |
size2_t | getDimensions () const |
void | setDimensions (const size2_t &newDimension) |
void | setHandleResizeEvents (bool handleResizeEvents) |
bool | isHandlingResizeEvents () const |
virtual void | invalidate (InvalidationLevel invalidationLevel) override |
virtual void | disconnectFrom (Inport *port) override |
virtual void | connectTo (Inport *port) override |
virtual Document | getInfo () const override |
Public Member Functions inherited from inviwo::DataOutport< Image > | |
DataOutport (std::string identifier) | |
virtual uvec3 | getColorCode () const override |
virtual std::shared_ptr< const Image > | getData () const |
virtual std::shared_ptr< const Image > | detachData () |
bool | hasData () const |
Public Member Functions inherited from inviwo::Outport | |
virtual bool | isConnected () const override |
virtual bool | isReady () const override |
virtual InvalidationLevel | getInvalidationLevel () const |
bool | isConnectedTo (const Inport *port) const |
const std::vector< Inport * > & | getConnectedInports () const |
const BaseCallBack * | onConnect (std::function< void()> lambda) |
const BaseCallBack * | onDisconnect (std::function< void()> lambda) |
void | removeOnConnect (const BaseCallBack *callback) |
void | removeOnDisconnect (const BaseCallBack *callback) |
virtual void | setValid () |
Public Member Functions inherited from inviwo::Port | |
std::string | getIdentifier () const |
void | setIdentifier (const std::string &name) |
Processor * | getProcessor () const |
virtual void | serialize (Serializer &s) const override |
virtual void | deserialize (Deserializer &d) override |
Public Member Functions inherited from inviwo::OutportIterableImpl< T, Enable > | |
OutportIterableImpl (DataOutport< T > *port) | |
virtual const_iterator | begin () const override |
virtual const_iterator | end () const override |
Friends | |
template<size_t N> | |
class | BaseImageInport |
Additional Inherited Members | |
Public Types inherited from inviwo::DataOutport< Image > | |
using | type = Image |
Public Types inherited from inviwo::OutportIterableImpl< T, Enable > | |
using | const_iterator = typename OutportIterable< T >::const_iterator |
Protected Member Functions inherited from inviwo::Outport | |
Outport (std::string identifier="") | |
Protected Member Functions inherited from inviwo::Port | |
Port (std::string identifier="") | |
void | setProcessor (Processor *processor) |
Protected Attributes inherited from inviwo::DataOutport< Image > | |
std::shared_ptr< const Image > | data_ |
Protected Attributes inherited from inviwo::Outport | |
StateCoordinator< bool > | isReady_ |
InvalidationLevel | invalidationLevel_ |
std::vector< Inport * > | connectedInports_ |
CallBackList | onConnectCallback_ |
CallBackList | onDisconnectCallback_ |
Protected Attributes inherited from inviwo::Port | |
std::string | identifier_ |
Processor * | processor_ |
ImageOutport extends DataOutport<Image> with extra functionality for handing ResizeEvents. The following table explains the behaviors:
* ImageOutport * isHandlingResizeEvents() * * True (default) False * ┌──────────────────────────────────┬──────────────────────────────────┐ * │ Outport::Size = max(Inports │ Outport::Size = Outport::size │ * │ requested sizes) │ (no resize of data) │ * │ (resize the data in the outport │ │ * False │ if needed) │ │ * (default)│ │ │ * │ Inport::Size = Inport requested │ Inport::Size = Inport requested │ * │ size │ size │ * ImageInport │ (return a resized copy if │ (return a resized copy if │ * │ needed) │ needed) │ * isOutport- │ │ │ * Determining- ├──────────────────────────────────┼──────────────────────────────────┤ * Size() │ Outport::Size = max(all inports │ Outport::Size = Outport::Size │ * │ requested sizes) │ (no resize of data) │ * │ (resize the data in the outport │ │ * True │ if needed) │ │ * │ │ │ * │ Inport::Size = Outport::size │ Inport::Size = Outport::size │ * │ (no copy) │ (no copy) │ * │ │ │ * │ │ │ * └──────────────────────────────────┴──────────────────────────────────┘ *
The ImageOutport records all the requested sizes from all its connected inports. If the outport 'isHandlingResizeEvents', the port will resize its data to the largest the requested size and propagate that size and a new event upwards in the network. If it does not handle resize events, it will propagate the resize events but not resize its data.
When an inport is disconnected from a outport, the port will remove its requested size and propagate a new resize event upwards with the new largest size, given that the port handles resize events.
As soon as the network adds or removes a connection, all the image sinks (processors that consume images) are responsible for pushing a new resize event to the network to make sure that all the image ports in the network above have an up-to-date view on which image sizes to use. (
|
overridevirtual |
Called by Processor::invalidate, will invalidate its connected inports.
Reimplemented from inviwo::Outport.
Handle resize event
Reimplemented from inviwo::Outport.
void inviwo::ImageOutport::setDimensions | ( | const size2_t & | newDimension | ) |
Set the dimensions of this port without propagating the size through the network. Will call setDimensions on the image contained within the port. This is a destructive operation. The image port has to own it's data for this to work.
void inviwo::ImageOutport::setHandleResizeEvents | ( | bool | handleResizeEvents | ) |
Determine if the image data should be resized during a resize event. We will only resize if we own the data in the port.
handleResizeEvents | True if data should be resized during a resize propagation, otherwise false |