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 double ColorLayerImageViewManager::GetBaseColors(unsigned int index)
182 int i, size=_colorLayerImageViewLst.size();
185 if (_colorLayerImageViewLst[i]!=NULL)
187 result = _colorLayerImageViewLst[i]->GetBaseColors( index );
193 //----------------------------------------------------------------------------
194 void ColorLayerImageViewManager::SetGreyLevelBoundaries(std::vector<double> & grey_level_boundary)
196 int i, size=_colorLayerImageViewLst.size();
199 if (_colorLayerImageViewLst[i]!=NULL)
201 _colorLayerImageViewLst[i]->SetGreyLevelBoundaries( grey_level_boundary );
206 //----------------------------------------------------------------------------
207 double ColorLayerImageViewManager::GetGreyLevelBoundaries(unsigned int index)
210 int i, size=_colorLayerImageViewLst.size();
213 if (_colorLayerImageViewLst[i]!=NULL)
215 result = _colorLayerImageViewLst[i]->GetGreyLevelBoundaries( index );
221 //----------------------------------------------------------------------------
222 void ColorLayerImageViewManager::SetPlainOrGradientColor(bool color_type)
224 int i, size=_colorLayerImageViewLst.size();
227 if (_colorLayerImageViewLst[i]!=NULL)
229 _colorLayerImageViewLst[i]->SetPlainOrGradientColor( color_type );
234 //----------------------------------------------------------------------------
235 int ColorLayerImageViewManager::GetBaseColorNb()
238 int i, size=_colorLayerImageViewLst.size();
241 if (_colorLayerImageViewLst[i]!=NULL)
243 result = _colorLayerImageViewLst[i]->GetBaseColorNb();
249 //----------------------------------------------------------------------------
250 void ColorLayerImageViewManager::Refresh()
252 int i, size=_colorLayerImageViewLst.size();
255 if (_colorLayerImageViewLst[i]!=NULL)
257 _colorLayerImageViewLst[i]->Refresh();
262 //----------------------------------------------------------------------------
263 void ColorLayerImageViewManager::onThreshold()
265 int i, size=_colorLayerImageViewLst.size();
268 if (_colorLayerImageViewLst[i]!=NULL)
270 _colorLayerImageViewLst[i]->onThreshold();
275 //----------------------------------------------------------------------------
276 void ColorLayerImageViewManager::onThresholdChange()
278 int i, size=_colorLayerImageViewLst.size();
281 if (_colorLayerImageViewLst[i]!=NULL)
283 _colorLayerImageViewLst[i]->onThresholdChange();
288 //----------------------------------------------------------------------------
289 void ColorLayerImageViewManager::onThresholdRemove()
291 int i, size=_colorLayerImageViewLst.size();
294 if (_colorLayerImageViewLst[i]!=NULL)
296 _colorLayerImageViewLst[i]->onThresholdRemove();
301 //----------------------------------------------------------------------------
302 void ColorLayerImageViewManager::onThresholdInterpolation(bool interpolation)
304 int i, size=_colorLayerImageViewLst.size();
307 if (_colorLayerImageViewLst[i]!=NULL)
309 _colorLayerImageViewLst[i]->onThresholdInterpolation( interpolation );
314 //----------------------------------------------------------------------------
315 void ColorLayerImageViewManager::SetSliceFixDynamic( bool fixdyn )
317 int i, size=_colorLayerImageViewLst.size();
320 if (_colorLayerImageViewLst[i]!=NULL)
322 _colorLayerImageViewLst[i]->SetSliceFixDynamic( fixdyn );
327 //----------------------------------------------------------------------------
328 void ColorLayerImageViewManager::onThresholdChangeOpacity( int opacity)
330 int i, size=_colorLayerImageViewLst.size();
333 if (_colorLayerImageViewLst[i]!=NULL)
335 _colorLayerImageViewLst[i]->onThresholdChangeOpacity( opacity );
340 //----------------------------------------------------------------------------
341 void ColorLayerImageViewManager::SetImage( vtkImageData* img )
343 int i, size=_colorLayerImageViewLst.size();
346 if (_colorLayerImageViewLst[i]!=NULL)
348 _colorLayerImageViewLst[i]->SetImage( img );