UsTK : Ultrasound ToolKit  version 2.0.1 under development (2024-11-21)
usNeedleModelSpline.h
1 /****************************************************************************
2  *
3  * This file is part of the ustk software.
4  * Copyright (C) 2016 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ustk with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * This software was developed at:
17  * Inria Rennes - Bretagne Atlantique
18  * Campus Universitaire de Beaulieu
19  * 35042 Rennes Cedex
20  * France
21  *
22  * If you have questions regarding the use of this file, please contact
23  * Inria at ustk@inria.fr
24  *
25  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27  *
28  * Author:
29  * Jason Chevrie
30  *
31  *****************************************************************************/
32 
33 #ifndef __usNeedleModelSpline_h_
34 #define __usNeedleModelSpline_h_
35 
36 #include <iostream>
37 
38 #include <visp3/core/vpColVector.h>
39 
40 #include <visp3/ustk_core/usBSpline3D.h>
41 #include <visp3/ustk_needle_modeling/usNeedleModelBaseTip.h>
42 
43 class VISP_EXPORT usNeedleModelSpline : public usNeedleModelBaseTip, public usBSpline3D
44 {
45 public:
46  enum class NeedlePreset : int {
47  BiopsyNeedle,
48  BiopsyCannula,
49  Symmetric,
50  AbayazidRRM13,
51  MisraRSRO10_PlastisolA,
52  RoesthuisAM12,
53  SteelSoftTissue,
54  SRL_ActuatedFBG,
55  SRL_BiopsySimple,
56  SRL_BiopsyNID,
57  NDI_Pink_Stylet
58  };
59 
60 protected:
62 
63  double m_length;
67 
68 public:
70 
73  virtual ~usNeedleModelSpline();
75 
76  virtual usNeedleModelSpline *clone() const { return new usNeedleModelSpline(*this); } // Polymorph copy method
77 
79 
80  void loadPreset(const NeedlePreset preset);
81 
83 
85 
86  void setFullLength(double length);
87  double getFullLength() const;
88 
89  void setOuterDiameter(double diameter);
90  double getOuterDiameter() const;
91 
92  void setInsideDiameter(double diameter);
93  double getInsideDiameter() const;
94 
95  void setNeedleYoungModulus(double E);
96  double getNeedleYoungModulus() const;
97 
98  double getEI() const;
99 
101 
102  void init();
103 
105 
107 
108  vpColVector getNeedlePoint(double l) const;
109  vpColVector getNeedleDirection(double l) const;
110 
111  double getDistanceFromPoint(const vpColVector &P, double start = 0, double stop = -1, double threshold = 1e-5) const;
112 
114 
115  double getBendingEnergy() const;
116 
118 
119  vpColVector getBaseStaticTorsor() const;
120 
122 
123  double getCurvatureFromNeedleShape(double start, double end, vpColVector &center3D, vpColVector &direction3D) const;
124 
126 
127  void showNeedlePoints() const;
128  void showNeedleDirections() const;
129  void showNeedleSegmentCoef() const;
130  void showNeedleSegmentLength() const;
131 
133 
135  friend VISP_EXPORT std::ostream &operator<<(std::ostream &s, const usNeedleModelSpline &needle);
136  friend VISP_EXPORT std::istream &operator>>(std::istream &s, usNeedleModelSpline &needle);
138  friend VISP_EXPORT std::ostream &operator<<=(std::ostream &s, const usNeedleModelSpline &needle);
139  friend VISP_EXPORT std::istream &operator>>=(std::istream &s, usNeedleModelSpline &needle);
140 };
141 
142 VISP_EXPORT std::ostream &operator<<(std::ostream &s, const usNeedleModelSpline &needle);
143 VISP_EXPORT std::istream &operator>>(std::istream &s, usNeedleModelSpline &needle);
144 
145 VISP_EXPORT std::ostream &operator<<=(std::ostream &s, const usNeedleModelSpline &needle);
146 VISP_EXPORT std::istream &operator>>=(std::istream &s, usNeedleModelSpline &needle);
147 
148 #endif // __usNeedleModelSpline_h_
friend VISP_EXPORT std::istream & operator>>(std::istream &s, usBSpline3D &spline)
friend VISP_EXPORT std::ostream & operator<<(std::ostream &s, const usBSpline3D &spline)
Data saving.
friend VISP_EXPORT std::ostream & operator<<=(std::ostream &s, const usBSpline3D &spline)
Binary.
double getDistanceFromPoint(const vpColVector &point, double start=0, double stop=-1, double threshold=1e-5) const
const usBSpline3D & operator=(const usBSpline3D &spline)
Definition: usBSpline3D.cpp:51
friend VISP_EXPORT std::istream & operator>>=(std::istream &s, usBSpline3D &spline)
virtual usNeedleModelSpline * clone() const
double m_length
Needle parameters.