]> Creatis software - creaContours.git/blob - lib/kernel_ManagerContour_NDimensions/ImageSourceThing.cxx
Feature #1772 Add licence terms for all files.
[creaContours.git] / lib / kernel_ManagerContour_NDimensions / ImageSourceThing.cxx
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 // Class definition include
29 //----------------------------------------------------------------------------------------------------------------
30 #include "ImageSourceThing.h"
31
32 //----------------------------------------------------------------------------------------------------------------
33 // Class implementation
34 //----------------------------------------------------------------------------------------------------------------
35 /** @file ImageSourceThing.cxx */
36
37 //------------------------------------------------------------------------------------------------------------
38 // Constructors & Destructors
39 //------------------------------------------------------------------------------------------------------------
40
41         /*
42         * Creates the source image with the given parameter
43         * @param sourceImage The image source to set.
44         */
45         ImageSourceThing :: ImageSourceThing(vtkImageData * theSource)
46         {
47                 setSourceImage(theSource);
48         }
49
50         /*
51         * Destroys the image source
52         */
53         ImageSourceThing :: ~ImageSourceThing()
54         {
55
56         }
57 //------------------------------------------------------------------------------------------------------------
58 // Methods
59 //------------------------------------------------------------------------------------------------------------
60
61         /*
62         * Gets the source image 
63         * @return sourceImage The image source.
64         */
65         vtkImageData * ImageSourceThing :: getSourceImage()
66         {
67                 return sourceImage;
68         }
69
70         /*
71         * Sets the source image 
72         * @param sourceImage The image source.
73         */
74         void ImageSourceThing :: setSourceImage( vtkImageData *  theSource)
75         {
76                 sourceImage = theSource;
77         }
78    
79    /**
80         * Gets the max value of the x-axis
81         * @return x-extend_MAX
82         */
83         int ImageSourceThing :: getMax_X()
84         { 
85                 int x1, x2, y1, y2, z1, z2;
86                 sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
87                 return x2;
88         }
89
90         /**
91         * Gets the min value of the x-axis
92         * @return x-extend_MIN
93         */
94         int ImageSourceThing :: getMin_X()
95         { 
96                 int x1, x2, y1, y2, z1, z2;
97                 sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
98                 return x1;
99         }
100
101         /**
102         * Gets the range values of the x-axis
103         * @return x-extend pointer to a 2 sized []
104         */
105         int * ImageSourceThing :: getRangeX()
106         {
107                 int x1, x2, y1, y2, z1, z2;
108                 sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
109                 int* retVal = new int[2];
110                 retVal[0]= x1;
111                 retVal[1]= x2;
112                 return retVal;
113         }
114
115         /**
116         * Gets the max value of the y-axis
117         * @return y-extend_MAX
118         */
119         int ImageSourceThing :: getMax_Y()
120         {
121                 int x1, x2, y1, y2, z1, z2;
122                 sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
123                 return y2;
124         }
125
126         /**
127         * Gets the min value of the y-axis
128         * @return y-extend_MIN
129         */
130         int ImageSourceThing :: getMin_Y()
131         {
132                 int x1, x2, y1, y2, z1, z2;
133                 sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
134                 return y1;
135         }
136
137         
138         /**
139         * Gets the range values of the y-axis
140         * @return y-extend pointer to a 2 sized []
141         */
142         int * ImageSourceThing :: getRangeY()
143         { 
144                 int x1, x2, y1, y2, z1, z2;
145                 sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
146                 int* retVal = new int[2];
147                 retVal[0]= y1;
148                 retVal[1]= y2;
149                 return retVal;
150
151         }
152
153         /**
154         * Gets the max value of the z-axis
155         * @return z-extend_MAX
156         */
157         int ImageSourceThing :: getMax_Z()
158         {
159                 int x1, x2, y1, y2, z1, z2;
160                 sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
161                 return z2;
162         }
163
164         /**
165         * Gets the min value of the z-axis
166         * @return z-extend_MIN
167         */
168         int ImageSourceThing :: getMin_Z()
169         { 
170                 int x1, x2, y1, y2, z1, z2;
171                 sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
172                 return z1;
173         }
174
175         
176         /**
177         * Gets the range values of the z-axis
178         * @return z-extend pointer to a 2 sized []
179         */
180         int * ImageSourceThing :: getRangeZ()
181         { 
182                 int x1, x2, y1, y2, z1, z2;
183                 sourceImage ->GetExtent( x1, x2, y1, y2, z1, z2);
184                 int* retVal = new int[2];
185                 retVal[0]= z1;
186                 retVal[1]= z2;
187                 return retVal;
188
189
190         }
191
192         
193         /**
194         * Gets the range values of the x-axis
195         * @return x-extend pointer to a 6 sized []
196         */
197         int * ImageSourceThing :: getAllRanges()
198         { 
199                 return sourceImage-> GetExtent();
200         }