13#ifndef ML_GRAPH_ANALYSER_H
14#define ML_GRAPH_ANALYSER_H
30#ifndef VESSELGRAPH_USE_MPIF
85#ifndef VESSELGRAPH_USE_MPIF
119 this->_fValue =
oIF._fValue;
301 std::vector<VesselEdge*>*
pvEdges,
314 std::vector<VesselEdge*>*
pvEdges,
348#ifndef VESSELGRAPH_USE_MPIF
355 sumupST_Value(&VesselNode::getDrainVolume, &VesselNode::setDrainVolume,
bIgnoreOrientation);
426 std::vector<PathInfo>::iterator
iPathEnd);
460 (this->*_actMeasure)(
pEdge);
550 _actComperator = &compareEdges::compareLength;
553 _actComperator = &compareEdges::compareVolume;
556 _actComperator = &compareEdges::compareSTVolume;
559 _actComperator = &compareEdges::compareSTCenterX;
562 _actComperator = &compareEdges::compareSTCenterY;
565 _actComperator = &compareEdges::compareSTCenterZ;
568 _actComperator = &compareEdges::compareSTCenterPlane;
572 _actComperator = &compareEdges::compareLabel;
579 return (this->*_actComperator)(
pE1,
pE2);
585 Vector3 _planeNormal;
589 return pE1->getLabel() >
pE2->getLabel();
593 return pE1->getLength() >
pE2->getLength();
597 return pE1->getVolume() >
pE2->getVolume();
601 return pE1->getSTVolume() >
pE2->getSTVolume();
605 return (
pE1->getSTBarycenter())[0] > (
pE2->getSTBarycenter())[0];
609 return (
pE1->getSTBarycenter())[1] > (
pE2->getSTBarycenter())[1];
613 return (
pE1->getSTBarycenter())[2] > (
pE2->getSTBarycenter())[2];
617 return (
pE1->getSTBarycenter() -
pE2->getSTBarycenter()).
dot(_planeNormal) > 0;
644 if (_pData !=
nullptr) {
648 _actMeasure = &NodeAnalyser::suggestRoot;
652 _actMeasure = &NodeAnalyser::doNothing;
655#ifndef VESSELGRAPH_USE_MPIF
657 if (_pData !=
nullptr) {
659 _actMeasure = &NodeAnalyser::setClusterLabel;
663 _actMeasure = &NodeAnalyser::doNothing;
668 _actMeasure = &NodeAnalyser::doNothing;
681 (this->*_actMeasure)(
pNode);
698#ifndef VESSELGRAPH_USE_MPIF
737 ProcessFkt oProcess = &measureSkeletonAgent::doNothing;
738 void* pResult =
nullptr;
742 friend class Process;
745 typedef std::map<NProcessMode, Process>::iterator IProcess;
759 _MProcess.erase(_MProcess.begin(), _MProcess.end());
761 if (_pData !=
nullptr) {
766 _pScale =
static_cast<Vector3*
>((*_pData)[
DATA_SCL]);
767 oProcess.oProcess = &measureSkeletonAgent::ProcessL1Scale;
770 oProcess.oProcess = &measureSkeletonAgent::ProcessL1;
778 oProcess.oProcess = &measureSkeletonAgent::ProcessV1;
785 oProcess.oProcess = &measureSkeletonAgent::ProcessP1;
792 oProcess.oProcess = &measureSkeletonAgent::ProcessD1;
857 std::map<NProcessMode, Process> _MProcess;
864 std::list<Vector3> _LPoints;
866 std::list<Vector3>::iterator IBack;
868 std::list<Vector3>::iterator IMiddle;
870 std::list<Vector3>::iterator IFront;
EdgeAnalyser(long NMode, DataMap *pData=nullptr)
constructor: connect operator() to the requested functionality
void operator()(VesselEdge *pEdge)
VesselNode * suggestRoot(float fSignificanceLevel=0.7f, int nPreferedDirection=0)
Search for root-node: look for leaf with thick edge seated remote from the barycenter of the Graph.
VesselNode * getParent(VesselEdge *pE1, VesselEdge *pE2)
void tansferLabelsInverse(void)
transfer skeleton labels to vessel edge label (take label of most frequent skeleton)
void searchSubTreeSeparation(VesselNode *pRoot, const Vector3 &separationDirection, std::vector< VesselEdge * > &vClassifiedEdges)
Vector3 measureBarycenter()
Get barycenter position of all the Graph.
void measureSkeletonArea(int nAvLength=5)
measure floating average of SkeletonArea and set area property
void measureST_Volume(bool bIgnoreOrientation=false)
Get the euclidean volume of all graph edges connected with given root, nodes cumulate them according ...
void sumupST_Value(VesselNode::NodeGetFkt getFkt, VesselNode::NodeSetFkt setFkt, bool bIgnoreOrientation=false)
bool calcPositionFromNodeBase(std::vector< CIdxFloat > vBase, Vector3 *pvResult)
Calculate spatial vector position form relative node coordinates.
bool calcDistanceMatrix(MatrixTemplate< double > &dm, std::vector< int > &vId, int nMaxNodes)
Calculate Distance Matrix for rooted Graph, taking hierarchy into account: dm(n1, n2) := minimal dist...
void searchMaxSubTrees(std::vector< VesselEdge * > vStartEdges, unsigned int nNum, std::vector< VesselEdge * > *pvMaxEdges, float *pfActValue, float *pfActSum)
calculate set of edges representing nNum subtrees maximizing selected feature stored in label propert...
void searchMaxSubTrees(std::vector< VesselEdge * >::iterator iBegin, std::vector< VesselEdge * >::iterator iEnd, int nNum, std::vector< VesselEdge * > *pvMaxEdges, float *pfActValue, float *pfActSum)
calculate set of edges representing nNum subtrees maximizing selected feature stored in label propert...
void collectLeafs(VesselNode *pRoot, std::vector< VesselNode * > &pLeafs)
Collect all leafs which are children of node pRoot and append them to pLeafs.
double calcSpannedVolume(const std::vector< int > &vId)
Calculate Volume of minimal cube including all supplied nodes.
void measureVolume()
Get the euclidean volume of all graph edges and set edge 'Volume' property in the Graph.
void sumupST_DrainVolume(bool bIgnoreOrientation=false)
cumulate DrainVolumes given at the leafs
void searchMaxSubTrees(std::vector< VesselEdge * > vStartEdges, int nPos, unsigned int nNum, std::vector< VesselEdge * > *pvMaxEdges, float *pfActValue, float *pfActSum)
calculate set of edges representing nNum subtrees maximizing selected feature stored in label propert...
float measureAvMinDistance()
Get the average minimal distance over all skeletons of an edge and set edge 'averageMinDistance' prop...
short sampleConnectedCluster()
identify connected subgraph return value is number of identified cluster
void tansferLabels(Skeleton::LABELTYPE NType, float fThresh=0.1f)
transfer Vessel-Edge labels to Skeleton
GraphAnalyser(Graph *pGraph)
constructor: provide pointer pGraph for easy access to Graph object
void measureLength()
Get the euclidean length of all graph edges and set edge 'Length' property in the Graph.
bool calcNodeBaseFromPosition(const Vector3 &vPosition, const std::vector< int > &vId, std::vector< CIdxFloat > *pvResult)
Calculate representation of spatial position in node coordinates.
void measureST_Barycenter(bool bIgnoreOrientation=false)
Get the euclidean volume of all graph edges connected with given root, nodes cumulate them according ...
void searchST_MajorBifurcation(VesselEdge *pStartEdge, float fMinorLimitStart, float fMinorLimitStep, int nMinorLimitNumber, std::vector< VesselEdge * > *pvEdges, bool bClear=true)
search for first major bifurcation following main edge starting with pStartEdge, use label property t...
const VesselNode * getParent(const VesselEdge *pE1, const VesselEdge *pE2) const
void scanSkeletonLabelMinMax(float *min, float *max)
evaluate min/max value of skeleton labels
void measureMaxPathValue(VesselNode *pRootNode, VesselEdge::EdgeGetFkt edgeGetFkt, VesselNode::NodeGetFkt nodeGetFkt, VesselNode::NodeSetFkt nodeSetFkt)
For each node calculate the maximum sum of edge values in a single path below this node.
void searchST_MajorBifurcation(VesselEdge *pStartEdge, float fMinorLimit, std::vector< VesselEdge * > *pvEdges, bool bClear=true)
search for first major bifurcation following main edge starting with pStartEdge, use label property t...
const VesselNode * getParent(const VesselNode *pN1, const VesselNode *pN2) const
get pointer to common parent if exists or NULL
VesselNode * getParent(VesselNode *pN1, VesselNode *pN2)
bool calcNodeClassifikator(CDoubleArray *pArAssoc, std::vector< int > *pvId, int nMaxNodes)
stack Node classificators in (*pArAssoc) (n1,n1): classificators based on single Node n1 respect to g...
Defines the basic Graph class which holds sets of nodes, edges and roots to model tubular structures ...
NodeAnalyser(long NMode, DataMap *pData=nullptr)
constructor: connect operator() to the requested functionality
void operator()(VesselNode *pNode)
Skeleton objects represent centerline voxels stored in a VesselEdge object.
double(VesselEdge::* EdgeGetFkt)(void) const
object bound function pointer: position of function relative to (individual) object base
VesselNode is derived from GraphNode, hence it can be stored as node item in a class Graph object.
void(VesselNode::* NodeSetFkt)(const MLdouble &)
function to set double parameter value
MLdouble(VesselNode::* NodeGetFkt)() const
object bound function pointer: position of function relative to (individual) object base
int operator()(const VesselEdge *pE1, const VesselEdge *pE2) const
compareEdges(CMP_FEATURE NFeature, Vector3 planeNormal=Vector3(0))
constructor: connect operator() to the requested functionality
— Class measureSkeletonAgent
friend class Process
allow functor access to all internal stuff
void operator()(const Skeleton &oSkeleton)
add Skeleton successive
void operator()(Skeleton *oSkeleton)
measureSkeletonAgent(int nMode, DataMap *pData=nullptr)
constructor: connect operator() to start functionality and initialize parameter for accumulation of p...
T dot(const FloatingPointVector< T, size, DataContainer > &buffer) const
Returns the dot product, i.e., sum of all components multiplied with corresponding components of buff...
std::map< NData, void * > DataMap
NProcessMode
Flags for processing instructions and control of used functionalty.
NData
data structure for passing informations down the processing pipe
@ OUTDATA_GLOBAL_MIN_DIST
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
#define VESSELGRAPH_END_NAMESPACE
#define VESSELGRAPH_EXPORT
Definiert systemspezifische Macros, die f"ur diese DLL gelten sollen.
#define VESSELGRAPH_BEGIN_NAMESPACE
Tvec3< MLdouble > Vector3
A vector with three components of type double.
CIdxFloat(const CIdxFloat &oIF)
CIdxFloat(int nIdx=0, float fValue=0.0)
bool operator<(const CIdxFloat &oIF) const
bool operator>(const CIdxFloat &oIF) const
supply comparison operator to induce an order for assistance of non-abiguous sequences
CIdxFloat & operator=(const CIdxFloat &oIF)
bool operator==(const CIdxFloat &oIF) const
bool operator<(const CIdxIdx &oII) const
supply comparison operator to induce an order for assistance of non-abiguous sequences
CIdxIdx(const CIdxIdx &oII)
CIdxIdx & operator=(const CIdxIdx &oII)
bool operator==(const CIdxIdx &oII) const