]> Creatis software - creaRigidRegistration.git/blob - lib/Substraction.h
#3466 vtk9itk5wx3-macos
[creaRigidRegistration.git] / lib / Substraction.h
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5 #                        pour la Santé)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 #
10 #  This software is governed by the CeCILL-B license under French law and 
11 #  abiding by the rules of distribution of free software. You can  use, 
12 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
13 #  license as circulated by CEA, CNRS and INRIA at the following URL 
14 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
15 #  or in the file LICENSE.txt.
16 #
17 #  As a counterpart to the access to the source code and  rights to copy,
18 #  modify and redistribute granted by the license, users are provided only
19 #  with a limited warranty  and the software's author,  the holder of the
20 #  economic rights,  and the successive licensors  have only  limited
21 #  liability. 
22 #
23 #  The fact that you are presently reading this means that you have had
24 #  knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------      */                                                                    
26
27 #include <vtkVersionMacros.h>
28 #include "vtkImageData.h"
29
30 #include <string>
31 #include <vector>
32
33 class Substraction 
34 {
35
36         //----------------------------------------------------------------------------------------
37         // Methods definition
38         //----------------------------------------------------------------------------------------
39         public:
40         //--------------------------
41         //Constructor & Destructor
42         //--------------------------            
43                 Substraction(vtkImageData* imageData1, vtkImageData* imageData2, int uZLevel,int lZLevel, std::vector<double> uColor, std::vector<double> lColor, std::vector<double> mColor);
44                 ~Substraction();
45         //--------------------------
46         //Methods
47         //--------------------------
48                 /*
49                 getting ready the points
50                 */
51                 void initialize(int dimensions[],double spacing[]);
52                 /*
53                 Calculate the new image and save it in the attribute imageResult
54                 it is used if the user had given the imageData
55                 */
56                 void substractImage(vtkImageData* imageData1, vtkImageData* imageData2);
57                 
58                 /*
59                 Returns the ImageResult
60                 */
61                 vtkImageData* getSubstractedImage();
62                 
63                 /*
64                  Get Image Size
65                 */
66                 int getImageSize();
67                 
68                 /*
69                 constructing image substract
70                 */
71                 void substract(vtkImageData* imageData1, vtkImageData* imageData2);
72
73                 /*
74                 Template method of substract for different image types
75                 */
76                 template <class T> void substractByType(T* dataImagePointer1, T* dataImagePointer2, T* dataImageResultPointer, vtkImageData *imageData1, vtkImageData *imageData2);
77                 
78
79
80         //----------------------------------------------------------------------------------------
81         // Attributes declaration
82         //----------------------------------------------------------------------------------------
83         private: 
84                 /*
85                  Substracted Image
86                 */
87                 vtkImageData* imageResult;
88                 /*
89                  image size dimx*dimy*dimz
90                 */
91                 int sizeImage;
92                 /*
93                 upper zero level for doing the Substraction
94                 */
95                 int uZeroLevel;
96                 /*
97                 lower zero level for doing the Substraction
98                 */
99                 int lZeroLevel;
100                 /*
101                 Color for the upper threshold
102                 */
103                 int upperColor[3];
104                 /*
105                 Color for the lower threshold
106                 */
107                 int lowerColor[3];
108                 /*
109                 Color for the medium threshold
110                 */
111                 int mediumColor[3];
112                 /*
113                 Image type
114                 */
115                 int imageType;
116 };
117