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;
41 //-------------------------------------------------------------------
42 vtkBaseData::~vtkBaseData()
46 //-------------------------------------------------------------------
47 void vtkBaseData::SetMarImageData(marImageData *marimagedata)
49 _marImageData = marimagedata;
53 //-------------------------------------------------------------------
54 vtkImageData* vtkBaseData::GetImageData()
58 return _marImageData->GetImageDataT(_t);
65 //-------------------------------------------------------------------
66 marImageData* vtkBaseData::GetMarImageData()
71 //-------------------------------------------------------------------
73 void vtkBaseData::Configure() // virtual
75 vtkImageData* imageData = _marImageData->GetImageData();
79 imageData->GetScalarRange(range);
82 //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( (range[1]-range[0])/2 );
83 //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( (range[1]+range[0])/4 );
84 SetColorWindow( (range[1]-range[0])/2 );
85 SetColorLevel( (range[1]+range[0])/4 );
88 //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( 1000 );
89 //_imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( 500 );
90 SetColorWindow( 1000 );
97 //-------------------------------------------------------------------
98 void vtkBaseData::SetZ(double z)
104 // _marImageData->GetDimensions(dim);
111 vtkImageData* img = _marImageData->GetImageData();
113 /*img->GetWholeExtent(ext);
114 maxZ=ext[5]-ext[4]+1;
127 origin = img->GetOrigin();
130 z = ext[5] + origin[2];
134 z = ext[4] + origin[2];
138 _observable->InvokeEvent(3);
142 //-------------------------------------------------------------------
143 double vtkBaseData::GetZ()
148 //-------------------------------------------------------------------
149 int vtkBaseData::GetT()
154 //-------------------------------------------------------------------
155 void vtkBaseData::SetT(double t)
157 int maxT = _marImageData->GetMaxT();
169 //-------------------------------------------------------------------
170 void vtkBaseData::SetColorWindow(double colorWindow)
172 _colorWindow = colorWindow;
175 //-------------------------------------------------------------------
176 void vtkBaseData::SetColorLevel(double colorLevel)
178 _colorLevel=colorLevel;
181 //-------------------------------------------------------------------
182 double vtkBaseData::GetColorWindow()
187 //-------------------------------------------------------------------
188 double vtkBaseData::GetColorLevel()
194 //-------------------------------------------------------------------
195 void vtkBaseData::AddObserver(int eventNumber, vtkCommand *observer)
197 _observable->AddObserver( eventNumber , observer );
201 //-------------------------------------------------------------------
202 bool vtkBaseData::GetInterpolate()
207 //-------------------------------------------------------------------
208 void vtkBaseData::SetInterpolate(bool value)
210 _interpolate = value;
213 //-------------------------------------------------------------------
214 bool vtkBaseData::GetFixAxis2D()
219 //-------------------------------------------------------------------
220 void vtkBaseData::SetFixAxis2D(bool value)
225 //-------------------------------------------------------------------
226 double vtkBaseData::GetOpacityAxis()
231 //-------------------------------------------------------------------
232 void vtkBaseData::SetOpacityAxis(double value)
234 _opacityAxis = value;
237 //-------------------------------------------------------------------
238 double vtkBaseData::GetCameraParallelScale()
240 return _cameraparallelScale;
243 //-------------------------------------------------------------------
244 void vtkBaseData::SetCameraParallelScale(double value)
246 _cameraparallelScale=value;