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