MeVisLab Scripting Reference
MLGraphWrapper Class Reference

#include <mlGraphWrapper.h>

Inherits QObject.

Public Slots

size_t numNodes ()
 
size_t numEdges ()
 
size_t numRoots ()
 
MLVesselNodeWrappergetIdNode (qint64 id)
 
MLVesselEdgeWrappergetIdEdge (qint64 id)
 
MLVesselNodeWrappergetNode (QVariantList pos)
 
MLVesselEdgeWrappergetEdge (QVariantList pos)
 
QVariantList getEdges ()
 
QVariantList getNodes ()
 
QVariantList getRoots ()
 
void addGraph (MLGraphWrapper *graph)
 
MLVesselNodeWrappercreateNode (QList< double > pos, qint64 useId=-1)
 
MLVesselEdgeWrappercreateEdge (qint64 predNodeId, qint64 succNodeId, qint64 useId=-1, bool createSkeletons=true)
 
void removeEdge (qint64 edgeId)
 
MLVesselEdgeWrappersplitEdge (qint64 edgeId, size_t skeletonIndex)
 
void resampleEdges (double resolution)
 
void insertRoot (MLVesselNodeWrapper *node)
 
void removeRoot (MLVesselNodeWrapper *node)
 
void smooth (int numSmoothingPasses, double smoothingFactor)
 
void directGraph (double floodThreshold=0.0)
 
void stripCycles ()
 
void removeValency2Nodes ()
 
void transform (QVariantList matrix4)
 
QVariantList shortestPath (MLVesselNodeWrapper *startNode, MLVesselNodeWrapper *endNode)
 
QVariantList shortestPath (QVariantList fromPos, QVariantList toPos)
 
QVariant getImageExtent ()
 
QVariant getVoxelToWorldMatrix ()
 
void setImageExtent (QVariantList extent)
 
void setVoxelSize (QVariantList size)
 
void setVoxelToWorldMatrix (QVariantList matrix4)
 
void clampToImage ()
 
bool getUseBinaryPersistence ()
 
void useBinaryPersistence (bool use)
 
QByteArray toBinaryData () const
 
void fromBinaryData (const QByteArray &data)
 

Properties

QVariantList edges
 
QVariantList nodes
 
QVariantList roots
 

Detailed Description

A class that wraps Graph objects for use in Scripting.

Member Function Documentation

◆ addGraph

void MLGraphWrapper::addGraph ( MLGraphWrapper * graph)
slot

Add an entire graph to the current graph.

◆ clampToImage

void MLGraphWrapper::clampToImage ( )
slot

Clamp graph to image boundary as specified by image extent and voxel-to-world matrix.

◆ createEdge

MLVesselEdgeWrapper * MLGraphWrapper::createEdge ( qint64 predNodeId,
qint64 succNodeId,
qint64 useId = -1,
bool createSkeletons = true )
slot

Create a VesselEdge with unique id, add it to the Nodes identified by the respective IDs and return a pointer to it.

By default line skeletons will be created on the edge. Can be deactivated by setting createSkeletons to false.

◆ createNode

MLVesselNodeWrapper * MLGraphWrapper::createNode ( QList< double > pos,
qint64 useId = -1 )
slot

Create a VesselNode with unique id, add it to the Graph and return a pointer to it.

◆ directGraph

void MLGraphWrapper::directGraph ( double floodThreshold = 0.0)
slot

Directs the graph from root to leaves anew.

This is done following the weights of the edges downwards.

◆ fromBinaryData

void MLGraphWrapper::fromBinaryData ( const QByteArray & data)
slot

Reconstructs the graph using the binary data.

◆ getEdge

MLVesselEdgeWrapper * MLGraphWrapper::getEdge ( QVariantList pos)
slot

Get the edge with minimal distance to pos. Uses method distance() of edge classes.

◆ getEdges

QVariantList MLGraphWrapper::getEdges ( )
slot

Get all the edges of the graph as MLVesselEdgeWrapper.

◆ getIdEdge

MLVesselEdgeWrapper * MLGraphWrapper::getIdEdge ( qint64 id)
slot

Get an edge by id.

◆ getIdNode

MLVesselNodeWrapper * MLGraphWrapper::getIdNode ( qint64 id)
slot

Get a node by id.

◆ getImageExtent

QVariant MLGraphWrapper::getImageExtent ( )
slot

Image extent of the image the graph is compiled from.

◆ getNode

MLVesselNodeWrapper * MLGraphWrapper::getNode ( QVariantList pos)
slot

Get the node with minimal distance to pos. Uses method distance() of node classes.

◆ getNodes

QVariantList MLGraphWrapper::getNodes ( )
slot

Get all the nodes of the graph as MLVesselNodeWrapper.

◆ getRoots

QVariantList MLGraphWrapper::getRoots ( )
slot

Get all the root nodes of the graph as MLVesselNodeWrapper.

◆ getUseBinaryPersistence

bool MLGraphWrapper::getUseBinaryPersistence ( )
inlineslot

Returns whether the graph uses binary persistence.

◆ getVoxelToWorldMatrix

QVariant MLGraphWrapper::getVoxelToWorldMatrix ( )
slot

Voxel-to-world matrix (4x4) of the image the graph is compiled from.

◆ insertRoot

void MLGraphWrapper::insertRoot ( MLVesselNodeWrapper * node)
slot

Insert a node to the list of root nodes.

◆ numEdges

size_t MLGraphWrapper::numEdges ( )
inlineslot

Get the number of nodes.

◆ numNodes

size_t MLGraphWrapper::numNodes ( )
inlineslot

Get the number of edges.

◆ numRoots

size_t MLGraphWrapper::numRoots ( )
inlineslot

Get the number of root nodes.

◆ removeEdge

void MLGraphWrapper::removeEdge ( qint64 edgeId)
slot

Remove an edge with the given edgeId from the graph.

◆ removeRoot

void MLGraphWrapper::removeRoot ( MLVesselNodeWrapper * node)
slot

Remove a root from the graph.

◆ removeValency2Nodes

void MLGraphWrapper::removeValency2Nodes ( )
slot

Removes all nodes which are connected to exactly two different edges by mergine those two edges.

If necessary, edges will be flipped before the node is removed.

◆ resampleEdges

void MLGraphWrapper::resampleEdges ( double resolution)
slot

Create skeletons with a given resolution for all edges.

◆ setImageExtent

void MLGraphWrapper::setImageExtent ( QVariantList extent)
slot

Set new image extent.

◆ setVoxelSize

void MLGraphWrapper::setVoxelSize ( QVariantList size)
slot

Set new voxel size.

◆ setVoxelToWorldMatrix

void MLGraphWrapper::setVoxelToWorldMatrix ( QVariantList matrix4)
slot

Set new voxel-to-world matrix (4x4).

◆ shortestPath [1/2]

QVariantList MLGraphWrapper::shortestPath ( MLVesselNodeWrapper * startNode,
MLVesselNodeWrapper * endNode )
slot

Finds the shortest path in graph between startNode and endNode; since the graph is internally handled as undirected graph, the order of start and end node has no influence.

◆ shortestPath [2/2]

QVariantList MLGraphWrapper::shortestPath ( QVariantList fromPos,
QVariantList toPos )
slot

Same as above, but with nodes that are nearest to the given positions.

◆ smooth

void MLGraphWrapper::smooth ( int numSmoothingPasses,
double smoothingFactor )
slot

Smooth the graph.

◆ splitEdge

MLVesselEdgeWrapper * MLGraphWrapper::splitEdge ( qint64 edgeId,
size_t skeletonIndex )
slot

Splits edge with id edgeID at skeleton index skeletonIndex and returns the ID of the additionally created edge.

If the edge could not be split (e.g. edgeID not found, no vessel edge or not enough skeletons), -1 is returned.

◆ stripCycles

void MLGraphWrapper::stripCycles ( )
slot

Strip cyclic edges from the graph First the graph is directed.

Than, all cyclic edges are removed to build a graph without cycles.

◆ toBinaryData

QByteArray MLGraphWrapper::toBinaryData ( ) const
slot

Returns string containing binary representation of all data necessary to reconstruct the graph.

◆ transform

void MLGraphWrapper::transform ( QVariantList matrix4)
slot

Transform node and edge positions by the given 4x4 matrix.

◆ useBinaryPersistence

void MLGraphWrapper::useBinaryPersistence ( bool use)
inlineslot

Sets whether the graph should use binary persistence.

Note
Binary persistence uses Boost serialization, which from time to time is updated in an incompatible way (can load files from older Boost versions, but not newer), so older MeVisLab versions may not be able to load graph files generated by newer MeVisLab versions if utilizing binary persistence.

Property Documentation

◆ edges

QVariantList MLGraphWrapper::edges
read

Get all the edges of the graph as MLVesselEdgeWrapper (read-only).

◆ nodes

QVariantList MLGraphWrapper::nodes
read

Get all the nodes of the graph as MLVesselNodeWrapper (read-only).

◆ roots

QVariantList MLGraphWrapper::roots
read

Get all the root nodes of the graph as MLVesselNodeWrapper (read-only).