4 * Created on: May 12, 2014
17 #include "airwaysNode.h"
18 #include "Quaternion.h"
19 #include <appli/TempAirwaysAppli/AirwaysLib/AirwaysLib_Export.h>
22 * @brief Airways project namespace
28 * Pair of <Vec3,double> which means the position of the skeleton point
29 * between two nodes (including branch-points) and it radius (obtained from
30 * the Danielsson's distance map algorithm)
32 typedef std::pair<Vec3, double> pair_posVox_rad;
35 * A vector stocking all the points between two nodes
37 typedef std::vector<pair_posVox_rad> vec_pair_posVox_rad;
42 * This class represents an edge in a tree. Particularly, this edge represents the relation from child to father.
43 * This means that the edge source corresponds to the father and the target to the child. This implies that the root
44 * node has a NULL edge.
46 class AirwaysLib_EXPORT Edge
55 * Alternative constructor (copy)
69 * This method returns the angle between two vectors using its parent as
76 * This method returns the Average radius between two branch-points
79 double GetARadius() const;
82 * This method returns the euclidean distance between two branch-points
85 double GetEDistance() const;
88 * This method returns the geodesic distance between two branch-points
91 double GetLength() const;
94 * This method returns the maximum radius between two branch-points
97 double GetMaxRadius() const;
100 * This method returns the minimum radius between two branch-points
103 double GetMinRadius() const;
106 * This method returns the source node of an edge
109 Node* GetSource() const;
112 * This method returns the target node of an edge
115 Node* GetTarget() const;
118 * This method returns the SKPairInfoVector of an edge
121 const vec_pair_posVox_rad& GetEdgeInfo() const;
124 * This method returns true if an edge is marked
127 bool IsMarked() const;
130 * Method that returns if a voxel is influenced by this edge, i.e. if the distance
131 * to the closest voxel of the edge is smaller than the radius on the closest voxel.
132 * @param x,y,z are the voxel positions in coordinates x, y, and z respectively.
133 * @return true is the voxel is influenced, false otherwise
135 bool IsPointInfluencedByEdge(float point_x, float point_y, float point_z) const;
137 //Setters and Modifiers
140 * This method sets the angle between two vectors using its parent
144 void SetAngle(const double& angle);
147 * This method sets the average radius between two nodes
150 void SetARadius(const double& aRadius);
154 * This method sets the Euclidean distance between two nodes
157 void SetEDistance(const double& eDistance);
160 * This method sets the geodesical length between two nodes
163 void SetLength(const double& length);
166 * This method sets the maximum radius between two nodes
169 void SetMaxRadius(const unsigned int& maxRadius);
172 * This method sets the minimum radius between two nodes
175 void SetMinRadius(const unsigned int& minRadius);
178 * This method sets the source node of an edge
181 void SetSource(Node* source);
184 * This method sets the target node of an edge
187 void SetTarget(Node* target);
190 * This method adds a pair <Coordinate, Radius> into skPInfoVector
193 void AddSkeletonPairInfo(const pair_posVox_rad& skPairInfo);
196 * This method sets the skPInfoVector
197 * @param skPInfoVector
199 void SetSkeletonPairVector(const vec_pair_posVox_rad& skPInfoVector);
202 * This method updates all the attributes of an edge using the information
203 * provided from m_skInfoPairVector attribute.
205 void UpdateEdgeInfo();
208 * Method that compares two edges.
209 * @pre The actual and the edge given by parameter both have a parent edge
210 * @param edge is the edge to be compared with
211 * @return the evalation value
213 double CompareWith(Edge* edge);
216 * Method that obtains the distance between two edges
217 * @param edge is the edge to be compared with
218 * @return the average distance from all points in the given edge
219 * to this edge. The distance from each in point in the edge to this
220 * edge is defined as the minimum distance to all the point in this
223 float GetDistanceToEdge(Edge* edge);
225 float GetDistanceToTranslatedEdge(Edge* edge, Vec3 vector_translation);
228 * Method that returns the distance point to point to the edge given by parameter.
229 * Additionally, the points that share the same closest point receive more weight in the distance.
230 * @param edge is the edge to be compared with
231 * @param vector_translation is the translation vector to translate the given edge
232 * @return the weigthed distance to the given edge
234 float GetDistanceWeigthedToTranslatedEdge(Edge* edge, Vec3 vector_translation);
237 * Method that calculates the distance from edge to one point in the space
238 * @point is the point in the space
239 * @return the distance from edge to one point in the space
241 float GetDistanceToPoint(Vec3 point);
244 * Method that returns the smallest distance of the edge voxels to the given voxel (represented as a vector)
245 * @param vector is the point to be compared
246 * @return the smallest distance of the edge voxels to the given voxel
248 float GetSmallestDistanceToPoint(Vec3 vector);
251 * Method that returns the closest point in the edge to the given point (represented as a vector) and the distance between them (by parameter)
252 * @param vector is the point to be compared
253 * @param distance is the returned distance to the closes point
254 * @return the closest vector and the minimum distance of the point to the points in the edge by parameter.
256 Vec3 GetClosestPoint(Vec3 vector, float& distance);
259 * Method that concatenates the actual edge to a superior one given by parameter
260 * @param superior is the superio edge. The target of the superior edge must be the source of the actual edge
261 * in terms of voxel position.
262 * @return the composed edge to the superior edge
264 Edge* ConcatenateToSuperior(Edge* superior);
268 Edge& operator=(Edge& edge);
270 const Edge& operator=(const Edge& edge);
272 bool operator==(const Edge& edge);
274 bool operator!=(const Edge& edge);
276 bool operator<(const Edge& edge);
278 bool operator>(const Edge& edge);
285 * Source node representing the father
290 * Target node representing the child
294 bool m_mark; //!Mark attribute
296 double m_angle; //!Angle between two vectors having its parent as reference
298 double m_length; //!Geodesic distance
300 double m_eDistance; //!Euclidean distance
302 double m_aRadius; //!Average radius between two nodes
304 unsigned int m_minRadius; //!Minimum radius between two nodes
306 unsigned int m_maxRadius; //!Maximum radius between two nodes
309 * The m_vec_pair_posVox_rad is a vector containing all centerline points,
310 * in real coordinates of the image, and radius information of an edge.
311 * i.e., for each point of the skeleton between two nodes there is a pair
312 * <position real coordinates, radius>
314 vec_pair_posVox_rad m_vec_pair_posVox_rad;
316 friend class AirwaysTree; //!Friend class AirwaysTree
318 friend class Node; //!Friend class Node
321 } /* namespace airways */
323 #endif /* AIRWAYSEDGE_H_ */