]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/kernel/include/axisExtractor02.h
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / kernel / include / axisExtractor02.h
1 /*=========================================================================
2
3   */
4
5 #ifndef __axisExtractor02_h
6 #define __axisExtractor02_h
7
8
9 #include "vtkPoints.h"
10 #include "vtkCellArray.h"
11 #include "vtkPolyData.h"
12 #include "vtkImageToStructuredPoints.h"
13 #include "vtkImageEuclideanDistance.h"
14 #include "vtkExtractVOI.h"
15 #include "vtkImageThreshold.h"
16 #include "vtkImageCast.h"
17 #include "vtkImageSeedConnectivity.h"
18 #include "vtkImageData.h"
19 #include "vtkImageReslice.h"
20 #include "vtkDoubleArray.h"
21 #include "vtkPointData.h"
22 #include "vtkImageResample.h"
23 #include "vtkMath.h"
24 #include "vtkPolyDataSource.h"
25 #include "vtkImageConstantPad.h"
26
27
28 #include <stack>
29 #include <deque>
30 #include <stdio.h>
31
32
33
34
35 class  axisExtractor02 : public vtkPolyDataSource
36 {
37 public:
38         static axisExtractor02 *New();
39         void PrintSelf(ostream& os, vtkIndent indent);
40
41         virtual void SetInput(vtkImageData *input);
42         vtkImageData *GetInput();
43         vtkPolyData  *GetOutput();
44
45         void SetParam(double value);
46         double GetParam();
47
48         void SetParam2(double value);
49         double GetParam2();
50
51         void SetParam3(double value);
52         double GetParam3();
53
54
55         void SetMaxant(int value);
56         int GetMaxant();
57
58         void SetMinant(int value);
59         int GetMinant();
60
61         void SetPoint(double value[3]);
62         
63         vtkImageData *GetVolumen();
64
65         void distanciaejes(vtkPolyData *eje1,  vtkPolyData *eje2);
66
67         void blanquear(vtkImageData *data );
68
69         void copiar(vtkImageData *data, vtkImageData *data2 );
70
71         
72
73         
74
75
76
77
78         
79   
80   
81 protected:  
82         axisExtractor02();
83         
84         ~axisExtractor02() {};
85
86         void Execute();
87  
88   
89
90 private:
91         axisExtractor02(const axisExtractor02&);  // Not implemented.
92
93         void operator=(const axisExtractor02&);  // Not implemented.
94
95         void realtoreal(double a[3], double b[3] );
96
97         void realtoreal2(double a[3], double b[3] );
98
99         void realtoindex(double a[3], int b[3] );
100
101         void indextoreal(int a[3], double b[3] );
102
103         void indextoreal(double a[3], double b[3] );
104
105         double distanciaejepunto(double point[3], double point2[3], double point3[3]);
106
107         double proporcioejepunto(double point[3], double point2[3], double point3[3]);
108
109         void searc(int i, int j, int k, vtkImageData *data, vtkImageData *data2, unsigned char label, unsigned long vector[50][4] );
110
111         void searcb(int i, int j, int k, vtkImageData *data, vtkImageData *data2, unsigned char label, unsigned long vector[50][4] );
112
113         unsigned char find_components(vtkImageData *data, vtkImageData *data2, unsigned char label, unsigned long vector[50][4] );
114
115         unsigned char find_componentsb(vtkImageData *data, vtkImageData *data2, unsigned char label, unsigned long vector[50][4] );
116
117         int proporcion(vtkImageData *data );
118
119         bool border(vtkImageData *data, int p1[3] );
120
121         void optim(vtkImageData *data, vtkImageData *data2 );
122
123         void costominimo(vtkImageData *data,  vtkImageData *data2 );
124
125         void costominimo2(vtkImageData *data,  vtkImageData *data3, int p1[3], int p2[3], int p3[3]);
126
127         void invertir(vtkImageData *data );
128
129         void redondear(vtkImageData *data );
130
131         void redondear2(vtkImageData *data );
132
133         void redondear3(vtkImageData *data );
134
135         double distancia(double a[3], double b[3] );
136
137         double distancia(int a[3], int b[3] );
138
139         void blanquear3(vtkImageData *data );
140
141         void blanquear2(vtkImageData *data );
142
143         void cilindro(vtkImageData *data, double vector[3] );
144
145         void modelo(vtkImageData *data, unsigned char cantidad,  unsigned long vector[50][4], int candit[10][3], double radioactual, double minis[10]);
146
147         void comparacion(vtkImageData *data, vtkImageData *data2, unsigned long minis[4]);
148
149         void copiar2(vtkImageData *data, vtkImageData *data2 );
150
151         double angulo(double a[3], double b[3] );
152
153         double angulo(double i1, double j1, double k1, double i2, double j2, double k2 );
154
155         int envolumen(int a[3], vtkImageData *datae );
156
157         int mincandit(int candit[10][3], int cantidad, double puntoanterior[3]);
158
159         int maxareacandit(unsigned long vector[50][4], int cantidad);
160
161         unsigned long totalarea(unsigned long vector[50][4], unsigned long vectorb[50][4], int cantidad, int cantidadb);
162
163         unsigned long conecarea(unsigned long vector[50][4], int cantidad);
164
165         int bruled(int candit[10][3], int cantidad, vtkImageData *data4);
166
167         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);
168
169         double correction2(int candit[10][3], int cantidad, vtkImageData *data, int indicecorregido[3], double puntocorregido[3], int indiceanterior[3], double radioanterior);
170
171         void avanzar();
172
173         void todo();
174
175         void paso();
176
177         void rama();
178
179         void segmento();
180
181         
182
183         int extprin0[6];
184         double espprin[3];
185         int extprin[6];
186         
187
188                 
189         
190         vtkImageEuclideanDistance *distance;
191         vtkExtractVOI *extrac;
192         vtkImageSeedConnectivity *connect;
193         vtkImageResample *resample;
194         
195
196         vtkImageData *data1;
197         vtkImageData *data2;
198         vtkImageData *data3;
199         vtkImageData *data4;
200         vtkImageData *data6;
201         
202                 
203
204         int flagg;
205         int flagg2;
206
207         vtkPoints *points;
208         vtkCellArray *lineas; 
209         int buenos;
210
211 /*      std::stack< double  >                                           m_Stack0;
212         std::stack< double  >                                           m_Stack1;
213         std::stack< double  >                                           m_Stack2;
214         std::stack< double  >                                           m_Stack3;
215         std::stack< double  >                                           m_Stack4;
216         std::stack< double  >                                           m_Stack5;
217         std::stack< double  >                                           m_Stack6;
218         std::stack< double  >                                           m_Stack7;
219         std::stack< double  >                                           m_Stack8;
220         std::stack< int  >                                              m_Stack;
221         std::stack< double  >                                           m_Stackr;
222         std::stack< double  >                                           m_Stackra;
223         std::stack< double  >                                           m_Stackrp;*/
224
225
226         std::deque< double  >                                           m_Stack0;
227         std::deque< double  >                                           m_Stack1;
228         std::deque< double  >                                           m_Stack2;
229         std::deque< double  >                                           m_Stack3;
230         std::deque< double  >                                           m_Stack4;
231         std::deque< double  >                                           m_Stack5;
232         std::deque< double  >                                           m_Stack6;
233         std::deque< double  >                                           m_Stack7;
234         std::deque< double  >                                           m_Stack8;
235         std::deque< int  >                                              m_Stack;
236         std::deque< double  >                                           m_Stackr;
237         std::deque< double  >                                           m_Stackra;
238         std::deque< double  >                                           m_Stackrp;
239
240
241
242         double puntoanteriorr[3];
243
244
245
246         unsigned short max;
247         unsigned long cantt;
248         double sum;
249         double sumc;
250         double sums;
251         double sumk;
252         double kurt;
253         double slew;
254         double des;
255         double prom;
256         unsigned short min;
257
258         double kurt1;
259         double slew1;
260
261
262         unsigned short max2;
263         unsigned long cant;
264         double sumi;
265         double sumii;
266         double kurt2;
267         double slew2;
268         double des2;
269         double inerciaii;
270         double centi;
271         unsigned short min2;
272
273         unsigned short max3;
274         unsigned long cant2;
275         double sumi2;
276         double sumii2;
277         double kurt3;
278         double slew3;
279         double des3;
280         double inerciaii2;
281         double centi2;
282         unsigned short min3;
283
284         float tmin, tmax;
285
286         unsigned int hist[2000];
287
288         int maxant;
289         int minant;
290         double totalMean ;
291         double variance, maxVariance, zerothCumuMoment, firstCumuMoment ;
292         double variance2, maxVariance2, zerothCumuMoment2, firstCumuMoment2 ;
293         double variance3, maxVariance3, zerothCumuMoment3, firstCumuMoment3 ;
294         double firstCumuMomentb, firstCumuMomentb2, firstCumuMomentb3 ;
295
296         double kurtt;
297         double slewt;
298         
299         int thresholdPoint, thresholdPoint1, thresholdPoint2;
300
301         double    w[3];
302         double    V[3][3];
303         int ejemin;
304
305         double    w2[3];
306         double    V2[3][3];
307         int ejemin2;
308
309         double    wi[3];
310         double    Vi[3][3];
311         int ejemini;
312
313         double centx, centy, centz;
314         double centx2, centy2, centz2;
315
316         double centix, centiy, centiz;
317
318         double    A[3][3];
319         double    A2[3][3];
320         double    Ai[3][3];
321
322         double    wp[3];
323         double    Vp[3][3];
324         int ejeminp;
325
326         double    w2p[3];
327         double    V2p[3][3];
328         int ejemin2p;
329
330         double centxp, centyp, centzp;
331         double centx2p, centy2p, centz2p;
332
333         double centixp, centiyp, centizp;
334         
335         double costo, costop;
336
337         double    Ap[3][3];
338         double    A2p[3][3];
339
340         int candit[10][3];
341
342         double minis[10];
343
344         double inerciar, inerciarp, inerciari, inerciary, inerciarz, inerciariy, inerciariz, inerciarpy, inerciarpz;
345
346         double inercia2r, inercia2rp;
347
348         double mejor[3];
349
350         
351         
352
353         int visited[10][3];
354
355         double visitedrad[10];
356
357         int frama;
358         int fseg;
359         double mejordst;
360
361         double mejorrad;
362
363         int mejorcant;
364
365         
366
367         double param;
368         double param2;
369         double param3;
370         double param4;
371
372         FILE *stream;
373
374
375         
376         
377         
378
379
380         
381 };
382
383 #endif
384
385