Protected Member Functions | |
void | recalculate (GraphNode *node) |
Run the operation of succeeding GraphNodes up to the last node with ROI specified. More... | |
void | interruptRecalculate () |
bool | tryEnable (GraphNode *node) |
Try to enable the operation and all following operations. More... | |
void | confirmOperation (GraphNode *node) |
Confirm that the operation should taken as final. More... | |
boost::shared_ptr< UpdateInfo > | addROI (GraphNode *node, UpdateInfo ROI) |
Add ROI. More... | |
boost::shared_ptr< UpdateInfo > | addROI (GraphNode *node, ROIinfo ROI) |
boost::shared_ptr< UpdateInfo > | addROI (GraphNode *node, unsigned int x, unsigned int y, unsigned int sizeX, unsigned int sizeY, const int mipmapLevel=0) |
vector< boost::shared_ptr < UpdateInfo > >::iterator | deleteROI (boost::shared_ptr< UpdateInfo > ROI) |
Delete specified ROI from all nodes. More... | |
void | recalculate_impl (GraphNode *node) |
The recalculate() implementation. More... | |
void | checkFormat (ImageOperationDescriptor *operation, vector< GraphNode * > &parents, vector< GraphNode * > &children) |
Check whether the operation supports the input/output formats. More... | |
void | createCache (vector< GraphNode * > &parents, GraphNode *node, bool allocateTiles=true) |
Add a cache to the node. More... | |
void | removeNode (vector< GraphNode * > &vect, GraphNode *node) |
Remove the node from the vector. More... | |
void | topologicalSort (GraphNode *node, std::list< GraphNode * > &sorted) |
Topological sort. More... | |
void | topologicalSort_impl (GraphNode *node, std::list< GraphNode * > &sorted) |
void | updateParentsCache (GraphNode *node) |
Update the cache of the preceding nodes. More... | |
void | updateChildrenBuffer (GraphNode *node) |
Update a buffer of all children if necessary. More... | |
void | cleanupVisited (GraphNode *node) |
Cleans the visited flag of all GraphNodes. | |
void | addROI_impl (GraphNode *node, boost::shared_ptr< UpdateInfo > ROI) |
void | insertROIForNodes (GraphNode *node, GraphNode *parent, GraphNode *child) |
Insert an UpdateInfo into the newly created GraphNode. More... | |
void | insertROIForNodes (GraphNode *node, vector< GraphNode * > &parents, GraphNode *child) |
Insert an UpdateInfo into the newly created GraphNode. More... | |
void | updateDistance (GraphNode *node) |
Updates distance for all parent nodes until active node is found. | |
double | computeTimeLimit (double a, double b, double distance) |
Compute time limit for the given distance. | |
void | cleanupCache () |
Cleanup caches in graph. More... | |
void | cleanupCache_impl (GraphNode *node, float time) |
void | invalidateChildrenStamp (GraphNode *node) |
Invalidate time stamp in node's children. | |
void | disableChildren (GraphNode *node, bool cleanBuffer) |
Invalidate the following operations. More... | |
Protected Attributes | |
vector< GraphNode * > | m_roots |
Vector containting all roots and unconnected operations. | |
unsigned int | m_tileExtent |
tile extent for all buffers managed by the GraphManager. | |
unsigned int | m_nodeIDcounter |
Counter used to initialize nodeID of a newly created GraphNode. | |
std::map< uint64_t, ImageOperationDescriptor * > | m_registeredOperations |
Stores pointers to all registered ImageOperationDescriptors, needed for deserialization. More... | |
boost::thread * | m_recalculateThread |
A worker thread. More... | |
double | m_timingSheer |
double | m_timingCurvature |
Friends | |
class | GraphManager |
class | GraphNode |
|
protected |
Add ROI.
Adds ROI to the node and propagates it down to all preceding nodes.
node | node which initiates the adition of a new ROI |
ROI | desired ROI |
|
protected |
Check whether the operation supports the input/output formats.
Throws CoreException in case the operation doesn't support the given format. NOTE: it might be better to use return values instead
operation | operation to check |
parents | the parent nodes, which should be used as an input |
children | children nodes, ie the destination |
|
protected |
Cleanup caches in graph.
The time limit for given node is computed using the exponential function: y(t) = a ^ time/b where a, b are tunable parameters. The value of has to be higher than 1. The usual values are a = 1.5; b = 1.5
IMPORTANT NOTE: it would be better if the cache creation is minimized at the expense of exceeding time limit settings because the necessary recalculations may take a lot of time.
|
protected |
Confirm that the operation should taken as final.
Called when the operation in the node is supposed to be invariant from now on.
When the operation is confirmed the caches in a graph are restructured to conform to the new state and the GraphNode is marked inactive (GraphNode.m_active = false).
Before confirming the cache is structured like if the node contains the active operation, ie. there is at least one cache in the preceding node.
node | node whose operation shall be confirmed |
|
protected |
Add a cache to the node.
createCache adds buffer which is big enough to handle intersection of all parents buffers to a node.
It doesn't check whether node has a buffer. This means that the createCache should not be called on a node which already has a buffer because it would result in memory leak.
|
protected |
Delete specified ROI from all nodes.
Remove ROI specified by the UpdateInfo from all nodes.
ROI | UpdateInfo to be removed |
|
protected |
Invalidate the following operations.
Invalidates all operation depending on the node. Optionally it is possible to set the buffer of all invalid operations to zero until an operation with cache is encountered. In other words, all children operations are invalidated, but only the ones which share buffer with the node has buffer set to zero.
|
protected |
Insert an UpdateInfo into the newly created GraphNode.
When a new GraphNode is inserted between the child and the parent it is necessary to insert new UpdateInfos into the node which properly connects child with parent.
insertROIForNodes() does this creation of UpdateInfo and relinking.
node | inserted node where the new UpdateInfo should be inserted |
parent | parent of the node |
child | child of the node |
|
protected |
Insert an UpdateInfo into the newly created GraphNode.
When a new GraphNode is inserted between the child and the parents it is necessary to insert new UpdateInfos into the node which properly connects child with its parents.
insertROIForNodes() does this creation of UpdateInfo and relinking.
node | inserted node where the new UpdateInfo should be inserted |
parent | list of parents of the node |
child | child of the node |
|
protected |
Run the operation of succeeding GraphNodes up to the last node with ROI specified.
node | the node where the recalculation starts |
|
protected |
The recalculate() implementation.
This function is run by the thread created in the recalculate().
|
protected |
Remove the node from the vector.
Removes the node from the vector WITHOUT freeing the it's memory.
vect | vector from which the node should be removed |
node | node to remove |
|
protected |
Topological sort.
node | start node |
sorted | list where the sorted operations will be stored |
|
protected |
Try to enable the operation and all following operations.
This function tries to enable the operation and all following operations. This involves adding the necessary ROI and a creation of buffers.
node | node that we are trying to enable |
|
protected |
Update a buffer of all children if necessary.
Recursively traverse all children and set their buffer to a buffer of the calling node in case they do not contain cache.
The traversal stops when children with cache is found.
node | the from which the graph traversal starts. Also its buffer is used as the buffer in children which do not contain cache |
|
protected |
Update the cache of the preceding nodes.
When the updateParentsCache() is called the graph is traversed back to find a node which contains the cache and then runs the operations up to the node.
This is usefull when the cache is shared between several nodes and thus the cache content can contain the results of the latest operation in a chain of nodes.
For an example see the following graph.
"node 1" is a node with a cache which is shared with the "node 2", "node 3" and "node 4." Because the buffer is shared between these operations it contains the results of the "node 4" operation. If a cache to the "node 3" is added the "node 1" buffer should contain the results of "node 2" and not "node 4." "node 3" buffer should contain the results of "node 4" operation.
|
protected |
A worker thread.
Currently there is only one worker thread which traverses the graph and runs operations. The reason is that it would be difficult to handle race conditions if more threads were allowed.
|
protected |
Stores pointers to all registered ImageOperationDescriptors, needed for deserialization.
It's a map to allow faster searches.