00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __MAR__KERNEL__AXIS__HXX__
00019 #define __MAR__KERNEL__AXIS__HXX__
00020
00021 #include <vtkPolyData.h>
00022 #include <vtkProbeFilter.h>
00023 #include <vector>
00024
00025
00026
00027
00028 #include "curve.hxx"
00029 #include "volume.hxx"
00030 #include "marContour.h"
00031 #include "marObject.h"
00032 #include "ExtractionAxe.h"
00033 #include <marAxisContours.h>
00034 #include <marIsocontour.h>
00035
00036 class vtkPoints;
00037 class vtkCellArray;
00038
00043 class MAR_KERNEL_EXPORT marAxis : public marObject, public kCurve
00044 {
00045 public:
00046
00052 enum AxisStateVectorIndexes
00053 {
00054 INDX_X = 0,
00055 INDX_Y,
00056 INDX_Z,
00057 INDX_V1X,
00058 INDX_V1Y,
00059 INDX_V1Z,
00060 INDX_V2X,
00061 INDX_V2Y,
00062 INDX_V2Z,
00063 INDX_V3X,
00064 INDX_V3Y,
00065 INDX_V3Z,
00066 INDX_LAMBDA1,
00067 INDX_LAMBDA2,
00068 INDX_LAMBDA3,
00069 INDX_MASSE,
00070 INDX_RAYON,
00071 INDX_INERTIE,
00072 INDX_PTAGEMASSE,
00073 INDX_PTAGERAYON,
00074 INDX_SIGNALVALUE,
00075 INDX_count
00076 };
00077
00078 public:
00079
00083 marAxis( marParameters* p = NULL );
00084
00088 ~marAxis( ) { reset( ); };
00089
00093 std::string& getDescription( ) { return( _description ); };
00094
00098 void setDescription( std::string& d ) { _description = d; };
00099
00104 void addAxisPoint( double* p );
00105 void changeAxisResolution( );
00106 void calculateSignal( kVolume* vol );
00107
00108
00109 int getActualQuant( ) { return _actualQuant; }
00110
00111 float getSignal( uint slice ) { return( _signal[ slice ] ); };
00112
00113 double* getSplinePoint( uint i ) { return ( _points[ i ] ); };
00114
00115 int getHealthySlice( ) { return( _healthySlice ); };
00116 int getHealthySliceStart( ) { return( _healthySliceStart ); };
00117 int getHealthySliceEnd( ) { return( _healthySliceEnd ); };
00118
00119 void setActualQuant(int act) { _actualQuant=act; };
00120
00121 void setHealthySlice( int hsS, int hs, int hsE );
00122
00123 void setStartQuant( int sq );
00124 void setFinishQuant( int fq );
00125
00126
00127 int getStartQuant( ) { return _startQuant; };
00128 int getFinishQuant( ) { return _finishQuant; };
00129
00130
00131 void start( );
00132 void next( ) { _actualQuant++; };
00133 void stop( ) { _actualQuant = _finishQuant + 1; };
00134 bool isFinished( ) { return( _actualQuant >= _startQuant && _actualQuant <= _finishQuant ); }
00135
00136 void doSpline ( );
00137
00138 void cut( int slice, bool up );
00139
00140
00141 void sliceVolumeAxis( kVolume* vol, bool forceCnt = true );
00142
00143 double* getNormal( unsigned int slice );
00144
00145 int getNumberOfContours( );
00146 int getNumberOfSplinePoints( );
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160 bool if3DcontourExist(int i);
00161 void Save3Dcontour(FILE *ff,int i);
00162 void SaveExisting3DContours(FILE *ff);
00163
00164
00165 marContour* getContour( int i , kVolume* vol );
00166 kVolume* getSlice( int i , kVolume* vol );
00167 vtkProbeFilter* get3DSlice( int i , kVolume* vol );
00168 vtkPoints* get3Dcontour( int i , kVolume* vol );
00169 vtkImageData* getSliceImage( int i , kVolume* vol );
00170 vtkPolyData* get2Dcontour( int i , kVolume* vol );
00171 vtkPoints* get2DDiameterMin( int i , kVolume* vol );
00172 vtkPoints* get2DDiameterMax( int i , kVolume* vol );
00173
00174 void replaceContour2D(int i,int size,double *vx,double *vy);
00175 void EraseContour(int i);
00176
00177 void createEmptyVectors();
00178 void clearAllVectors();
00179 void eraseContourVectorsContent();
00180
00181
00182 void set_points_disc ( PPPOINTAXE p ) { _points_disc = p; };
00183
00184 double getTotalLength();
00185 double getSubAxisLength();
00186 double getReferenceArea(kVolume* vol);
00187 double getReferenceAverDiam(kVolume* vol);
00188 double getAverageArea(int pIni, int pEnd, kVolume* vol);
00189
00193 void reset( );
00194 void copyFrom( const marObject& from );
00195
00199 bool save( std::ofstream& os );
00200 bool load( std::ifstream& is );
00201
00202 vtkPolyData *Draw( );
00203 vtkPolyData *GetAxisData();
00204 void Delete( );
00205 double* getPoints(int i) { return _points[i]; };
00206
00207 void AddPointToList(double x, double y, double z, int signal);
00208
00209
00210
00211 private:
00212
00213 double _totalAxisLenght;
00214 double _subAxisLenght;
00215 double _referenceArea;
00216 double _referenceAverDiam;
00217
00218 std::string _description;
00219 std::vector< double* > _points;
00220 std::vector< marContour* > _contours;
00221 std::vector< kVolume* > _slices;
00222 std::vector< vtkProbeFilter* > _3Dslices;
00223 std::vector< vtkPoints* > _3Dcontour;
00224 std::vector< vtkImageData* > _quantificationImages;
00225 std::vector< vtkPolyData* > _2Dcontours;
00226 std::vector< vtkPoints* > _2DDiameterMin;
00227 std::vector< vtkPoints* > _2DDiameterMax;
00228 std::vector< int > _signal;
00229 int _healthySlice;
00230 int _healthySliceStart;
00231 int _healthySliceEnd;
00232 int _startQuant;
00233 int _finishQuant;
00234 int _actualQuant;
00235 PPPOINTAXE _points_disc;
00236
00237 vtkPolyData* _allData;
00238
00239
00240
00241
00242
00243
00244
00245 void calculateTotalAxisLenght();
00246 void calculateSubAxisLength();
00247 void calculateReferenceArea(kVolume* vol );
00248 void calculateReferenceAverDiam(kVolume* vol );
00249 void createContour( int i , kVolume* vol );
00250 void createSlice( int i , kVolume* vol );
00251 void create3DSlice( int i , kVolume* vol );
00252 void create3Dcontour( int i , kVolume* vol );
00253 void createSliceImage( int i , kVolume* vol );
00254 void create2Dcontour( int i , kVolume* vol );
00255 void create2DDiameterMin(int i , kVolume* vol );
00256 void create2DDiameterMax(int i , kVolume* vol );
00257 double getAxisLenght( int pIni, int pEnd);
00258
00259
00260 protected:
00261
00262 std::vector <marAxisContours* > quantContours;
00263 std::vector <marPoint *> vesselPoints;
00264 std::vector <marIsocontour *> lumenContour;
00265 bool calibration;
00266
00267
00268
00269
00270
00271 };
00272
00273 #endif // __MAR__KERNEL__AXIS__HXX__