13#ifndef ML_GRAPH_ANALYSER_H
14#define ML_GRAPH_ANALYSER_H
30#ifndef VESSELGRAPH_USE_MPIF
88#ifndef VESSELGRAPH_USE_MPIF
198 bool bIgnoreOrientation=
false
208 std::vector<VesselEdge *>::iterator iEnd,
210 std::vector<VesselEdge *> * pvMaxEdges,
219 std::vector<VesselEdge *> * pvMaxEdges,
224 searchMaxSubTrees(vStartEdges.begin(), vStartEdges.end(),
static_cast<int>(nNum), pvMaxEdges, pfActValue, pfActSum);
232 std::vector<VesselEdge *> * pvMaxEdges,
237 searchMaxSubTrees(vStartEdges.begin()+nPos, vStartEdges.begin()+nPos+1,
static_cast<int>(nNum), pvMaxEdges, pfActValue, pfActSum);
250 std::vector<VesselEdge *> *pvEdges,
259 float fMinorLimitStart,
260 float fMinorLimitStep,
261 int nMinorLimitNumber,
262 std::vector<VesselEdge *> *pvEdges,
297#ifndef VESSELGRAPH_USE_MPIF
303 {
sumupST_Value (&VesselNode::getDrainVolume, &VesselNode::setDrainVolume, bIgnoreOrientation); }
371 void calcRootPath(
int nParentStart,
int nParentEnd,
int * pFreeIdx, std::vector<PathInfo>::iterator iPathBase, std::vector<PathInfo>::iterator iPathEnd);
409 inline void operator() (
VesselEdge *pEdge){(this->*_actMeasure)(pEdge);}
423 void measureLength (VesselEdge *pEdge);
427 void measureVolume (VesselEdge *pEdge);
430 void measurePosition (VesselEdge *pEdge);
433 void averageMinDistance (VesselEdge *pEdge);
437 void measureST_Volume(VesselEdge *pEdge);
441 void measureST_Barycenter(VesselEdge *pEdge);
444 void measure_avSkeletonArea(VesselEdge *pEdge);
449 void sumupST_NodeValue(VesselEdge *pEdge);
458 void (EdgeAnalyser::*_actMeasure) (VesselEdge *pEdge);
493 _planeNormal = planeNormal;
496 _actComperator = &compareEdges::compareLength;
499 _actComperator = &compareEdges::compareVolume;
502 _actComperator = &compareEdges::compareSTVolume;
505 _actComperator = &compareEdges::compareSTCenterX;
508 _actComperator = &compareEdges::compareSTCenterY;
511 _actComperator = &compareEdges::compareSTCenterZ;
514 _actComperator = &compareEdges::compareSTCenterPlane;
518 _actComperator = &compareEdges::compareLabel;
524 {
return (this->*_actComperator)(pE1, pE2); }
529 Vector3 _planeNormal;
531 int compareLabel (
const VesselEdge *pE1,
const VesselEdge *pE2)
const {
return pE1->getLabel() > pE2->getLabel(); }
532 int compareLength (
const VesselEdge *pE1,
const VesselEdge *pE2)
const {
return pE1->getLength() > pE2->getLength(); }
533 int compareVolume (
const VesselEdge *pE1,
const VesselEdge *pE2)
const {
return pE1->getVolume() > pE2->getVolume(); }
534 int compareSTVolume (
const VesselEdge *pE1,
const VesselEdge *pE2)
const {
return pE1->getSTVolume() > pE2->getSTVolume(); }
535 int compareSTCenterX (
const VesselEdge *pE1,
const VesselEdge *pE2)
const {
return (pE1->getSTBarycenter())[0] > (pE2->getSTBarycenter())[0]; }
536 int compareSTCenterY (
const VesselEdge *pE1,
const VesselEdge *pE2)
const {
return (pE1->getSTBarycenter())[1] > (pE2->getSTBarycenter())[1]; }
537 int compareSTCenterZ (
const VesselEdge *pE1,
const VesselEdge *pE2)
const {
return (pE1->getSTBarycenter())[2] > (pE2->getSTBarycenter())[2]; }
538 int compareSTCenterPlane (
const VesselEdge *pE1,
const VesselEdge *pE2)
const {
return (pE1->getSTBarycenter()-pE2->getSTBarycenter()).dot(_planeNormal) > 0; }
566 if(_pData !=
nullptr){
568 *(
reinterpret_cast<long *
>((*pData)[
OUTDATA_ROOT])) = 0;
570 _actMeasure = &NodeAnalyser::suggestRoot;
573 _actMeasure = &NodeAnalyser::doNothing;
576#ifndef VESSELGRAPH_USE_MPIF
578 if(_pData !=
nullptr){
580 _actMeasure = &NodeAnalyser::setClusterLabel;
583 _actMeasure = &NodeAnalyser::doNothing;
588 _actMeasure = &NodeAnalyser::doNothing;
599 inline void operator() (
VesselNode *pNode){(this->*_actMeasure)(pNode);}
612 void suggestRoot (VesselNode *pNode);
614#ifndef VESSELGRAPH_USE_MPIF
616 void setClusterLabel (VesselNode *pNode);
625 void (NodeAnalyser::*_actMeasure) (VesselNode *pNode);
652 ProcessFkt oProcess = &measureSkeletonAgent::doNothing;
653 void *pResult =
nullptr;
657 friend class Process;
660 typedef std::map<NProcessMode, Process>::iterator IProcess;
676 _MProcess.erase(_MProcess.begin(), _MProcess.end());
678 if(_pData !=
nullptr){
679 if(nMode & PROC_LENGTH)
682 oProcess.pResult = (*_pData)[OUTDATA_LENGTH];
683 if(nMode & PROC_SCL){
684 _pScale = static_cast<Vector3 *>((*_pData)[DATA_SCL]);
685 oProcess.oProcess = &measureSkeletonAgent::ProcessL1Scale;
688 oProcess.oProcess =&measureSkeletonAgent::ProcessL1;
690 _MProcess[PROC_LENGTH] = oProcess;
696 oProcess.pResult = (*_pData)[OUTDATA_VOLUME];
697 oProcess.oProcess = &measureSkeletonAgent::ProcessV1;
698 _MProcess[PROC_VOLUME] = oProcess;
704 oProcess.pResult = (*_pData)[OUTDATA_POS];
705 oProcess.oProcess = &measureSkeletonAgent::ProcessP1;
706 _MProcess[PROC_WEIGHTED_POS] = oProcess;
712 oProcess.pResult = (*_pData)[OUTDATA_AV_MIN_DIST];
713 oProcess.oProcess = &measureSkeletonAgent::ProcessD1;
714 _MProcess[PROC_AV_MIN_DIST] = oProcess;
726 inline void operator() (
const Skeleton & oSkeleton)
728 for(IProcess iProcess = _MProcess.begin(); iProcess != _MProcess.end(); ++iProcess){
729 (this->*((iProcess->second).oProcess))(oSkeleton, &(iProcess->second));
734 for(IProcess iProcess = _MProcess.begin(); iProcess != _MProcess.end(); ++iProcess){
735 (this->*((iProcess->second).oProcess))(*oSkeleton, &(iProcess->second));
749 void doNothing (
const Skeleton & , Process * ) {}
753 void ProcessL1 (
const Skeleton & oSkeleton, Process * pProcess);
754 void ProcessL1Scale (
const Skeleton & oSkeleton, Process * pProcess);
756 void ProcessL2 (
const Skeleton & oSkeleton, Process * pProcess);
757 void ProcessL2Scale (
const Skeleton & oSkeleton, Process * pProcess);
759 void ProcessL3 (
const Skeleton & oSkeleton, Process * pProcess);
760 void ProcessL3Scale (
const Skeleton & oSkeleton, Process * pProcess);
763 void ProcessV1 (
const Skeleton & oSkeleton, Process * pProcess);
766 void ProcessP1 (
const Skeleton & oSkeleton, Process * pProcess);
769 void ProcessD1 (
const Skeleton & oSkeleton, Process * pProcess);
779 std::map<NProcessMode, Process> _MProcess;
786 std::list<Vector3> _LPoints;
788 std::list<Vector3>::iterator IBack;
790 std::list<Vector3>::iterator IMiddle;
792 std::list<Vector3>::iterator IFront;
EdgeAnalyser(long NMode, DataMap *pData=nullptr)
VesselNode * suggestRoot(float fSignificanceLevel=0.7f, int nPreferedDirection=0)
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)
void sumupST_Value(VesselNode::NodeGetFkt getFkt, VesselNode::NodeSetFkt setFkt, bool bIgnoreOrientation=false)
bool calcPositionFromNodeBase(std::vector< CIdxFloat > vBase, Vector3 *pvResult)
bool calcDistanceMatrix(MatrixTemplate< double > &dm, std::vector< int > &vId, int nMaxNodes)
void searchMaxSubTrees(std::vector< VesselEdge * > vStartEdges, unsigned int nNum, std::vector< VesselEdge * > *pvMaxEdges, float *pfActValue, float *pfActSum)
void searchMaxSubTrees(std::vector< VesselEdge * >::iterator iBegin, std::vector< VesselEdge * >::iterator iEnd, int nNum, std::vector< VesselEdge * > *pvMaxEdges, float *pfActValue, float *pfActSum)
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 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)
float measureAvMinDistance()
short sampleConnectedCluster()
void tansferLabels(Skeleton::LABELTYPE NType, float fThresh=0.1f)
transfer Vessel-Edge labels to Skeleton
GraphAnalyser(Graph *pGraph)
bool calcNodeBaseFromPosition(const Vector3 &vPosition, const std::vector< int > &vId, std::vector< CIdxFloat > *pvResult)
void measureST_Barycenter(bool bIgnoreOrientation=false)
void searchST_MajorBifurcation(VesselEdge *pStartEdge, float fMinorLimitStart, float fMinorLimitStep, int nMinorLimitNumber, std::vector< VesselEdge * > *pvEdges, bool bClear=true)
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)
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)
Defines the basic Graph class which holds sets of nodes, edges and roots to model tubular structures ...
NodeAnalyser(long NMode, DataMap *pData=nullptr)
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))
measureSkeletonAgent(int nMode, DataMap *pData=nullptr)
std::map< NData, void * > DataMap
@ OUTDATA_GLOBAL_MIN_DIST
#define VESSELGRAPH_END_NAMESPACE
#define VESSELGRAPH_EXPORT
#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