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 );
193 //----------------------------------------------------------------------------
194 double ColorLayerImageViewManager::GetBaseColors(unsigned int index)
197 int i, size=_colorLayerImageViewLst.size();
200 if (_colorLayerImageViewLst[i]!=NULL)
202 result = _colorLayerImageViewLst[i]->GetBaseColors( index );
208 //----------------------------------------------------------------------------
209 void ColorLayerImageViewManager::SetGreyLevelBoundaries(std::vector<double> & grey_level_boundary)
211 int i, size=_colorLayerImageViewLst.size();
214 if (_colorLayerImageViewLst[i]!=NULL)
216 _colorLayerImageViewLst[i]->SetGreyLevelBoundaries( grey_level_boundary );
221 //----------------------------------------------------------------------------
222 double ColorLayerImageViewManager::GetGreyLevelBoundaries(unsigned int index)
225 int i, size=_colorLayerImageViewLst.size();
228 if (_colorLayerImageViewLst[i]!=NULL)
230 result = _colorLayerImageViewLst[i]->GetGreyLevelBoundaries( index );
236 //----------------------------------------------------------------------------
237 void ColorLayerImageViewManager::SetPlainOrGradientColor(bool color_type)
239 int i, size=_colorLayerImageViewLst.size();
242 if (_colorLayerImageViewLst[i]!=NULL)
244 _colorLayerImageViewLst[i]->SetPlainOrGradientColor( color_type );
249 //----------------------------------------------------------------------------
250 int ColorLayerImageViewManager::GetBaseColorNb()
253 int i, size=_colorLayerImageViewLst.size();
256 if (_colorLayerImageViewLst[i]!=NULL)
258 result = _colorLayerImageViewLst[i]->GetBaseColorNb();
264 //----------------------------------------------------------------------------
265 void ColorLayerImageViewManager::Refresh()
267 int i, size=_colorLayerImageViewLst.size();
270 if (_colorLayerImageViewLst[i]!=NULL)
272 _colorLayerImageViewLst[i]->Refresh();
277 //----------------------------------------------------------------------------
278 void ColorLayerImageViewManager::onThreshold()
280 int i, size=_colorLayerImageViewLst.size();
283 if (_colorLayerImageViewLst[i]!=NULL)
285 _colorLayerImageViewLst[i]->onThreshold();
290 //----------------------------------------------------------------------------
291 void ColorLayerImageViewManager::onThresholdChange()
293 int i, size=_colorLayerImageViewLst.size();
296 if (_colorLayerImageViewLst[i]!=NULL)
298 _colorLayerImageViewLst[i]->onThresholdChange();
303 //----------------------------------------------------------------------------
304 void ColorLayerImageViewManager::onThresholdRemove()
306 int i, size=_colorLayerImageViewLst.size();
309 if (_colorLayerImageViewLst[i]!=NULL)
311 _colorLayerImageViewLst[i]->onThresholdRemove();
316 //----------------------------------------------------------------------------
317 void ColorLayerImageViewManager::onThresholdInterpolation(bool interpolation)
319 int i, size=_colorLayerImageViewLst.size();
322 if (_colorLayerImageViewLst[i]!=NULL)
324 _colorLayerImageViewLst[i]->onThresholdInterpolation( interpolation );
329 //----------------------------------------------------------------------------
330 void ColorLayerImageViewManager::SetSliceFixDynamic( bool fixdyn )
332 int i, size=_colorLayerImageViewLst.size();
335 if (_colorLayerImageViewLst[i]!=NULL)
337 _colorLayerImageViewLst[i]->SetSliceFixDynamic( fixdyn );
342 //----------------------------------------------------------------------------
343 void ColorLayerImageViewManager::onThresholdChangeOpacity( int opacity)
345 int i, size=_colorLayerImageViewLst.size();
348 if (_colorLayerImageViewLst[i]!=NULL)
350 _colorLayerImageViewLst[i]->onThresholdChangeOpacity( opacity );
355 //----------------------------------------------------------------------------
356 void ColorLayerImageViewManager::SetImage( vtkImageData* img )
358 int i, size=_colorLayerImageViewLst.size();
361 if (_colorLayerImageViewLst[i]!=NULL)
363 _colorLayerImageViewLst[i]->SetImage( img );