MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00004 00009 //---------------------------------------------------------------------------------- 00010 00011 #ifndef __CSOLiveWireGraph_H 00012 #define __CSOLiveWireGraph_H 00013 00014 #include "MLCSOSystem.h" 00015 00016 #include "CSOLiveWireNode.h" 00017 #include "CSOObjectHeap.h" 00018 00019 00020 ML_START_NAMESPACE 00021 00022 00024 00026 class MLCSO_EXPORT CSOLiveWireGraph 00027 { 00028 00029 public: 00030 00032 CSOLiveWireGraph(); 00034 CSOLiveWireGraph(float* imageData, unsigned int sizex, unsigned int sizey, const bool useCostsDirectly, float voxelSizeX=1.0f, float voxelSizeY=1.0f); 00035 00037 ~CSOLiveWireGraph(); 00038 00040 void setStartPosition(VoxelPos startVoxelPos); 00041 00043 void setWeights(float weightGradient, float weightLaplace, float weightDirection); 00044 00046 void setLengthPenalty(float lengthPenalty) 00047 { 00048 _lengthPenalty = lengthPenalty; 00049 } 00050 00052 inline void setPathCostThreshold(bool useThreshold, float threshold) { _usePathCostThreshold = useThreshold; _pathConstThreshold = threshold; } 00053 00058 void getShortestPathToStart(VoxelPos endPos, std::vector<VoxelPos>& intermediatePositions, int neighborhoodMode, bool reverse=true); 00059 00061 void resetGraphAndHeap(); 00062 00064 void setMaxPathLength(float maxLength) 00065 { 00066 _maxPathLength = maxLength; 00067 } 00068 00070 void updateResultCosts(); 00071 00073 enum CSOLiveWireNeighborhoodMode 00074 { 00075 CSO_LIVE_WIRE_4_NEIGHBORHOOD = 0, 00076 CSO_LIVE_WIRE_8_NEIGHBORHOOD = 1 00077 }; 00078 00079 protected: 00080 00081 00082 /* MEMBER VARIABLES */ 00083 00085 std::vector< VoxelPos > _lastPathPositions; 00086 00088 unsigned int _imageSizeX; 00090 unsigned int _imageSizeY; 00092 float _voxelSizeX; 00094 float _voxelSizeY; 00096 CSOLiveWireNode** _lwGraph; 00097 00099 CSOObjectHeap<CSOLiveWireNode>* _nodeHeap; 00100 00102 VoxelPos _startVoxelPos; 00103 00105 int _offsetX[8]; 00107 int _offsetY[8]; 00108 00110 float _maxGlobalGradient; 00112 float _weightGradient, _weightLaplace, _weightDirection; 00114 float _lengthPenalty; 00115 00117 bool _usePathCostThreshold; 00120 float _pathConstThreshold; 00121 00123 bool _useCostsDirectly; 00124 00126 float _maxPathLength; 00127 00129 float _directionLengths[8]; 00130 00131 /* DATA STRUCTURES */ 00132 00133 /* METHODS */ 00134 00136 void _computeCosts(); 00137 00139 float _getEdgeCosts(unsigned char direction, int posx, int posy); 00140 00142 void _computeAdditionalCostsAndNormalizeValues(); 00143 00145 void _normalizeValues(); 00146 }; 00147 00149 00150 00151 ML_END_NAMESPACE 00152 00153 #endif // __CSOLiveWireGraph_H 00154 00155 00156