33 #ifndef __usNeedleInsertionModelVirtualSprings_h
34 #define __usNeedleInsertionModelVirtualSprings_h
39 #include <visp3/core/vpColVector.h>
40 #include <visp3/core/vpHomogeneousMatrix.h>
41 #include <visp3/core/vpImage.h>
42 #include <visp3/core/vpMatrix.h>
43 #include <visp3/core/vpRGBa.h>
45 #include <visp3/ustk_core/usOrientedPlane3D.h>
46 #include <visp3/ustk_needle_modeling/usNeedleInsertionModelInterface.h>
47 #include <visp3/ustk_needle_modeling/usNeedleModelSpline.h>
48 #include <visp3/ustk_needle_modeling/usVirtualSpring.h>
53 enum class InsertionType : int { ForceInsert, ForceRemove, NaturalBehavior };
58 MisraRSRO10_PlastisolA,
134 void setTipForce(
double tipForce);
135 double getTipForce();
137 void setBevelAngle(
double angle);
138 double getBevelAngle()
const;
142 void setDefaultSpringStiffness(
double K);
143 double getDefaultSpringStiffness()
const;
145 void setStiffnessPerUnitLength(
double K);
146 double getStiffnessPerUnitLength()
const;
148 int getNbSprings()
const;
149 int getNbMeasureSprings()
const;
157 bool IsNeedleInserted()
const;
158 vpColVector getNeedleInsertionPoint()
const;
159 vpColVector getTissueInsertionPoint()
const;
160 double getNeedleFreeLength()
const;
161 double getInsertionDepth()
const;
168 void setInterSpringDistance(
double interSpringDistance);
169 double getInterSpringDistance()
const;
170 void setInterTipSpringDistance(
double interTipSpringDistance);
171 double getInterTipSpringDistance()
const;
173 void setNbMinTipSprings(
int nb);
174 int getNbMinTipSprings()
const;
176 void setNbMaxTipSprings(
int nb);
177 int getNbMaxTipSprings()
const;
181 void AllowSpringAddition(
bool flag);
182 void AllowSpringRemoval(
bool flag);
187 void setAutomaticSpringAddition(
bool flag);
188 bool getAutomaticSpringAddition()
const;
194 double getPathDistanceFromPoint(
const vpColVector &P)
const;
198 double getTissueDeformationEnergy()
const;
199 double getSurfaceTissueStretch()
const;
200 double getMaxTissueStretch(
double *lmax =
nullptr)
const;
201 double getMeanTissueStretch()
const;
213 void addMeasureSpring(
214 const vpColVector &p,
215 const vpColVector &d);
217 bool setSpringPosition(
int index,
const vpColVector &P,
bool update =
false);
218 bool setSpringDirection(
int index,
const vpColVector &D,
bool update =
false);
219 void setSpringStiffness(
int index,
double K,
bool update =
false);
220 bool moveSpringPosition(
int index,
const vpColVector &dP,
bool update =
false);
221 bool moveSpringDirection(
int index,
const vpThetaUVector &thetaU,
bool update =
false);
222 void addSpringStiffness(
int index,
double dK,
bool update =
false);
224 void setSurfaceAtTip();
229 int addInsertionPoint(
230 const vpColVector &p,
231 const vpColVector &d);
233 void addInsertionPointOnSegmentHard(
int segment,
235 void addInsertionPointAtTipHard();
236 void addInsertionPointOnSegment(
239 void addInsertionPointAtTip();
241 void removeInsertionPointsHard(
int first,
int last = -1);
242 void removeLastInsertionPointHard();
243 void removeInsertionPoints(
int first,
int last = -1);
244 void removeLastInsertionPoint();
245 void removeAutoAddedSprings();
247 void fusionSprings(
int firstSpring,
int lastSpring);
249 void updateSpringsStiffness();
250 void updateCutAngle();
251 void updateTipForce();
252 void updateInsertionDirections();
254 bool checkInactiveMeasureSprings();
256 void solveSegmentsParametersSparseEigen();
257 void solveSegmentsParametersOpenCV();
258 void solveSegmentsParametersViSP();
259 void solveSegmentsParameters();
260 void computeSegmentsLengths();
261 bool addRemoveSprings();
266 void showInsertionPoints()
const;
267 void showInsertionDirections()
const;
268 void showStiffnesses()
const;
virtual bool setBasePose(const vpPoseVector &pose)=0
The following methods should be redefined in the derived classes.
virtual vpPoseVector getBasePose() const =0
InsertionType m_insertionBehavior
Insertion type.
std::vector< usVirtualSpring > m_inactiveMeasureSprings
double m_interTipSpringDistance
bool m_IsStateConsistent
Internal.
usOrientedPlane3D m_tissueSurface
bool m_AutomaticSpringAddition
std::vector< usVirtualSpring > m_inactiveAutoAddedSprings
double m_defaultSpringStiffness
Tissue parameters.
bool m_LastSegmentLengthComputed
Segments lengths measurement.
bool m_AllowSpringAddition
bool m_AllowSpringRemoval
double m_interSpringDistance
int m_tipSpringsIndex
Tip springs.
std::vector< usVirtualSpring > m_springs
Model Parameters.
usNeedleModelSpline m_needle
Needle parameters.
double m_stiffnessPerUnitLength