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);}
444 void measure_avSkeletonArea(
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); }
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);}
614 #ifndef VESSELGRAPH_USE_MPIF
652 ProcessFkt oProcess = &measureSkeletonAgent::doNothing;
653 void *pResult =
nullptr;
660 typedef std::map<NProcessMode, Process>::iterator IProcess;
676 _MProcess.erase(_MProcess.begin(), _MProcess.end());
678 if(_pData !=
nullptr){
685 oProcess.oProcess = &measureSkeletonAgent::ProcessL1Scale;
688 oProcess.oProcess =&measureSkeletonAgent::ProcessL1;
697 oProcess.oProcess = &measureSkeletonAgent::ProcessV1;
705 oProcess.oProcess = &measureSkeletonAgent::ProcessP1;
713 oProcess.oProcess = &measureSkeletonAgent::ProcessD1;
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));
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)
constructor: connect operator() to the requested functionality
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.
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.
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...
VesselNode * getParent(VesselNode *pN1, VesselNode *pN2)
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...
const VesselNode * getParent(const VesselNode *pN1, const VesselNode *pN2) const
get pointer to common parent if exists or NULL
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 ...
const VesselNode * getParent(const VesselEdge *pE1, const VesselEdge *pE2) const
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...
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...
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
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
measureSkeletonAgent(int nMode, DataMap *pData=nullptr)
constructor: connect operator() to start functionality and initialize parameter for accumulation of p...
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
#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 3 components of type double.
std::vector< CDouble2Vec > CDoubleArray
CIdxFloat(const CIdxFloat &oIF)
CIdxFloat(int nIdx=0, float fValue=0.0)
CIdxFloat & operator=(const CIdxFloat &oIF)
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
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