00001
00002
00003
00004
00005 #ifndef __axisExtractor02_h
00006 #define __axisExtractor02_h
00007
00008
00009 #include "vtkPoints.h"
00010 #include "vtkCellArray.h"
00011 #include "vtkPolyData.h"
00012 #include "vtkImageToStructuredPoints.h"
00013 #include "vtkImageEuclideanDistance.h"
00014 #include "vtkExtractVOI.h"
00015 #include "vtkImageThreshold.h"
00016 #include "vtkImageCast.h"
00017 #include "vtkImageSeedConnectivity.h"
00018 #include "vtkImageData.h"
00019 #include "vtkImageReslice.h"
00020 #include "vtkDoubleArray.h"
00021 #include "vtkPointData.h"
00022 #include "vtkImageResample.h"
00023 #include "vtkMath.h"
00024 #include "vtkPolyDataSource.h"
00025 #include "vtkImageConstantPad.h"
00026
00027
00028 #include <stack>
00029 #include <deque>
00030 #include <stdio.h>
00031
00032
00033
00034
00035 class axisExtractor02 : public vtkPolyDataSource
00036 {
00037 public:
00038 static axisExtractor02 *New();
00039 void PrintSelf(ostream& os, vtkIndent indent);
00040
00041 virtual void SetInput(vtkImageData *input);
00042 vtkImageData *GetInput();
00043 vtkPolyData *GetOutput();
00044
00045 void SetParam(double value);
00046 double GetParam();
00047
00048 void SetParam2(double value);
00049 double GetParam2();
00050
00051 void SetParam3(double value);
00052 double GetParam3();
00053
00054
00055 void SetMaxant(int value);
00056 int GetMaxant();
00057
00058 void SetMinant(int value);
00059 int GetMinant();
00060
00061 void SetPoint(double value[3]);
00062
00063 vtkImageData *GetVolumen();
00064
00065 void distanciaejes(vtkPolyData *eje1, vtkPolyData *eje2);
00066
00067 void blanquear(vtkImageData *data );
00068
00069 void copiar(vtkImageData *data, vtkImageData *data2 );
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 protected:
00082 axisExtractor02();
00083
00084 ~axisExtractor02() {};
00085
00086 void Execute();
00087
00088
00089
00090 private:
00091 axisExtractor02(const axisExtractor02&);
00092
00093 void operator=(const axisExtractor02&);
00094
00095 void realtoreal(double a[3], double b[3] );
00096
00097 void realtoreal2(double a[3], double b[3] );
00098
00099 void realtoindex(double a[3], int b[3] );
00100
00101 void indextoreal(int a[3], double b[3] );
00102
00103 void indextoreal(double a[3], double b[3] );
00104
00105 double distanciaejepunto(double point[3], double point2[3], double point3[3]);
00106
00107 double proporcioejepunto(double point[3], double point2[3], double point3[3]);
00108
00109 void searc(int i, int j, int k, vtkImageData *data, vtkImageData *data2, unsigned char label, unsigned long vector[50][4] );
00110
00111 void searcb(int i, int j, int k, vtkImageData *data, vtkImageData *data2, unsigned char label, unsigned long vector[50][4] );
00112
00113 unsigned char find_components(vtkImageData *data, vtkImageData *data2, unsigned char label, unsigned long vector[50][4] );
00114
00115 unsigned char find_componentsb(vtkImageData *data, vtkImageData *data2, unsigned char label, unsigned long vector[50][4] );
00116
00117 int proporcion(vtkImageData *data );
00118
00119 bool border(vtkImageData *data, int p1[3] );
00120
00121 void optim(vtkImageData *data, vtkImageData *data2 );
00122
00123 void costominimo(vtkImageData *data, vtkImageData *data2 );
00124
00125 void costominimo2(vtkImageData *data, vtkImageData *data3, int p1[3], int p2[3], int p3[3]);
00126
00127 void invertir(vtkImageData *data );
00128
00129 void redondear(vtkImageData *data );
00130
00131 void redondear2(vtkImageData *data );
00132
00133 void redondear3(vtkImageData *data );
00134
00135 double distancia(double a[3], double b[3] );
00136
00137 double distancia(int a[3], int b[3] );
00138
00139 void blanquear3(vtkImageData *data );
00140
00141 void blanquear2(vtkImageData *data );
00142
00143 void cilindro(vtkImageData *data, double vector[3] );
00144
00145 void modelo(vtkImageData *data, unsigned char cantidad, unsigned long vector[50][4], int candit[10][3], double radioactual, double minis[10]);
00146
00147 void comparacion(vtkImageData *data, vtkImageData *data2, unsigned long minis[4]);
00148
00149 void copiar2(vtkImageData *data, vtkImageData *data2 );
00150
00151 double angulo(double a[3], double b[3] );
00152
00153 double angulo(double i1, double j1, double k1, double i2, double j2, double k2 );
00154
00155 int envolumen(int a[3], vtkImageData *datae );
00156
00157 int mincandit(int candit[10][3], int cantidad, double puntoanterior[3]);
00158
00159 int maxareacandit(unsigned long vector[50][4], int cantidad);
00160
00161 unsigned long totalarea(unsigned long vector[50][4], unsigned long vectorb[50][4], int cantidad, int cantidadb);
00162
00163 unsigned long conecarea(unsigned long vector[50][4], int cantidad);
00164
00165 int bruled(int candit[10][3], int cantidad, vtkImageData *data4);
00166
00167 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);
00168
00169 double correction2(int candit[10][3], int cantidad, vtkImageData *data, int indicecorregido[3], double puntocorregido[3], int indiceanterior[3], double radioanterior);
00170
00171 void avanzar();
00172
00173 void todo();
00174
00175 void paso();
00176
00177 void rama();
00178
00179 void segmento();
00180
00181
00182
00183 int extprin0[6];
00184 double espprin[3];
00185 int extprin[6];
00186
00187
00188
00189
00190 vtkImageEuclideanDistance *distance;
00191 vtkExtractVOI *extrac;
00192 vtkImageSeedConnectivity *connect;
00193 vtkImageResample *resample;
00194
00195
00196 vtkImageData *data1;
00197 vtkImageData *data2;
00198 vtkImageData *data3;
00199 vtkImageData *data4;
00200 vtkImageData *data6;
00201
00202
00203
00204 int flagg;
00205 int flagg2;
00206
00207 vtkPoints *points;
00208 vtkCellArray *lineas;
00209 int buenos;
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226 std::deque< double > m_Stack0;
00227 std::deque< double > m_Stack1;
00228 std::deque< double > m_Stack2;
00229 std::deque< double > m_Stack3;
00230 std::deque< double > m_Stack4;
00231 std::deque< double > m_Stack5;
00232 std::deque< double > m_Stack6;
00233 std::deque< double > m_Stack7;
00234 std::deque< double > m_Stack8;
00235 std::deque< int > m_Stack;
00236 std::deque< double > m_Stackr;
00237 std::deque< double > m_Stackra;
00238 std::deque< double > m_Stackrp;
00239
00240
00241
00242 double puntoanteriorr[3];
00243
00244
00245
00246 unsigned short max;
00247 unsigned long cantt;
00248 double sum;
00249 double sumc;
00250 double sums;
00251 double sumk;
00252 double kurt;
00253 double slew;
00254 double des;
00255 double prom;
00256 unsigned short min;
00257
00258 double kurt1;
00259 double slew1;
00260
00261
00262 unsigned short max2;
00263 unsigned long cant;
00264 double sumi;
00265 double sumii;
00266 double kurt2;
00267 double slew2;
00268 double des2;
00269 double inerciaii;
00270 double centi;
00271 unsigned short min2;
00272
00273 unsigned short max3;
00274 unsigned long cant2;
00275 double sumi2;
00276 double sumii2;
00277 double kurt3;
00278 double slew3;
00279 double des3;
00280 double inerciaii2;
00281 double centi2;
00282 unsigned short min3;
00283
00284 float tmin, tmax;
00285
00286 unsigned int hist[2000];
00287
00288 int maxant;
00289 int minant;
00290 double totalMean ;
00291 double variance, maxVariance, zerothCumuMoment, firstCumuMoment ;
00292 double variance2, maxVariance2, zerothCumuMoment2, firstCumuMoment2 ;
00293 double variance3, maxVariance3, zerothCumuMoment3, firstCumuMoment3 ;
00294 double firstCumuMomentb, firstCumuMomentb2, firstCumuMomentb3 ;
00295
00296 double kurtt;
00297 double slewt;
00298
00299 int thresholdPoint, thresholdPoint1, thresholdPoint2;
00300
00301 double w[3];
00302 double V[3][3];
00303 int ejemin;
00304
00305 double w2[3];
00306 double V2[3][3];
00307 int ejemin2;
00308
00309 double wi[3];
00310 double Vi[3][3];
00311 int ejemini;
00312
00313 double centx, centy, centz;
00314 double centx2, centy2, centz2;
00315
00316 double centix, centiy, centiz;
00317
00318 double A[3][3];
00319 double A2[3][3];
00320 double Ai[3][3];
00321
00322 double wp[3];
00323 double Vp[3][3];
00324 int ejeminp;
00325
00326 double w2p[3];
00327 double V2p[3][3];
00328 int ejemin2p;
00329
00330 double centxp, centyp, centzp;
00331 double centx2p, centy2p, centz2p;
00332
00333 double centixp, centiyp, centizp;
00334
00335 double costo, costop;
00336
00337 double Ap[3][3];
00338 double A2p[3][3];
00339
00340 int candit[10][3];
00341
00342 double minis[10];
00343
00344 double inerciar, inerciarp, inerciari, inerciary, inerciarz, inerciariy, inerciariz, inerciarpy, inerciarpz;
00345
00346 double inercia2r, inercia2rp;
00347
00348 double mejor[3];
00349
00350
00351
00352
00353 int visited[10][3];
00354
00355 double visitedrad[10];
00356
00357 int frama;
00358 int fseg;
00359 double mejordst;
00360
00361 double mejorrad;
00362
00363 int mejorcant;
00364
00365
00366
00367 double param;
00368 double param2;
00369 double param3;
00370 double param4;
00371
00372 FILE *stream;
00373
00374
00375
00376
00377
00378
00379
00380
00381 };
00382
00383 #endif
00384
00385