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 # ------------------------------------------------------------------------ */
28 * \author Eduardo Davila and Claire Mouton.
29 * \brief Class bbtk::ThresholdImageView.
30 * \date September 2012
33 #include "ColorLayerImageViewManager.h"
37 //=========================================================================
38 //=========================================================================
39 //=========================================================================
40 //=========================================================================
41 ColorLayerImageViewManager::ColorLayerImageViewManager( )
43 _colorLayerImageViewLst.push_back(NULL); // 0
44 _colorLayerImageViewLst.push_back(NULL); // 1
45 _colorLayerImageViewLst.push_back(NULL); // 2
48 //=========================================================================
49 ColorLayerImageViewManager::~ColorLayerImageViewManager()
52 //=========================================================================
56 //----------------------------------------------------------------------------
57 void ColorLayerImageViewManager::SetwxVtkBaseView(int id, wxVtkBaseView *baseview)
61 int size =_colorLayerImageViewLst.size();
62 if ( (id>=0) && (id<=size) )
64 if (_colorLayerImageViewLst[id]==NULL)
66 _colorLayerImageViewLst[id] = new ColorLayerImageView();
68 _colorLayerImageViewLst[id]->SetwxVtkBaseView(baseview);
75 wxVtkBaseView* ColorLayerImageViewManager::GetwxVtkBaseView(int id)
77 return _colorLayerImageViewLst[id]->GetwxVtkBaseView();
81 //----------------------------------------------------------------------------
82 void ColorLayerImageViewManager::SetX2(int x2)
84 int i, size=_colorLayerImageViewLst.size();
87 if (_colorLayerImageViewLst[i]!=NULL)
89 _colorLayerImageViewLst[i]->SetX2( x2 );
94 //----------------------------------------------------------------------------
95 void ColorLayerImageViewManager::SetY2(int y2)
97 int i, size=_colorLayerImageViewLst.size();
100 if (_colorLayerImageViewLst[i]!=NULL)
102 _colorLayerImageViewLst[i]->SetY2( y2 );
108 //----------------------------------------------------------------------------
109 void ColorLayerImageViewManager::SetZ2(int z2)
111 int i, size=_colorLayerImageViewLst.size();
114 if (_colorLayerImageViewLst[i]!=NULL)
116 _colorLayerImageViewLst[i]->SetZ2( z2 );
124 //----------------------------------------------------------------------------
125 int ColorLayerImageViewManager::GetX()
128 int i, size=_colorLayerImageViewLst.size();
131 if (_colorLayerImageViewLst[i]!=NULL)
133 result = _colorLayerImageViewLst[i]->GetX();
139 //----------------------------------------------------------------------------
140 int ColorLayerImageViewManager::GetY()
143 int i, size=_colorLayerImageViewLst.size();
146 if (_colorLayerImageViewLst[i]!=NULL)
148 result = _colorLayerImageViewLst[i]->GetY();
156 //----------------------------------------------------------------------------
157 int ColorLayerImageViewManager::GetZ() // virtual
160 int i, size=_colorLayerImageViewLst.size();
163 if (_colorLayerImageViewLst[i]!=NULL)
165 result = _colorLayerImageViewLst[i]->GetZ();
171 //----------------------------------------------------------------------------
172 void ColorLayerImageViewManager::SetBaseColors(std::vector<double> & base_color)
174 int i, size=_colorLayerImageViewLst.size();
177 if (_colorLayerImageViewLst[i]!=NULL)
179 _colorLayerImageViewLst[i]->SetBaseColors( base_color );
184 //----------------------------------------------------------------------------
185 void ColorLayerImageViewManager::SetBaseTransparence(std::vector<double> & base_transparence)
187 int i, size=_colorLayerImageViewLst.size();
190 if (_colorLayerImageViewLst[i]!=NULL)
192 _colorLayerImageViewLst[i]->SetBaseTransparence( base_transparence );
197 //----------------------------------------------------------------------------
198 void ColorLayerImageViewManager::SetRangeForColorBar(std::vector<double> &range)
200 int i, size=_colorLayerImageViewLst.size();
203 if (_colorLayerImageViewLst[i]!=NULL)
205 _colorLayerImageViewLst[i]->SetRangeForColorBar( range );
212 //----------------------------------------------------------------------------
213 double ColorLayerImageViewManager::GetBaseColors(unsigned int index)
216 int i, size=_colorLayerImageViewLst.size();
219 if (_colorLayerImageViewLst[i]!=NULL)
221 result = _colorLayerImageViewLst[i]->GetBaseColors( index );
227 //----------------------------------------------------------------------------
228 void ColorLayerImageViewManager::SetGreyLevelBoundaries(std::vector<double> & grey_level_boundary)
230 int i, size=_colorLayerImageViewLst.size();
233 if (_colorLayerImageViewLst[i]!=NULL)
235 _colorLayerImageViewLst[i]->SetGreyLevelBoundaries( grey_level_boundary );
240 //----------------------------------------------------------------------------
241 double ColorLayerImageViewManager::GetGreyLevelBoundaries(unsigned int index)
244 int i, size=_colorLayerImageViewLst.size();
247 if (_colorLayerImageViewLst[i]!=NULL)
249 result = _colorLayerImageViewLst[i]->GetGreyLevelBoundaries( index );
255 //----------------------------------------------------------------------------
256 void ColorLayerImageViewManager::SetPlainOrGradientColor(bool color_type)
258 int i, size=_colorLayerImageViewLst.size();
261 if (_colorLayerImageViewLst[i]!=NULL)
263 _colorLayerImageViewLst[i]->SetPlainOrGradientColor( color_type );
268 //----------------------------------------------------------------------------
269 int ColorLayerImageViewManager::GetBaseColorNb()
272 int i, size=_colorLayerImageViewLst.size();
275 if (_colorLayerImageViewLst[i]!=NULL)
277 result = _colorLayerImageViewLst[i]->GetBaseColorNb();
283 //----------------------------------------------------------------------------
284 void ColorLayerImageViewManager::Refresh()
286 int i, size=_colorLayerImageViewLst.size();
289 if (_colorLayerImageViewLst[i]!=NULL)
291 _colorLayerImageViewLst[i]->Refresh();
296 //----------------------------------------------------------------------------
297 void ColorLayerImageViewManager::onThreshold()
299 int i, size=_colorLayerImageViewLst.size();
302 if (_colorLayerImageViewLst[i]!=NULL)
304 _colorLayerImageViewLst[i]->onThreshold();
309 //----------------------------------------------------------------------------
310 void ColorLayerImageViewManager::onThresholdChange()
312 int i, size=_colorLayerImageViewLst.size();
315 if (_colorLayerImageViewLst[i]!=NULL)
317 _colorLayerImageViewLst[i]->onThresholdChange();
322 //----------------------------------------------------------------------------
323 void ColorLayerImageViewManager::onThresholdRemove()
325 int i, size=_colorLayerImageViewLst.size();
328 if (_colorLayerImageViewLst[i]!=NULL)
330 _colorLayerImageViewLst[i]->onThresholdRemove();
335 //----------------------------------------------------------------------------
336 void ColorLayerImageViewManager::onThresholdInterpolation(bool interpolation)
338 int i, size=_colorLayerImageViewLst.size();
341 if (_colorLayerImageViewLst[i]!=NULL)
343 _colorLayerImageViewLst[i]->onThresholdInterpolation( interpolation );
348 //----------------------------------------------------------------------------
349 void ColorLayerImageViewManager::SetSliceFixDynamic( bool fixdyn )
351 int i, size=_colorLayerImageViewLst.size();
354 if (_colorLayerImageViewLst[i]!=NULL)
356 _colorLayerImageViewLst[i]->SetSliceFixDynamic( fixdyn );
361 //----------------------------------------------------------------------------
362 void ColorLayerImageViewManager::onThresholdChangeOpacity( int opacity)
364 int i, size=_colorLayerImageViewLst.size();
367 if (_colorLayerImageViewLst[i]!=NULL)
369 _colorLayerImageViewLst[i]->onThresholdChangeOpacity( opacity );
374 //----------------------------------------------------------------------------
375 void ColorLayerImageViewManager::SetImage( vtkImageData* img )
377 int i, size=_colorLayerImageViewLst.size();
380 if (_colorLayerImageViewLst[i]!=NULL)
382 _colorLayerImageViewLst[i]->SetImage( img );
387 //----------------------------------------------------------------------------
388 vtkImageData* ColorLayerImageViewManager::GetImageChangeInformation(int id)
390 if (_colorLayerImageViewLst[id]!=NULL)
392 return _colorLayerImageViewLst[id]->GetImage( );
397 //----------------------------------------------------------------------------
398 void ColorLayerImageViewManager::GetDimensionBase(int id,int *dim)
400 if (_colorLayerImageViewLst[id]!=NULL)
402 _colorLayerImageViewLst[id]->GetDimensionBase( dim );
406 //----------------------------------------------------------------------------
407 void ColorLayerImageViewManager::GetSpcBase(int id,double *spc)
409 if (_colorLayerImageViewLst[id]!=NULL)
411 _colorLayerImageViewLst[id]->GetSpcBase( spc );
415 //----------------------------------------------------------------------------
416 void ColorLayerImageViewManager::GetDimensionOriginalLayer(int id,int *dim)
418 if (_colorLayerImageViewLst[id]!=NULL)
420 _colorLayerImageViewLst[id]->GetDimensionOriginalLayer( dim );
424 //----------------------------------------------------------------------------
425 void ColorLayerImageViewManager::GetSpcOriginalLayer(int id,double *spc)
427 if (_colorLayerImageViewLst[id]!=NULL)
429 _colorLayerImageViewLst[id]->GetSpcOriginalLayer( spc );
433 //----------------------------------------------------------------------------
434 //----------------------------------------------------------------------------
435 void ColorLayerImageViewManager::SetNewSpacingLayer(double *spc)
437 int i, size=_colorLayerImageViewLst.size();
440 if (_colorLayerImageViewLst[i]!=NULL)
442 _colorLayerImageViewLst[i]->SetNewSpacingLayer( spc );