]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.h
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / Contour / ContourExtractData.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 #ifndef __ContourExtractData_h_INCLUDED_H__
27 #define __ContourExtractData_h_INCLUDED_H__
28
29
30 #include "manualContourModel.h"
31 #include "marTypes.h"
32
33
34   //--------------------------------------------------------------------------
35   class creaMaracasVisu_EXPORT ContourExtractData 
36   {
37   public:
38         ContourExtractData(bool imagesResults=false);
39     ~ContourExtractData();
40
41 //----------------------------------------------------------------------
42         void SetImage( vtkImageData* imagedata);
43         void SetZtoBeAnalys( int z );
44
45         void SetLstManualContourModel( std::vector<manualBaseModel*> lstManConMod);
46         void GetValuesInsideCrown(      int *numberOfPixels,
47                                                                 std::vector<double> *pLstValue,
48                                                                 std::vector<double> *pLstValuePosX,
49                                                                 std::vector<double> *pLstValuePosY,
50                                                                 std::vector<double> *pLstValuePosZ);
51
52         void CalculateImageResult();
53         vtkImageData *GetVtkImageValueResult();
54         vtkImageData *GetVtkImageMaskResult();
55         void Statistics( std::vector<double> *inputLstValue, 
56                                         int     grayRangeMin,
57                                         int     grayRangeMax,
58                                         int             *rCountRange, 
59                                         int             *rsize, 
60                                         double  *rmin, 
61                                         double  *rmax,
62                                         double  *raverage,
63                                         double  *rstandardeviation);
64         void SetTypeOperation(int type);
65
66           //--Volume Statistics--
67           void InitVolumeStatistics();
68           void GetVolumeStatistics(int *vol_rCountRange, int *vol_rsize,
69                                                                 double *vol_minValue, double *vol_maxValue,
70                                                                 double *vol_average, double *vol_standardeviation);
71           
72           void ResetImageResult(int z);
73           void SetScalarRange(double min, double max);
74           void InitLstContoursLinesYPoints();
75           bool isInside(int x, int y, int typeOperation );
76         
77           //
78           // Asigns the sizeImageY.
79           // @param pSizeImageY - int
80           void SetSizeImageY(int pSizeImageY);
81           
82   private:
83         double                                                          scalarRange[2];
84         bool                                                            okImagesResults;
85
86         //
87         // List of contours to obtain the respective statistics.
88         //
89         std::vector<manualBaseModel*>   lstManConMod;
90
91         //
92         // Operation Type (AND,OR,XOR...)
93         //
94         int                                                                     _typeOperation;
95
96         int                                                                     zImage;
97         vtkImageData                                            *imagedata;
98         vtkImageData                                            *imagedataValueResult;
99         vtkImageData                                            *imagedataMaskResult;
100
101         //Size Y
102         int _sizeImageY;
103         
104         //
105         // Asigns the minimum and maximum points of the contour model in parameter.
106         // @param *minPoint - int
107         // @param *maxPoint - int
108         // @param *manualcontourmodel - manualBaseModel
109         //
110         void GetMinMaxPoint(int *minPoint, 
111                                                 int *maxPoint, 
112                                                 manualBaseModel *manualcontourmodel );
113         //
114         // Obtain the minimum and maximum point among the contours. The value is saved in the parameter
115         // pointers
116         // @param *minPoint - int pointer to the minPoint
117         // @param *maxPoint - int pointer to the maxPoint
118         //
119         void GetMinMaxPoint_Of_LstManConMod(    int *minPoint, 
120                                                                                         int *maxPoint);
121
122         int AnalisisContourInsideV2(int x, int y, int iContour );
123           
124         double GetDataValue(int x, int y, int z);
125         void PutVtkImageDataResultValue( int x, int y,int z, double value );
126         void InitVtkImagesResult();
127
128           //--Volume Statistics--
129           int           vol_rCountRange;
130           int           vol_rsize;
131           double        vol_minValue;
132           double        vol_maxValue;
133           double        vol_acum_average;
134           double        vol_acum_standardeviation;
135           void SetVolumeStatistics(int rCountRange, int rsize,
136                                                            double minValue,double maxValue,
137                                                            double acum_average, double acum_standardeviation);
138           
139           // Optimize IsInside
140           // List of contours , list of linesY, list of points over the line
141           std::vector< std::vector< std::vector<double> > >             _lstlstlstVecX1;
142           std::vector< std::vector< std::vector<double> > >             _lstlstlstVecY1;
143           std::vector< std::vector< std::vector<double> > >             _lstlstlstVecX2;
144           std::vector< std::vector< std::vector<double> > >             _lstlstlstVecY2;
145           void Fill_lstlstlstVecXY(int iContour, int sizeY);
146           
147
148
149   };
150
151
152 #endif  // __ContourExtractData_h_INCLUDED_H__
153