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 );
210 //----------------------------------------------------------------------------
211 void ColorLayerImageViewManager::SetColorBarPosition(std::vector<int> &colorbarposition)
213 int i, size=_colorLayerImageViewLst.size();
216 if (_colorLayerImageViewLst[i]!=NULL)
218 _colorLayerImageViewLst[i]->SetColorBarPosition( colorbarposition );
226 //----------------------------------------------------------------------------
227 double ColorLayerImageViewManager::GetBaseColors(unsigned int index)
230 int i, size=_colorLayerImageViewLst.size();
233 if (_colorLayerImageViewLst[i]!=NULL)
235 result = _colorLayerImageViewLst[i]->GetBaseColors( index );
241 //----------------------------------------------------------------------------
242 void ColorLayerImageViewManager::SetGreyLevelBoundaries(std::vector<double> & grey_level_boundary)
244 int i, size=_colorLayerImageViewLst.size();
247 if (_colorLayerImageViewLst[i]!=NULL)
249 _colorLayerImageViewLst[i]->SetGreyLevelBoundaries( grey_level_boundary );
254 //----------------------------------------------------------------------------
255 double ColorLayerImageViewManager::GetGreyLevelBoundaries(unsigned int index)
258 int i, size=_colorLayerImageViewLst.size();
261 if (_colorLayerImageViewLst[i]!=NULL)
263 result = _colorLayerImageViewLst[i]->GetGreyLevelBoundaries( index );
269 //----------------------------------------------------------------------------
270 void ColorLayerImageViewManager::SetPlainOrGradientColor(bool color_type)
272 int i, size=_colorLayerImageViewLst.size();
275 if (_colorLayerImageViewLst[i]!=NULL)
277 _colorLayerImageViewLst[i]->SetPlainOrGradientColor( color_type );
282 //----------------------------------------------------------------------------
283 int ColorLayerImageViewManager::GetBaseColorNb()
286 int i, size=_colorLayerImageViewLst.size();
289 if (_colorLayerImageViewLst[i]!=NULL)
291 result = _colorLayerImageViewLst[i]->GetBaseColorNb();
297 //----------------------------------------------------------------------------
298 void ColorLayerImageViewManager::Refresh()
300 int i, size=_colorLayerImageViewLst.size();
303 if (_colorLayerImageViewLst[i]!=NULL)
305 _colorLayerImageViewLst[i]->Refresh();
310 //----------------------------------------------------------------------------
311 void ColorLayerImageViewManager::onThreshold()
313 int i, size=_colorLayerImageViewLst.size();
316 if (_colorLayerImageViewLst[i]!=NULL)
318 _colorLayerImageViewLst[i]->onThreshold();
323 //----------------------------------------------------------------------------
324 void ColorLayerImageViewManager::onThresholdChange()
326 int i, size=_colorLayerImageViewLst.size();
329 if (_colorLayerImageViewLst[i]!=NULL)
331 _colorLayerImageViewLst[i]->onThresholdChange();
336 //----------------------------------------------------------------------------
337 void ColorLayerImageViewManager::onThresholdRemove()
339 int i, size=_colorLayerImageViewLst.size();
342 if (_colorLayerImageViewLst[i]!=NULL)
344 _colorLayerImageViewLst[i]->onThresholdRemove();
349 //----------------------------------------------------------------------------
350 void ColorLayerImageViewManager::onThresholdInterpolation(bool interpolation)
352 int i, size=_colorLayerImageViewLst.size();
355 if (_colorLayerImageViewLst[i]!=NULL)
357 _colorLayerImageViewLst[i]->onThresholdInterpolation( interpolation );
362 //----------------------------------------------------------------------------
363 void ColorLayerImageViewManager::SetSliceFixDynamic( bool fixdyn )
365 int i, size=_colorLayerImageViewLst.size();
368 if (_colorLayerImageViewLst[i]!=NULL)
370 _colorLayerImageViewLst[i]->SetSliceFixDynamic( fixdyn );
375 //----------------------------------------------------------------------------
376 void ColorLayerImageViewManager::onThresholdChangeOpacity( int opacity)
378 int i, size=_colorLayerImageViewLst.size();
381 if (_colorLayerImageViewLst[i]!=NULL)
383 _colorLayerImageViewLst[i]->onThresholdChangeOpacity( opacity );
388 //----------------------------------------------------------------------------
389 void ColorLayerImageViewManager::SetImage( vtkImageData* img )
391 int i, size=_colorLayerImageViewLst.size();
394 if (_colorLayerImageViewLst[i]!=NULL)
396 _colorLayerImageViewLst[i]->SetImage( img );
401 //----------------------------------------------------------------------------
402 vtkImageData* ColorLayerImageViewManager::GetImageChangeInformation(int id)
404 if (_colorLayerImageViewLst[id]!=NULL)
406 return _colorLayerImageViewLst[id]->GetImage( );
411 //----------------------------------------------------------------------------
412 void ColorLayerImageViewManager::GetDimensionBase(int id,int *dim)
414 if (_colorLayerImageViewLst[id]!=NULL)
416 _colorLayerImageViewLst[id]->GetDimensionBase( dim );
420 //----------------------------------------------------------------------------
421 void ColorLayerImageViewManager::GetSpcBase(int id,double *spc)
423 if (_colorLayerImageViewLst[id]!=NULL)
425 _colorLayerImageViewLst[id]->GetSpcBase( spc );
429 //----------------------------------------------------------------------------
430 void ColorLayerImageViewManager::GetDimensionOriginalLayer(int id,int *dim)
432 if (_colorLayerImageViewLst[id]!=NULL)
434 _colorLayerImageViewLst[id]->GetDimensionOriginalLayer( dim );
438 //----------------------------------------------------------------------------
439 void ColorLayerImageViewManager::GetSpcOriginalLayer(int id,double *spc)
441 if (_colorLayerImageViewLst[id]!=NULL)
443 _colorLayerImageViewLst[id]->GetSpcOriginalLayer( spc );
447 //----------------------------------------------------------------------------
448 //----------------------------------------------------------------------------
449 void ColorLayerImageViewManager::SetNewSpacingLayer(double *spc)
451 int i, size=_colorLayerImageViewLst.size();
454 if (_colorLayerImageViewLst[i]!=NULL)
456 _colorLayerImageViewLst[i]->SetNewSpacingLayer( spc );