iRoCS Toolbox  1.1.0
VisualizationChannelSpecs.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * This file belongs to the iRoCS Toolbox.
4  *
5  * Copyright (C) 2015 Thorsten Falk
6  *
7  * Image Analysis Lab, University of Freiburg, Germany
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  **************************************************************************/
24 
25 #ifndef VISUALIZATIONCHANNELSPECS_HH
26 #define VISUALIZATIONCHANNELSPECS_HH
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.hh>
30 #endif
31 
32 #include "ChannelSpecs.hh"
33 
34 #include <libArrayToolbox/Array.hh>
36 
37 #include <set>
38 
39 class ColorMap;
41 class IntControlElement;
42 
43 class QComboBox;
44 class QSpinBox;
45 
47 {
48 
49  Q_OBJECT
50 
51 public:
52 
55  bool sign = false, int bitDepth = 16);
57 
58  ChannelSpecs::ChannelType channelType() const override;
59 
61 
62  atb::Array<int,3> const *data() const;
64 
65 /*======================================================================*/
74 /*======================================================================*/
75  float valueAt(blitz::TinyVector<double,3> const &positionUm) const override;
76 
77 /*======================================================================*/
86 /*======================================================================*/
87  std::string stringValueAt(
88  blitz::TinyVector<double,3> const &positionUm) const override;
89 
90 /*======================================================================*/
102 /*======================================================================*/
103  int& labelAt(blitz::TinyVector<double,3> const &positionUm);
104 
105 /*======================================================================*/
117 /*======================================================================*/
118  int& labelAtVoxel(blitz::TinyVector<ptrdiff_t,3> const &pos);
119 
120  ColorMap const &colorMap() const;
121  ColorMap &colorMap();
122 
123 /*======================================================================*/
133 /*======================================================================*/
134  void pickFillValue(blitz::TinyVector<double,3> const &positionUm);
135 
136 /*======================================================================*/
142 /*======================================================================*/
143  int fillValue() const;
144 
145 /*======================================================================*/
164 /*======================================================================*/
165  void floodFill(blitz::TinyVector<double,3> const &positionUm,
166  bool mergeNeighboringSegments = false);
167 
168  void setSign(bool sign);
169  bool sign() const;
170 
171  void setBitDepth(int bitDepth);
172  int bitDepth() const;
173 
174  void setHasNewData();
175 
176 /*======================================================================*/
183 /*======================================================================*/
184  bool dataChanged() const;
185 
186 /*======================================================================*/
194 /*======================================================================*/
195  void setDataChanged(bool dataChanged);
196 
198 
199 public slots:
200 
201 /*======================================================================*/
207 /*======================================================================*/
208  void setFillValue(int value);
209 
210  void normalizeIndexRange();
211  void setTransformation(
212  blitz::TinyMatrix<double,4,4> const &transformation) override;
213 
214 /*======================================================================*/
221 /*======================================================================*/
222  void revalidate() override;
223 
224 private slots:
225 
226  void updateIcon();
227 
228 private:
229 
230  typedef std::set< blitz::TinyVector<atb::BlitzIndexT,3>,
232 
233  PixelSet _grassfire(blitz::TinyVector<atb::BlitzIndexT,3> const &posPx,
234  int value, bool getBoundary);
235 
236  atb::Array<int,3> *p_data;
237 
238  IntControlElement *p_fillValueControl;
239 
240  bool _sign;
241  int _bitDepth;
242 
243  ColorMap *p_colorMap;
244 
245  ColorMapEditorWidget *p_colorMapEditor;
246 
247  bool _dataChanged;
248 
249 };
250 
251 #endif
Array class derived from blitz++ Arrays for handling microscopic datasets with associated element siz...
The TinyVectorLessThan struct provides an operator for comparing TinyVectors defining a strict weak o...
Definition: Neighborhood.hh:57
void setBitDepth(int bitDepth)
void pickFillValue(blitz::TinyVector< double, 3 > const &positionUm)
Pick the value for subsequent flood fill operations from the current volume.
int & labelAt(blitz::TinyVector< double, 3 > const &positionUm)
Get the integer label at the given coordinates relative to the upper left corner of the volume...
atb::Array< int, 3 > const * data() const
ChannelSpecs::ChannelType channelType() const override
void revalidate() override
Reset the channel shape, element size, transformation and bounding box from the underlying data...
void setDataChanged(bool dataChanged)
Set the data changed flag.
int & labelAtVoxel(blitz::TinyVector< ptrdiff_t, 3 > const &pos)
Get the integer label at the given pixel coordinates relative to the upper left corner of the volume...
void floodFill(blitz::TinyVector< double, 3 > const &positionUm, bool mergeNeighboringSegments=false)
Apply a flood fill operation at the given world coordinates in micrometers.
ChannelSpecsRenderer * addRenderer(ViewWidget *view)
Neighborhoods for local operators.
ColorMap const & colorMap() const
virtual blitz::TinyMatrix< double, 4, 4 > const & transformation() const
std::string stringValueAt(blitz::TinyVector< double, 3 > const &positionUm) const override
Get a string representation of the value at the given 3D world coordinates in micrometers.
void setTransformation(blitz::TinyMatrix< double, 4, 4 > const &transformation) override
VisualizationChannelSpecs(atb::Array< int, 3 > *data, MultiChannelModel *model=NULL, bool sign=false, int bitDepth=16)
bool dataChanged() const
Get the data changed flag.
int fillValue() const
Get the value for subsequent flood fill operations.
MultiChannelModel * model() const
float valueAt(blitz::TinyVector< double, 3 > const &positionUm) const override
Get a float representation of the value at the given 3D world coordinates in micrometers.
void setSign(bool sign)
static VisualizationChannelSpecs * load()
void setFillValue(int value)
Set the value for subsequent flood fill operations.