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 bool if3DcontourExist(int i);
00160 void Save3Dcontour(FILE *ff,int i);
00161 void SaveExisting3DContours(FILE *ff);
00162
00163 marContour* getContour( int i , kVolume* vol );
00164 kVolume* getSlice( int i , kVolume* vol );
00165 vtkProbeFilter* get3DSlice( int i , kVolume* vol );
00166 vtkPoints* get3Dcontour( int i , kVolume* vol );
00167 vtkImageData* getSliceImage( int i , kVolume* vol );
00168 vtkPolyData* get2Dcontour( int i , kVolume* vol );
00169 vtkPoints* get2DDiameterMin( int i , kVolume* vol );
00170 vtkPoints* get2DDiameterMax( int i , kVolume* vol );
00171
00172 void replaceContour2D(int i,int size,double *vx,double *vy);
00173 void EraseContour(int i);
00174
00175 void createEmptyVectors();
00176 void clearAllVectors();
00177 void eraseContourVectorsContent();
00178
00179
00180 void set_points_disc ( PPPOINTAXE p ) { _points_disc = p; };
00181
00182 double getTotalLength();
00183 double getSubAxisLength();
00184 double getReferenceArea(kVolume* vol);
00185 double getReferenceAverDiam(kVolume* vol);
00186 double getAverageArea(int pIni, int pEnd, kVolume* vol);
00187
00191 void reset( );
00192 void copyFrom( const marObject& from );
00193
00197 bool save( std::ofstream& os );
00198 bool load( std::ifstream& is );
00199
00200 vtkPolyData *Draw( );
00201 vtkPolyData *GetAxisData();
00202 void Delete( );
00203 double* getPoints(int i) { return _points[i]; };
00204
00205 void AddPointToList(double x, double y, double z, int signal);
00206
00207
00208
00209 private:
00210
00211 double _totalAxisLenght;
00212 double _subAxisLenght;
00213 double _referenceArea;
00214 double _referenceAverDiam;
00215
00216 std::string _description;
00217 std::vector< double* > _points;
00218 std::vector< marContour* > _contours;
00219 std::vector< kVolume* > _slices;
00220 std::vector< vtkProbeFilter* > _3Dslices;
00221 std::vector< vtkPoints* > _3Dcontour;
00222 std::vector< vtkImageData* > _quantificationImages;
00223 std::vector< vtkPolyData* > _2Dcontours;
00224 std::vector< vtkPoints* > _2DDiameterMin;
00225 std::vector< vtkPoints* > _2DDiameterMax;
00226 std::vector< int > _signal;
00227 int _healthySlice;
00228 int _healthySliceStart;
00229 int _healthySliceEnd;
00230 int _startQuant;
00231 int _finishQuant;
00232 int _actualQuant;
00233 PPPOINTAXE _points_disc;
00234
00235 vtkPolyData* _allData;
00236
00237
00238
00239
00240
00241
00242
00243 void calculateTotalAxisLenght();
00244 void calculateSubAxisLength();
00245 void calculateReferenceArea(kVolume* vol );
00246 void calculateReferenceAverDiam(kVolume* vol );
00247 void createContour( int i , kVolume* vol );
00248 void createSlice( int i , kVolume* vol );
00249 void create3DSlice( int i , kVolume* vol );
00250 void create3Dcontour( int i , kVolume* vol );
00251 void createSliceImage( int i , kVolume* vol );
00252 void create2Dcontour( int i , kVolume* vol );
00253 void create2DDiameterMin(int i , kVolume* vol );
00254 void create2DDiameterMax(int i , kVolume* vol );
00255 double getAxisLenght( int pIni, int pEnd);
00256
00257
00258 protected:
00259
00260 std::vector <marAxisContours* > quantContours;
00261 std::vector <marPoint *> vesselPoints;
00262 std::vector <marIsocontour *> lumenContour;
00263 bool calibration;
00264
00265
00266
00267
00268
00269 };
00270
00271 #endif // __MAR__KERNEL__AXIS__HXX__