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 //----------------------------------------------------------------------------
76 void ColorLayerImageViewManager::SetX2(int x2)
78 int i, size=_colorLayerImageViewLst.size();
81 if (_colorLayerImageViewLst[i]!=NULL)
83 _colorLayerImageViewLst[i]->SetX2( x2 );
88 //----------------------------------------------------------------------------
89 void ColorLayerImageViewManager::SetY2(int y2)
91 int i, size=_colorLayerImageViewLst.size();
94 if (_colorLayerImageViewLst[i]!=NULL)
96 _colorLayerImageViewLst[i]->SetY2( y2 );
102 //----------------------------------------------------------------------------
103 void ColorLayerImageViewManager::SetZ2(int z2)
105 int i, size=_colorLayerImageViewLst.size();
108 if (_colorLayerImageViewLst[i]!=NULL)
110 _colorLayerImageViewLst[i]->SetZ2( z2 );
118 //----------------------------------------------------------------------------
119 int ColorLayerImageViewManager::GetX()
122 int i, size=_colorLayerImageViewLst.size();
125 if (_colorLayerImageViewLst[i]!=NULL)
127 result = _colorLayerImageViewLst[i]->GetX();
133 //----------------------------------------------------------------------------
134 int ColorLayerImageViewManager::GetY()
137 int i, size=_colorLayerImageViewLst.size();
140 if (_colorLayerImageViewLst[i]!=NULL)
142 result = _colorLayerImageViewLst[i]->GetY();
150 //----------------------------------------------------------------------------
151 int ColorLayerImageViewManager::GetZ() // virtual
154 int i, size=_colorLayerImageViewLst.size();
157 if (_colorLayerImageViewLst[i]!=NULL)
159 result = _colorLayerImageViewLst[i]->GetZ();
165 //----------------------------------------------------------------------------
166 void ColorLayerImageViewManager::SetBaseColors(std::vector<double> & base_color)
168 int i, size=_colorLayerImageViewLst.size();
171 if (_colorLayerImageViewLst[i]!=NULL)
173 _colorLayerImageViewLst[i]->SetBaseColors( base_color );
178 //----------------------------------------------------------------------------
179 void ColorLayerImageViewManager::SetBaseTransparence(std::vector<double> & base_transparence)
181 int i, size=_colorLayerImageViewLst.size();
184 if (_colorLayerImageViewLst[i]!=NULL)
186 _colorLayerImageViewLst[i]->SetBaseTransparence( base_transparence );
191 //----------------------------------------------------------------------------
192 void ColorLayerImageViewManager::SetRangeForColorBar(std::vector<double> &range)
194 int i, size=_colorLayerImageViewLst.size();
197 if (_colorLayerImageViewLst[i]!=NULL)
199 _colorLayerImageViewLst[i]->SetRangeForColorBar( range );
206 //----------------------------------------------------------------------------
207 double ColorLayerImageViewManager::GetBaseColors(unsigned int index)
210 int i, size=_colorLayerImageViewLst.size();
213 if (_colorLayerImageViewLst[i]!=NULL)
215 result = _colorLayerImageViewLst[i]->GetBaseColors( index );
221 //----------------------------------------------------------------------------
222 void ColorLayerImageViewManager::SetGreyLevelBoundaries(std::vector<double> & grey_level_boundary)
224 int i, size=_colorLayerImageViewLst.size();
227 if (_colorLayerImageViewLst[i]!=NULL)
229 _colorLayerImageViewLst[i]->SetGreyLevelBoundaries( grey_level_boundary );
234 //----------------------------------------------------------------------------
235 double ColorLayerImageViewManager::GetGreyLevelBoundaries(unsigned int index)
238 int i, size=_colorLayerImageViewLst.size();
241 if (_colorLayerImageViewLst[i]!=NULL)
243 result = _colorLayerImageViewLst[i]->GetGreyLevelBoundaries( index );
249 //----------------------------------------------------------------------------
250 void ColorLayerImageViewManager::SetPlainOrGradientColor(bool color_type)
252 int i, size=_colorLayerImageViewLst.size();
255 if (_colorLayerImageViewLst[i]!=NULL)
257 _colorLayerImageViewLst[i]->SetPlainOrGradientColor( color_type );
262 //----------------------------------------------------------------------------
263 int ColorLayerImageViewManager::GetBaseColorNb()
266 int i, size=_colorLayerImageViewLst.size();
269 if (_colorLayerImageViewLst[i]!=NULL)
271 result = _colorLayerImageViewLst[i]->GetBaseColorNb();
277 //----------------------------------------------------------------------------
278 void ColorLayerImageViewManager::Refresh()
280 int i, size=_colorLayerImageViewLst.size();
283 if (_colorLayerImageViewLst[i]!=NULL)
285 _colorLayerImageViewLst[i]->Refresh();
290 //----------------------------------------------------------------------------
291 void ColorLayerImageViewManager::onThreshold()
293 int i, size=_colorLayerImageViewLst.size();
296 if (_colorLayerImageViewLst[i]!=NULL)
298 _colorLayerImageViewLst[i]->onThreshold();
303 //----------------------------------------------------------------------------
304 void ColorLayerImageViewManager::onThresholdChange()
306 int i, size=_colorLayerImageViewLst.size();
309 if (_colorLayerImageViewLst[i]!=NULL)
311 _colorLayerImageViewLst[i]->onThresholdChange();
316 //----------------------------------------------------------------------------
317 void ColorLayerImageViewManager::onThresholdRemove()
319 int i, size=_colorLayerImageViewLst.size();
322 if (_colorLayerImageViewLst[i]!=NULL)
324 _colorLayerImageViewLst[i]->onThresholdRemove();
329 //----------------------------------------------------------------------------
330 void ColorLayerImageViewManager::onThresholdInterpolation(bool interpolation)
332 int i, size=_colorLayerImageViewLst.size();
335 if (_colorLayerImageViewLst[i]!=NULL)
337 _colorLayerImageViewLst[i]->onThresholdInterpolation( interpolation );
342 //----------------------------------------------------------------------------
343 void ColorLayerImageViewManager::SetSliceFixDynamic( bool fixdyn )
345 int i, size=_colorLayerImageViewLst.size();
348 if (_colorLayerImageViewLst[i]!=NULL)
350 _colorLayerImageViewLst[i]->SetSliceFixDynamic( fixdyn );
355 //----------------------------------------------------------------------------
356 void ColorLayerImageViewManager::onThresholdChangeOpacity( int opacity)
358 int i, size=_colorLayerImageViewLst.size();
361 if (_colorLayerImageViewLst[i]!=NULL)
363 _colorLayerImageViewLst[i]->onThresholdChangeOpacity( opacity );
368 //----------------------------------------------------------------------------
369 void ColorLayerImageViewManager::SetImage( vtkImageData* img )
371 int i, size=_colorLayerImageViewLst.size();
374 if (_colorLayerImageViewLst[i]!=NULL)
376 _colorLayerImageViewLst[i]->SetImage( img );