Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::ImageOutport Class Reference

#include <imageport.h>

+ Inheritance diagram for inviwo::ImageOutport:

Public Member Functions

 ImageOutport (std::string_view identifier, Document help, const DataFormatBase *format=DataVec4UInt8::get(), HandleResizeEvents value=HandleResizeEvents::Yes)
 
 ImageOutport (std::string_view identifier, const DataFormatBase *format=DataVec4UInt8::get(), bool handleResizeEvents=true)
 
 ImageOutport (std::string_view 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)
 
virtual std::shared_ptr< const ImagedetachData () override
 
virtual void clear () override
 
bool hasEditableData () const
 
std::shared_ptr< ImagegetEditableData () const
 
std::shared_ptr< const ImagegetDataForPort (const Inport *port) const
 
void propagateEvent (Event *event, Inport *source) override
 
const DataFormatBasegetDataFormat () 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_view identifier, Document help={})
 
virtual glm::uvec3 getColorCode () const override
 
virtual std::shared_ptr< const ImagegetData () const
 
virtual void setData (const Image *data)
 
void setData (Image &&data)
 
virtual bool hasData () const override
 
- 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
 Port (const Port &)=delete
 
Portoperator= (const Port &)=delete
 
 Port (Port &&)=delete
 
Portoperator= (Port &&)=delete
 
const std::string & getIdentifier () const
 
void setIdentifier (const std::string &name)
 
ProcessorgetProcessor () const
 
std::string getPath () const
 Get the port path i.e. <processor identifier>.<port identifier>
 
const DocumentgetHelp () const
 
DocumentgetHelp ()
 
PortsetHelp (Document help)
 
virtual void serialize (Serializer &s) const override
 
virtual void deserialize (Deserializer &d) override
 
- Public Member Functions inherited from inviwo::Serializable
- Public Member Functions inherited from inviwo::OutportIterableImpl< DataOutport< Image >, Image >
virtual const_iterator begin () const override
 
virtual const_iterator end () const override
 
- Public Member Functions inherited from inviwo::OutportIterable< Image >

Friends

template<size_t N>
class BaseImageInport
 

Additional Inherited Members

- Public Types inherited from inviwo::DataOutport< Image >
using type
 
- Public Types inherited from inviwo::OutportIterableImpl< DataOutport< Image >, Image >
using Container
 
using const_iterator
 
- Protected Member Functions inherited from inviwo::Outport
 Outport (std::string_view identifier, Document help)
 
- Protected Member Functions inherited from inviwo::Port
 Port (std::string_view identifier, Document help)
 
void setProcessor (Processor *processor)
 
- Protected Attributes inherited from inviwo::DataOutport< Image >
std::shared_ptr< const Imagedata_
 
- 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_
 
Processorprocessor_
 
Document help_
 

Detailed Description

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. (

See also
ImageExport,
CanvasProcessorWidget)
BaseImageInport
ResizeEvent

Member Function Documentation

◆ clear()

virtual void inviwo::ImageOutport::clear ( )
overridevirtual

Clear the outport of any data

Reimplemented from inviwo::DataOutport< Image >.

◆ connectTo()

virtual void inviwo::ImageOutport::connectTo ( Inport * port)
overridevirtual

Reimplemented from inviwo::Outport.

◆ detachData()

virtual std::shared_ptr< const Image > inviwo::ImageOutport::detachData ( )
overridevirtual

Return data and release ownership. Data in the port will be nullptr after call.

Reimplemented from inviwo::DataOutport< Image >.

◆ disconnectFrom()

virtual void inviwo::ImageOutport::disconnectFrom ( Inport * port)
overridevirtual

Reimplemented from inviwo::Outport.

◆ getClassIdentifier()

virtual std::string inviwo::ImageOutport::getClassIdentifier ( ) const
overridevirtual

Reimplemented from inviwo::DataOutport< Image >.

◆ getInfo()

virtual Document inviwo::ImageOutport::getInfo ( ) const
overridevirtual

This function should describe the state of the port and the data it holds. Derived ports should extend this function and add information about their state. The port help is usually included in this information. The description is usually shown as a tooltip in the GUI.

Reimplemented from inviwo::DataOutport< Image >.

◆ invalidate()

virtual void inviwo::ImageOutport::invalidate ( InvalidationLevel invalidationLevel)
overridevirtual

Called by Processor::invalidate, will invalidate its connected inports.

Note
Port is set to valid after its processor successfully finish processing.
See also
setValid

Reimplemented from inviwo::Outport.

◆ propagateEvent()

void inviwo::ImageOutport::propagateEvent ( Event * event,
Inport * source )
overridevirtual

Handle resize event

Reimplemented from inviwo::Outport.

◆ setData() [1/2]

virtual void inviwo::ImageOutport::setData ( std::shared_ptr< const Image > )
overridevirtual

Reimplemented from inviwo::DataOutport< Image >.

◆ setData() [2/2]

void inviwo::ImageOutport::setData ( std::shared_ptr< Image > )
virtual

Reimplemented from inviwo::DataOutport< Image >.

◆ setDimensions()

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.

◆ setHandleResizeEvents()

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.

Parameters
handleResizeEventsTrue if data should be resized during a resize propagation, otherwise false

The documentation for this class was generated from the following file: