UsTK : Ultrasound ToolKit  version 2.0.1 under development (2025-03-14)
usNeedleDetectionTools.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  * Authors:
29  * Pierre Chatelain
30  * Alexandre Krupa
31  *
32  *****************************************************************************/
33 
34 #ifndef __usNeedleDetectionTools_h_
35 #define __usNeedleDetectionTools_h_
36 
37 #include <algorithm>
38 #include <float.h>
39 #include <iostream>
40 #include <math.h>
41 #include <stdio.h>
42 #include <string.h>
43 #include <vector>
44 
45 // ViSP
46 #include <visp3/core/vpColVector.h>
47 #include <visp3/core/vpList.h>
48 #include <visp3/core/vpMatrix.h>
49 
50 // UsTK
51 #include <visp3/ustk_core/usConfig.h>
52 
61 namespace usNeedleDetectionTools
62 {
66 double angle(double *p1, double *p2, double *q1, double *q2);
67 
95 vpMatrix approximateCoordinates(vpMatrix X, vpMatrix MSS, unsigned int s);
96 
104 void arithmeticMean(const vpMatrix points, double *mean, unsigned int npts, unsigned int d);
105 
106 void computeQuantile(unsigned char *data, unsigned int dataSize, unsigned int nDesired, unsigned int &q,
107  unsigned int &nThresholded);
108 void computeQuantile(short *data, unsigned int dataSize, unsigned int nDesired, unsigned int &q,
109  unsigned int &nThresholded);
110 void computeQuantile(const unsigned int *data, unsigned int dataSize, unsigned int nDesired, unsigned int &q,
111  unsigned int &nThresholded);
112 
113 void computeControlPoints(const vpMatrix &model, vpMatrix &mss, double **points, const unsigned int &nPoints);
114 
118 double dist3(double *x, double *y);
119 
120 bool findEntry(const vpMatrix &model, double *entry, unsigned int nPoints, const vpColVector &origin,
121  const vpColVector &entryPlane, int VOI[6]);
122 
129 vpColVector geometricMedian(const vpMatrix points, unsigned int npts, unsigned int d);
130 
131 bool inside(const vpColVector point, int *VOI);
132 
136 bool intersectionLinePlane(vpMatrix line, const vpColVector &plane, double offset, double &x, double &y, double &z);
137 
141 void linearRegression(vpMatrix &points, double &x, double &y, double &z, double &u, double &v, double &w);
142 void linearRegression(vpMatrix &points, double &a, double &b, double &u, double &v, double &w);
143 
144 short quantile(short *data, unsigned int num, unsigned int n);
145 
149 double variance(vpMatrix points, unsigned int npts, unsigned int d);
150 }
151 
152 #endif // __usNeedleDetectionTools_h_
Basic tools for needle detection.
bool findEntry(const vpMatrix &model, double *entry, unsigned int nPoints, const vpColVector &origin, const vpColVector &entryPlane, int VOI[6])
void computeControlPoints(const vpMatrix &model, vpMatrix &mss, double **points, const unsigned int &nPoints)
double variance(vpMatrix points, unsigned int npts, unsigned int d)
void computeQuantile(unsigned char *data, unsigned int dataSize, unsigned int nDesired, unsigned int &q, unsigned int &nThresholded)
void arithmeticMean(const vpMatrix points, double *mean, unsigned int npts, unsigned int d)
vpMatrix approximateCoordinates(vpMatrix X, vpMatrix MSS, unsigned int s)
bool inside(const vpColVector point, int *VOI)
short quantile(short *data, unsigned int num, unsigned int n)
vpColVector geometricMedian(const vpMatrix points, unsigned int npts, unsigned int d)
double angle(double *p1, double *p2, double *q1, double *q2)
void linearRegression(vpMatrix &points, double &x, double &y, double &z, double &u, double &v, double &w)
double dist3(double *x, double *y)
bool intersectionLinePlane(vpMatrix line, const vpColVector &plane, double offset, double &x, double &y, double &z)