marAxis.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   wxMaracas
00004   Module:    $RCSfile: marAxis.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009/05/14 13:55:07 $
00007   Version:   $Revision: 1.1 $
00008 
00009   Copyright: (c) 2002, 2003
00010   License:
00011   
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notice for more information.
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 //In an ideal future we should get rid of gslobj to get rid of gsl...
00026 // PS -> //#include "gslobj.hxx" //PS
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 // EED Ojo eduardo esto toca borrarlo
00141   void sliceVolumeAxis( kVolume* vol, bool forceCnt = true );
00142 
00143   double* getNormal( unsigned int slice );
00144 
00145   int getNumberOfContours( );
00146   int getNumberOfSplinePoints( );
00147 
00148 // EED Ojo Eduardo esto toca redefinirlo o partilo en dos o algo..
00149 //  vtkPolyData* setContour( int i, int x = -1, int y = -1,  std::vector< double* >* points =  NULL, marContour* c = NULL );
00150 
00151 // EED borrame
00152 /*
00153   marContour* getContour( int i ) { return( _contours[ i ] ); };
00154   kVolume* getSlice( int i ) { return( _slices[ i ] ); };
00155   vtkProbeFilter* get3DSlice( int i ) { return( _3Dslices[ i ] ); };
00156   vtkImageData* getSliceImage( int i ) { return(_quantificationImages[ i ]);  };
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 );         // DATA-MODEL-2D  
00166   kVolume*                      getSlice(               int i , kVolume* vol );         // DATA-MODEL-Voxel XxYx1
00167   vtkProbeFilter*       get3DSlice(             int i , kVolume* vol );         // VISUALISATION-VTK 3D
00168   vtkPoints*            get3Dcontour(   int i , kVolume* vol );         // VISUALISATION-VTK 3D
00169   vtkImageData*         getSliceImage(  int i , kVolume* vol );         // VISUALISATION-VTK 2D
00170   vtkPolyData*          get2Dcontour(   int i , kVolume* vol );         // VISUALISATION-VTK 2D
00171   vtkPoints*            get2DDiameterMin(       int i , kVolume* vol );         // VISUALISATION-VTK 3D
00172   vtkPoints*            get2DDiameterMax(       int i , kVolume* vol );         // VISUALISATION-VTK 3D
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;                           //  Axis description
00219   std::vector< double* >                        _points;                                        //  Axis spline points
00220   std::vector< marContour* >            _contours;                                      //  DATA-MODEL-2D                       Axis Contours
00221   std::vector< kVolume* >                       _slices;                                        //  DATA-MODEL-Voxel XxYx1      Axis perpendicular Slice
00222   std::vector< vtkProbeFilter* >        _3Dslices;                                      //  VISUALISATION_VTK 3D        Axis perpendicular Slice
00223   std::vector< vtkPoints* >                     _3Dcontour;                                     //  VISUALISATION_VTK 3D        Axis perpendicular Contour
00224   std::vector< vtkImageData* >          _quantificationImages;          //  VISUALISATION_VTK 2D    Axis perpendicular Coup
00225   std::vector< vtkPolyData* >           _2Dcontours;                            //  VISUALISATION_VTK 2D        Axis perpendicular Contour
00226   std::vector< vtkPoints* >                     _2DDiameterMin;                         //  VISUALISATION_VTK 2D        Line diameter Minimum
00227   std::vector< vtkPoints* >                     _2DDiameterMax;                         //  VISUALISATION_VTK 2D        Line diameter Maximum
00228   std::vector< int >                            _signal;                                        //  Axis intensity signal
00229   int _healthySlice;                     //  Healthy slice, if -1 then is unselected
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   // Properties from marObject
00240   //marParameters* _parameters;
00241 
00242   // Properties from kCurve
00243   // std::vector< double* > _controlPoints; //  Axis calculated points
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 //  std::vector <marIsocontour* > pointContours;
00269   
00270 
00271 };
00272 
00273 #endif // __MAR__KERNEL__AXIS__HXX__

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1