1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
26 #include "vtkBaseData.h"
28 //-------------------------------------------------------------------
29 vtkBaseData::vtkBaseData()
37 _observable = vtkObject::New();
38 _cameraparallelScale = 100.0;
44 //-------------------------------------------------------------------
45 vtkBaseData::~vtkBaseData()
49 //-------------------------------------------------------------------
50 void vtkBaseData::SetMarImageData(marImageData *marimagedata)
52 _marImageData = marimagedata;
56 //-------------------------------------------------------------------
57 vtkImageData* vtkBaseData::GetImageData()
61 return _marImageData->GetImageDataT(_t);
68 //-------------------------------------------------------------------
69 marImageData* vtkBaseData::GetMarImageData()
74 //-------------------------------------------------------------------
76 void vtkBaseData::Configure() // virtual
78 vtkImageData* imageData = _marImageData->GetImageData();
82 imageData->GetScalarRange(range);
85 //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( (range[1]-range[0])/2 );
86 //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( (range[1]+range[0])/4 );
87 SetColorWindow( (range[1]-range[0])/2 );
88 SetColorLevel( (range[1]+range[0])/4 );
91 //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( 1000 );
92 //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( 500 );
93 SetColorWindow( 1000 );
100 //-------------------------------------------------------------------
101 void vtkBaseData::SetZ(double z)
107 // _marImageData->GetDimensions(dim);
114 vtkImageData* img = _marImageData->GetImageData();
116 /*img->GetWholeExtent(ext);
117 maxZ=ext[5]-ext[4]+1;
130 origin = img->GetOrigin();
133 z = ext[5] + origin[2];
137 z = ext[4] + origin[2];
141 _observable->InvokeEvent(3);
145 //-------------------------------------------------------------------
146 double vtkBaseData::GetZ()
151 //-------------------------------------------------------------------
152 int vtkBaseData::GetT()
157 //-------------------------------------------------------------------
158 double vtkBaseData::GetX() // virtual
162 //-------------------------------------------------------------------
163 double vtkBaseData::GetY() // virtual
169 //-------------------------------------------------------------------
170 void vtkBaseData::SetT(double t)
172 int maxT = _marImageData->GetMaxT();
184 //-------------------------------------------------------------------
185 void vtkBaseData::SetColorWindow(double colorWindow)
187 _colorWindow = colorWindow;
190 //-------------------------------------------------------------------
191 void vtkBaseData::SetColorLevel(double colorLevel)
193 _colorLevel=colorLevel;
196 //-------------------------------------------------------------------
197 double vtkBaseData::GetColorWindow()
202 //-------------------------------------------------------------------
203 double vtkBaseData::GetColorLevel()
209 //-------------------------------------------------------------------
210 void vtkBaseData::AddObserver(int eventNumber, vtkCommand *observer)
212 _observable->AddObserver( eventNumber , observer );
216 //-------------------------------------------------------------------
217 bool vtkBaseData::GetInterpolate()
222 //-------------------------------------------------------------------
223 void vtkBaseData::SetInterpolate(bool value)
225 _interpolate = value;
228 //-------------------------------------------------------------------
229 bool vtkBaseData::GetFixAxis2D()
234 //-------------------------------------------------------------------
235 void vtkBaseData::SetFixAxis2D(bool value)
240 //-------------------------------------------------------------------
241 double vtkBaseData::GetOpacityAxis()
246 //-------------------------------------------------------------------
247 void vtkBaseData::SetOpacityAxis(double value)
249 _opacityAxis = value;
252 //-------------------------------------------------------------------
253 double vtkBaseData::GetCameraParallelScale()
255 return _cameraparallelScale;
258 //-------------------------------------------------------------------
259 void vtkBaseData::SetCameraParallelScale(double value)
261 _cameraparallelScale=value;
264 //-------------------------------------------------------------------
265 void vtkBaseData::SetPointMouse(int x, int y , int z)
272 //-------------------------------------------------------------------
273 void vtkBaseData::GetPointMouse(int &x, int &y , int &z)