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

A processor that contains and manages a sub network and evaluates that sub network once per item in an input sequence. More...

#include <inviwo/core/processors/sequenceprocessor.h>

Inheritance diagram for inviwo::SequenceProcessor:

Public Member Functions

PropertyaddSuperProperty (Property *subProperty)
virtual void deserialize (Deserializer &d) override
virtual const ProcessorInfogetProcessorInfo () const override
ProcessorNetworkgetSubNetwork ()
PropertygetSubProperty (Property *superProperty)
PropertygetSuperProperty (Property *subProperty)
SequenceProcessoroperator= (const SequenceProcessor &)=delete
SequenceProcessoroperator= (SequenceProcessor &&)=delete
virtual void process () override
virtual void propagateEvent (Event *event, Outport *source) override
void removeSuperProperty (Property *subProperty)
void saveSubNetwork (const std::filesystem::path &file)
 SequenceProcessor (const SequenceProcessor &)=delete
 SequenceProcessor (SequenceProcessor &&)=delete
 SequenceProcessor (std::string_view identifier, std::string_view displayName, InviwoApplication *app, const std::filesystem::path &filename={})
virtual void serialize (Serializer &s) const override
Public Member Functions inherited from inviwo::Processor
virtual void accept (NetworkVisitor &visitor)
 Accept a NetworkVisitor, the visitor will visit this and then each Property of the Processor in an undefined order. The Visitor will then visit each Properties's properties and so on.
void addInteractionHandler (InteractionHandler *interactionHandler)
template<typename T>
T & addPort (std::unique_ptr< T > port, std::string_view portGroup="default")
template<typename T>
T & addPort (std::unique_ptr< T > port, std::string_view portGroup="default")
template<typename T>
T & addPort (T &port, std::string_view portGroup="default")
template<typename... Ts>
void addPorts (Ts &... ports)
bool allInportsAreReady () const
bool allInportsConnected () const
virtual void doIfNotReady ()
const std::string & getCategory () const
const std::string & getClassIdentifier () const
CodeState getCodeState () const
const std::string & getDisplayName () const
virtual const std::string & getIdentifier () const override
InportgetInport (std::string_view identifier) const
const std::vector< Inport * > & getInports () const
const std::vector< InteractionHandler * > & getInteractionHandlers () const
virtual InviwoApplicationgetInviwoApplication () override
ProcessorNetworkgetNetwork () const
OutportgetOutport (std::string_view identifier) const
const std::vector< Outport * > & getOutports () const
virtual const PropertyOwner * getOwner () const override
virtual PropertyOwner * getOwner () override
PortgetPort (std::string_view identifier) const
const std::string & getPortGroup (Port *port) const
std::vector< std::string > getPortGroups () const
const std::vector< Port * > & getPortsInGroup (std::string_view portGroup) const
const std::vector< Port * > & getPortsInSameGroup (Port *port) const
virtual const ProcessorgetProcessor () const override
virtual ProcessorgetProcessor () override
ProcessorWidgetgetProcessorWidget () const
const TagsgetTags () const
bool hasInteractionHandler () const
bool hasProcessorWidget () const
virtual void initializeResources ()
virtual void invalidate (InvalidationLevel invalidationLevel, Property *modifiedProperty=nullptr) override
virtual void invokeEvent (Event *event) override
virtual bool isConnectionActive (Inport *inport, Outport *outport) const
bool isReady () const
bool isSink () const
bool isSource () const
NameDispatcherHandle onDisplayNameChange (std::function< void(std::string_view, std::string_view)> callback)
NameDispatcherHandle onIdentifierChange (std::function< void(std::string_view, std::string_view)> callback)
 Processor (std::string_view identifier="", std::string_view displayName="")
void removeInteractionHandler (InteractionHandler *interactionHandler)
InportremovePort (Inport *port)
OutportremovePort (Outport *port)
PortremovePort (std::string_view identifier)
void setDisplayName (std::string_view displayName)
void setIdentifier (std::string_view identifier)
virtual void setNetwork (ProcessorNetwork *network)
virtual void setProcessorWidget (std::unique_ptr< ProcessorWidget > processorWidget)
virtual void setValid () override
const ProcessorStatusstatus () const
Public Member Functions inherited from inviwo::PropertyOwner
template<typename... Ts>
void addProperties (Ts &... properties)
void addProperty (Property &property)
void addProperty (Property *property, bool owner=true)
PropertyaddProperty (std::unique_ptr< Property > property)
iterator begin ()
const_iterator begin () const
const_iterator cbegin () const
const_iterator cend () const
virtual void clear ()
 Remove all properties; Owned properties will be deleted.
bool empty () const
iterator end ()
const_iterator end () const
const_iterator find (Property *property) const
const std::vector< CompositeProperty * > & getCompositeProperties () const
InvalidationLevel getInvalidationLevel () const
const std::vector< Property * > & getProperties () const
template<class T>
std::vector< T * > getPropertiesByType (bool recursiveSearch=false) const
std::vector< Property * > getPropertiesRecursive () const
std::vector< Property * > & getPropertiesRecursive (std::vector< Property * > &destination) const
template<std::derived_from< Property > T = Property>
T * getProperty (std::string_view identifier)
PropertygetPropertyByIdentifier (std::string_view identifier, bool recursiveSearch=false) const
PropertygetPropertyByPath (std::string_view path) const
void insertProperty (size_t index, Property &property)
 insert property property at position index If index is not valid, the property is appended.
virtual void insertProperty (size_t index, Property *property, bool owner=true)
 insert property property at position index If index is not valid, the property is appended.
PropertyinsertProperty (size_t index, std::unique_ptr< Property > property)
 insert property property at position index If index is not valid, the property is appended.
virtual bool isValid () const
virtual bool move (Property *property, size_t newIndex)
PropertyOwner & operator= (const PropertyOwner &that)=delete
Propertyoperator[] (size_t)
const Propertyoperator[] (size_t) const
virtual PropertyremoveProperty (iterator it)
PropertyremoveProperty (Property &property)
PropertyremoveProperty (Property *property)
PropertyremoveProperty (size_t index)
 remove property referred to by index
PropertyremoveProperty (std::string_view identifier)
virtual void resetAllProperties ()
virtual void setAllPropertiesCurrentStateAsDefault ()
size_t size () const
virtual ~PropertyOwner ()
 Removes all properties and notifies its observers of the removal.
Public Member Functions inherited from inviwo::PropertyOwnerObservable
void notifyObserversDidAddProperty (Property *property, size_t index)
void notifyObserversDidRemoveProperty (PropertyOwner *owner, Property *property, size_t index)
void notifyObserversWillAddProperty (PropertyOwner *owner, Property *property, size_t index)
void notifyObserversWillRemoveProperty (Property *property, size_t index)
Public Member Functions inherited from inviwo::Observable< PropertyOwnerObserver >
void addObserver (PropertyOwnerObserver *observer)
bool isObservedBy (PropertyOwnerObserver *observer) const
Observable< PropertyOwnerObserver > & operator= (const Observable< PropertyOwnerObserver > &other)
void removeObserver (PropertyOwnerObserver *observer)
virtual void startBlockingNotifications () override final
virtual void stopBlockingNotifications () override final
Public Member Functions inherited from inviwo::MetaDataOwner
void copyMetaDataFrom (const MetaDataOwner &src)
void copyMetaDataTo (MetaDataOwner &dst)
template<typename T>
T * createMetaData (std::string_view key)
void deserialize (Deserializer &d)
template<typename T>
T * getMetaData (std::string_view key)
template<typename T>
const T * getMetaData (std::string_view key) const
template<typename T, typename U>
getMetaData (std::string_view key, U val) const
MetaDataMapgetMetaDataMap ()
const MetaDataMapgetMetaDataMap () const
template<typename T>
bool hasMetaData (std::string_view key) const
bool hasMetaData (std::string_view key) const
 MetaDataOwner (const MetaDataOwner &rhs)=default
 MetaDataOwner (MetaDataOwner &rhs)=default
MetaDataOwner & operator= (const MetaDataOwner &rhs)=default
MetaDataOwner & operator= (MetaDataOwner &)=default
void serialize (Serializer &s) const
template<typename T, typename U>
void setMetaData (std::string_view key, U value)
template<typename T>
bool unsetMetaData (std::string_view key)
 unset, i.e. remove the metadata entry matching the given key and type
Public Member Functions inherited from inviwo::Observable< ProcessorObserver >
void addObserver (ProcessorObserver *observer)
bool isObservedBy (ProcessorObserver *observer) const
Observable< ProcessorObserver > & operator= (const Observable< ProcessorObserver > &other)
void removeObserver (ProcessorObserver *observer)
virtual void startBlockingNotifications () override final
virtual void stopBlockingNotifications () override final
Public Member Functions inherited from inviwo::ProcessorNetworkObserver
virtual void onProcessorNetworkChange ()
virtual void onProcessorNetworkDidAddConnection (const PortConnection &)
virtual void onProcessorNetworkDidAddLink (const PropertyLink &)
virtual void onProcessorNetworkDidRemoveConnection (const PortConnection &)
virtual void onProcessorNetworkDidRemoveLink (const PropertyLink &)
virtual void onProcessorNetworkDidRemoveProcessor (Processor *)
virtual void onProcessorNetworkUnlocked ()
virtual void onProcessorNetworkWillAddConnection (const PortConnection &)
virtual void onProcessorNetworkWillAddLink (const PropertyLink &)
virtual void onProcessorNetworkWillAddProcessor (Processor *)
virtual void onProcessorNetworkWillRemoveConnection (const PortConnection &)
virtual void onProcessorNetworkWillRemoveLink (const PropertyLink &)
Public Member Functions inherited from inviwo::Observer
 Observer (const Observer &other)
 Observer (Observer &&other)
Observer & operator= (const Observer &other)
Observer & operator= (Observer &&other)
void removeObservation (ObservableInterface *observable)
void removeObservations ()
virtual ~Observer ()
Public Member Functions inherited from inviwo::PropertyOwnerObserver
virtual void onDidRemoveProperty (PropertyOwner *owner, Property *property, size_t index)
virtual void onWillAddProperty (PropertyOwner *owner, Property *property, size_t index)

Static Public Attributes

static const ProcessorInfo processorInfo_

Additional Inherited Members

Public Types inherited from inviwo::Processor
using NameDispatcher = Dispatcher<void(std::string_view, std::string_view)>
using NameDispatcherHandle = typename NameDispatcher::Handle
Public Types inherited from inviwo::PropertyOwner
using const_iterator = std::vector<Property*>::const_iterator
using iterator = std::vector<Property*>::iterator
Public Attributes inherited from inviwo::ProcessorNetworkObserver
friend ProcessorNetworkObservable
Public Attributes inherited from inviwo::PropertyOwnerObserver
friend PropertyOwnerObservable
Protected Member Functions inherited from inviwo::Processor
void addPortToGroup (Port *port, std::string_view portGroup)
void removePortFromGroups (Port *port)
void setInportsChanged (bool changed)
Protected Member Functions inherited from inviwo::PropertyOwner
void forEachProperty (std::function< void(Property &)> callback, bool recursiveSearch=false) const
PropertyOwner & operator= (PropertyOwner &&that)
 PropertyOwner (const PropertyOwner &rhs)
 PropertyOwner (PropertyOwner &&rhs)
Protected Member Functions inherited from inviwo::Observable< PropertyOwnerObserver >
void forEachObserver (C callback)
Protected Member Functions inherited from inviwo::ObservableInterface
void addObservationHelper (Observer *observer)
virtual void addObserver (Observer *observer)=0
void removeObservationHelper (Observer *observer)
virtual void removeObserver (Observer *observer)=0
Protected Member Functions inherited from inviwo::ProcessorObservable
void notifyObserversAboutPropertyChange (Property *p)
void notifyObserversAboutToProcess (Processor *p)
void notifyObserversActiveConnectionsChange (Processor *p)
void notifyObserversFinishBackgroundWork (Processor *p, size_t jobs=1)
void notifyObserversFinishedProcess (Processor *p)
void notifyObserversInvalidationBegin (Processor *p)
void notifyObserversInvalidationEnd (Processor *p)
void notifyObserversProcessorPortAdded (Processor *p, Port *port)
void notifyObserversProcessorPortRemoved (Processor *p, Port *port)
void notifyObserversProgressChanged (Processor *p, std::optional< double > progress)
void notifyObserversReadyChange (Processor *p)
void notifyObserversSinkChange (Processor *p)
void notifyObserversSourceChange (Processor *p)
void notifyObserversStartBackgroundWork (Processor *p, size_t jobs=1)
Protected Member Functions inherited from inviwo::Observable< ProcessorObserver >
void forEachObserver (C callback)
Protected Member Functions inherited from inviwo::Observer
void addObservation (ObservableInterface *observable)
Static Protected Member Functions inherited from inviwo::Processor
static std::function< ProcessorStatus()> getDefaultIsReadyUpdater (Processor *)
Protected Attributes inherited from inviwo::Processor
StateCoordinator< ProcessorStatusisReady_
StateCoordinator< bool > isSink_
StateCoordinator< bool > isSource_
std::unique_ptr< ProcessorWidgetprocessorWidget_
Protected Attributes inherited from inviwo::PropertyOwner
std::vector< CompositeProperty * > compositeProperties_
std::vector< EventProperty * > eventProperties_
std::vector< std::unique_ptr< Property > > ownedProperties_
std::vector< Property * > properties_
Protected Attributes inherited from inviwo::MetaDataOwner
MetaDataMap metaData_
Protected Attributes inherited from inviwo::ProcessorObservable
friend ProcessorNetworkEvaluator
friend Property
Protected Attributes inherited from inviwo::Observer
std::unordered_set< ObservableInterface * > observables_

Detailed Description

A processor that contains and manages a sub network and evaluates that sub network once per item in an input sequence.

The SequenceProcessor encapsulates a group of processors (the sub network) and applies the same sub network computation to every element of an input sequence. Unlike a standard composite processor that evaluates its sub network exactly once per call to process(), the SequenceProcessor iterates over an input sequence and evaluates the sub network for each item in turn. This is useful when you want to run identical processing steps for each element in a collection (e.g., frames, volumes, or any sequence of data).

Typical workflow:

  • Create a sequence composite by selecting a group of processors in the network editor and choosing "create sequence".
  • The SequenceProcessor exposes special "super" inports and outports that bridge the super network (the enclosing network) and the sub network. SequenceCompositeSourceBase processors inside the sub network act as per-item inputs: for each item the SequenceProcessor places the current item on the super inport and the source processor forwards it into the sub network. SequenceCompositeSinkBase processors act as per-item outputs: after processing a single item the sink processors forward the result back to the super network.

Behavior when running:

  • The SequenceProcessor iterates the input sequence.
  • For each item it provides the item to the sub network via SequenceCompositeSourceBase(s), evaluates the sub network for that single item, and collects per-item outputs from SequenceCompositeSinkBase(s) back to the super network.

Properties in the sub network added via addSuperProperty, are cloned and exposed on the SequenceProcessor. The cloned properties are synchronized with the originals using mutual onChange callbacks so that state is kept consistent between the super and sub networks.

Events are forwarded through the sub network using the super inports and outports.

See also
SequenceCompositeSourceBase
SequenceCompositeSinkBase

Constructor & Destructor Documentation

◆ SequenceProcessor()

inviwo::SequenceProcessor::SequenceProcessor ( std::string_view identifier,
std::string_view displayName,
InviwoApplication * app,
const std::filesystem::path & filename = {} )

Construct a SequenceProcessor. An optional workspace file can be supplied in which case it is deserialized as the SequenceProcessor's sub network; otherwise the sub network is left empty. Call getSubNetwork() to add processors programmatically.

Member Function Documentation

◆ addSuperProperty()

Property * inviwo::SequenceProcessor::addSuperProperty ( Property * subProperty)

Add a corresponding property in the SequenceProcessor for the sub property 'subProperty' in the sub network. Changes in the subProperty will be reflected in the superProperty and vice versa.

◆ deserialize()

virtual void inviwo::SequenceProcessor::deserialize ( Deserializer & d)
overridevirtual

Reimplemented from inviwo::Processor.

◆ getProcessorInfo()

virtual const ProcessorInfo & inviwo::SequenceProcessor::getProcessorInfo ( ) const
overridevirtual

Implements inviwo::Processor.

◆ getSubNetwork()

ProcessorNetwork & inviwo::SequenceProcessor::getSubNetwork ( )

Get access to the sub network to add or remove processors etc

◆ getSubProperty()

Property * inviwo::SequenceProcessor::getSubProperty ( Property * superProperty)

Get the sub property for super property 'superProperty'.

◆ getSuperProperty()

Property * inviwo::SequenceProcessor::getSuperProperty ( Property * subProperty)

Get the super property for sub property 'subProperty' given there is one, nullptr otherwise.

◆ process()

virtual void inviwo::SequenceProcessor::process ( )
overridevirtual

Evaluate the sub network for each item in the input sequence.

Reimplemented from inviwo::Processor.

◆ propagateEvent()

virtual void inviwo::SequenceProcessor::propagateEvent ( Event * event,
Outport * source )
overridevirtual

Propagate events for the current sequence item through the sub network using the sink and source processors.

Reimplemented from inviwo::Processor.

◆ removeSuperProperty()

void inviwo::SequenceProcessor::removeSuperProperty ( Property * subProperty)

Remove the super property for sub property 'subProperty'.

◆ saveSubNetwork()

void inviwo::SequenceProcessor::saveSubNetwork ( const std::filesystem::path & file)

Save the current sub network into the sequence composites folder of the user settings dir. The current display name will be used as filename. Saved networks will automatically appear as Processors in the processor list with the same display name.

◆ serialize()

virtual void inviwo::SequenceProcessor::serialize ( Serializer & s) const
overridevirtual

Reimplemented from inviwo::Processor.


The documentation for this class was generated from the following file:
  • include/inviwo/core/processors/sequenceprocessor.h