]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/kernel/include/marExperiment.h
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / kernel / include / marExperiment.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   Program:   wxMaracas
29   Module:    $RCSfile: marExperiment.h,v $
30   Language:  C++
31   Date:      $Date: 2012/11/15 14:15:31 $
32   Version:   $Revision: 1.2 $
33
34   Copyright: (c) 2002, 2003
35   License:
36   
37      This software is distributed WITHOUT ANY WARRANTY; without even 
38      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
39      PURPOSE.  See the above copyright notice for more information.
40
41 =========================================================================*/
42 #ifndef __MAR__KERNEL__EXPERIMENT__HXX__
43 #define __MAR__KERNEL__EXPERIMENT__HXX__
44
45 #include <vector>
46 #include "volume.hxx"
47 #include "marAxis.h"
48 #include "marDynData.h"
49 #include "GestionBifurcations.h"
50
51 class MAR_KERNEL_EXPORT marExperiment : public marObject
52 {
53
54 public:
55
56   marExperiment( marParameters* p = NULL );
57   ~marExperiment( );
58
59   wxString& getDescription( ) { return( _description ); };
60   void setDescription( wxString& d )    { _description = d; };
61
62   marDynData* getDynData( )     { return( _dynData ); };
63
64   void getVOI( int* voi ) { memcpy( voi, _voi, sizeof( int ) * 6 ); };
65   void setVOI( int* voi ) { memcpy( _voi, voi, sizeof( int ) * 6 ); };
66
67   void initExperiment( kVolume* volume );
68
69   void setStartPoint( int* sp )
70   {
71     setStartPoint( sp[ 0 ], sp[ 1 ], sp[ 2 ] );
72   }
73
74   void setStartPoint( int sx, int sy, int sz );
75   void extractVascularTree( int sens = 1, double *vit=NULL, int cleanLevel=0 );
76   void DeleteAxis ( unsigned int index );
77
78 //  marContour* generateContour( int slice, int x, int y, std::vector< double* >* points);
79   vtkPolyData* generateContour( int slice, int x, int y, std::vector< double* >* points);
80
81   void applyChangeResolution( );
82
83   int getNumberOfAxes( )
84   {
85     return( _axes.size( ) - 1 );
86   };
87
88   marAxis* getAxis( int i = -1 ) 
89   { 
90     return( _axes[ i + 1 ] ); 
91   };
92
93   void appendAxis( marAxis* ax )
94   {
95     _axes.push_back( ax );
96     _axes[ 0 ] = ax;
97   }
98
99   void setAxis( int i )
100   {
101     _axes[ 0 ] = _axes[ i + 1 ];
102   }
103
104   int   getQuantStart( )  { return _axes[0]->getStartQuant( );};
105   int   getQuantFinish( ) { return _axes[0]->getFinishQuant( );};
106   void  backQuant( );
107
108   void prepareQuantification( );
109
110   marContour*           getContour( int i )                     { return(_axes[0]->getContour           ( i ,  _dynData->getVolume( )  ));      };
111   vtkImageData*         getSliceImage( int i )          { return(_axes[0]->getSliceImage        ( i ,  _dynData->getVolume( )  ));      };
112   vtkProbeFilter*       get3DSlice( int i )                     { return(_axes[0]->get3DSlice           ( i ,  _dynData->getVolume( )  ));      };
113   vtkPoints*            get3Dcontour( int i )           { return(_axes[0]->get3Dcontour         ( i ,  _dynData->getVolume( )  ));      };
114   vtkPolyData*          get2Dcontour( int i )           { return(_axes[0]->get2Dcontour         ( i ,  _dynData->getVolume( )  ));      };
115   vtkPoints*            get2DDiameterMin( int i )       { return(_axes[0]->get2DDiameterMin     ( i ,  _dynData->getVolume( )  ));      };
116   vtkPoints*            get2DDiameterMax( int i )       { return(_axes[0]->get2DDiameterMax     ( i ,  _dynData->getVolume( )  ));      };
117   double                        getTotalLength()                        { return _axes[0]->getTotalLength() * _dynData->getActualVoxel() ;              };
118   double                        getSubAxisLength()                      { return _axes[0]->getSubAxisLength() * _dynData->getActualVoxel();             };
119   double                        getReferenceArea()                      { return _axes[0]->getReferenceArea( _dynData->getVolume( ));                   };
120   double                        getReferenceAverDiam()          { return _axes[0]->getReferenceAverDiam( _dynData->getVolume( ));               };
121
122   double                        getAverageArea(int pIni, int pEnd) {return _axes[0]->getAverageArea(pIni,pEnd, _dynData->getVolume( ) );                };
123   int                           getNumberOfSlices( )            { return _axes[0]->getNumberOfContours();                                                               };
124
125   void calculateAxesSignal( );
126   void prepareContourImages( );
127
128   void ClearContours();
129   void RegenerateAxis();
130   void RegenerateSignal();
131   void RecalculateAxis();
132
133   //General methods.
134   void reset( );
135   void copyFrom( const marObject& from );
136
137   //Persistence methods.
138   bool save( std::ofstream& os );
139   bool load( std::ifstream& is );
140
141 private:
142
143   wxString _description;
144   marDynData* _dynData;
145   int _voi[ 6 ];
146   int _startPoint[ 3 ];
147
148   std::vector< marAxis* > _axes;
149 };
150
151 #endif // __MAR__KERNEL__EXPERIMENT__HXX__