1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 /*=========================================================================
30 #ifndef __axisExtractor02_h
31 #define __axisExtractor02_h
34 #include "vtkPoints.h"
35 #include "vtkCellArray.h"
36 #include "vtkPolyData.h"
37 #include "vtkImageToStructuredPoints.h"
38 #include "vtkImageEuclideanDistance.h"
39 #include "vtkExtractVOI.h"
40 #include "vtkImageThreshold.h"
41 #include "vtkImageCast.h"
42 #include "vtkImageSeedConnectivity.h"
43 #include "vtkImageData.h"
44 #include "vtkImageReslice.h"
45 #include "vtkDoubleArray.h"
46 #include "vtkPointData.h"
47 #include "vtkImageResample.h"
49 #include "vtkPolyDataSource.h"
50 #include "vtkImageConstantPad.h"
60 class axisExtractor02 : public vtkPolyDataSource
63 static axisExtractor02 *New();
64 void PrintSelf(ostream& os, vtkIndent indent);
66 virtual void SetInput(vtkImageData *input);
67 vtkImageData *GetInput();
68 vtkPolyData *GetOutput();
70 void SetParam(double value);
73 void SetParam2(double value);
76 void SetParam3(double value);
80 void SetMaxant(int value);
83 void SetMinant(int value);
86 void SetPoint(double value[3]);
88 vtkImageData *GetVolumen();
90 void distanciaejes(vtkPolyData *eje1, vtkPolyData *eje2);
92 void blanquear(vtkImageData *data );
94 void copiar(vtkImageData *data, vtkImageData *data2 );
109 ~axisExtractor02() {};
116 axisExtractor02(const axisExtractor02&); // Not implemented.
118 void operator=(const axisExtractor02&); // Not implemented.
120 void realtoreal(double a[3], double b[3] );
122 void realtoreal2(double a[3], double b[3] );
124 void realtoindex(double a[3], int b[3] );
126 void indextoreal(int a[3], double b[3] );
128 void indextoreal(double a[3], double b[3] );
130 double distanciaejepunto(double point[3], double point2[3], double point3[3]);
132 double proporcioejepunto(double point[3], double point2[3], double point3[3]);
134 void searc(int i, int j, int k, vtkImageData *data, vtkImageData *data2, unsigned char label, unsigned long vector[50][4] );
136 void searcb(int i, int j, int k, vtkImageData *data, vtkImageData *data2, unsigned char label, unsigned long vector[50][4] );
138 unsigned char find_components(vtkImageData *data, vtkImageData *data2, unsigned char label, unsigned long vector[50][4] );
140 unsigned char find_componentsb(vtkImageData *data, vtkImageData *data2, unsigned char label, unsigned long vector[50][4] );
142 int proporcion(vtkImageData *data );
144 bool border(vtkImageData *data, int p1[3] );
146 void optim(vtkImageData *data, vtkImageData *data2 );
148 void costominimo(vtkImageData *data, vtkImageData *data2 );
150 void costominimo2(vtkImageData *data, vtkImageData *data3, int p1[3], int p2[3], int p3[3]);
152 void invertir(vtkImageData *data );
154 void redondear(vtkImageData *data );
156 void redondear2(vtkImageData *data );
158 void redondear3(vtkImageData *data );
160 double distancia(double a[3], double b[3] );
162 double distancia(int a[3], int b[3] );
164 void blanquear3(vtkImageData *data );
166 void blanquear2(vtkImageData *data );
168 void cilindro(vtkImageData *data, double vector[3] );
170 void modelo(vtkImageData *data, unsigned char cantidad, unsigned long vector[50][4], int candit[10][3], double radioactual, double minis[10]);
172 void comparacion(vtkImageData *data, vtkImageData *data2, unsigned long minis[4]);
174 void copiar2(vtkImageData *data, vtkImageData *data2 );
176 double angulo(double a[3], double b[3] );
178 double angulo(double i1, double j1, double k1, double i2, double j2, double k2 );
180 int envolumen(int a[3], vtkImageData *datae );
182 int mincandit(int candit[10][3], int cantidad, double puntoanterior[3]);
184 int maxareacandit(unsigned long vector[50][4], int cantidad);
186 unsigned long totalarea(unsigned long vector[50][4], unsigned long vectorb[50][4], int cantidad, int cantidadb);
188 unsigned long conecarea(unsigned long vector[50][4], int cantidad);
190 int bruled(int candit[10][3], int cantidad, vtkImageData *data4);
192 double correction(int candit[10][3], int cantidad, vtkImageData *data, int indicecorregido[3], double puntocorregido[3], int indiceanterior[3], double radioanterior, int indicepre[3], double radiopre);
194 double correction2(int candit[10][3], int cantidad, vtkImageData *data, int indicecorregido[3], double puntocorregido[3], int indiceanterior[3], double radioanterior);
215 vtkImageEuclideanDistance *distance;
216 vtkExtractVOI *extrac;
217 vtkImageSeedConnectivity *connect;
218 vtkImageResample *resample;
233 vtkCellArray *lineas;
236 /* std::stack< double > m_Stack0;
237 std::stack< double > m_Stack1;
238 std::stack< double > m_Stack2;
239 std::stack< double > m_Stack3;
240 std::stack< double > m_Stack4;
241 std::stack< double > m_Stack5;
242 std::stack< double > m_Stack6;
243 std::stack< double > m_Stack7;
244 std::stack< double > m_Stack8;
245 std::stack< int > m_Stack;
246 std::stack< double > m_Stackr;
247 std::stack< double > m_Stackra;
248 std::stack< double > m_Stackrp;*/
251 std::deque< double > m_Stack0;
252 std::deque< double > m_Stack1;
253 std::deque< double > m_Stack2;
254 std::deque< double > m_Stack3;
255 std::deque< double > m_Stack4;
256 std::deque< double > m_Stack5;
257 std::deque< double > m_Stack6;
258 std::deque< double > m_Stack7;
259 std::deque< double > m_Stack8;
260 std::deque< int > m_Stack;
261 std::deque< double > m_Stackr;
262 std::deque< double > m_Stackra;
263 std::deque< double > m_Stackrp;
267 double puntoanteriorr[3];
311 unsigned int hist[2000];
316 double variance, maxVariance, zerothCumuMoment, firstCumuMoment ;
317 double variance2, maxVariance2, zerothCumuMoment2, firstCumuMoment2 ;
318 double variance3, maxVariance3, zerothCumuMoment3, firstCumuMoment3 ;
319 double firstCumuMomentb, firstCumuMomentb2, firstCumuMomentb3 ;
324 int thresholdPoint, thresholdPoint1, thresholdPoint2;
338 double centx, centy, centz;
339 double centx2, centy2, centz2;
341 double centix, centiy, centiz;
355 double centxp, centyp, centzp;
356 double centx2p, centy2p, centz2p;
358 double centixp, centiyp, centizp;
360 double costo, costop;
369 double inerciar, inerciarp, inerciari, inerciary, inerciarz, inerciariy, inerciariz, inerciarpy, inerciarpz;
371 double inercia2r, inercia2rp;
380 double visitedrad[10];