iRoCS Toolbox  1.1.0
AnnotationChannelSpecs.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 ANNOTATIONCHANNELSPECS_HH
26 #define ANNOTATIONCHANNELSPECS_HH
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.hh>
30 #endif
31 
32 #include "ChannelSpecs.hh"
33 
34 #include "HDF5DataIO.hh"
35 #include "Marker.hh"
36 
37 class QComboBox;
38 class QStackedWidget;
39 class QPushButton;
40 
42 {
43 
44  Q_OBJECT
45 
46 public:
47 
48  enum Operation {
49  AddMarker = 0x0000, LabelMarker = 0x0001, EditMarker = 0x0002,
50  DeleteMarker = 0x0003, UnknownOperation = 0xffff };
51 
52  typedef std::vector<Marker*>::const_iterator const_iterator;
53  typedef std::vector<Marker*>::iterator iterator;
54 
58 
60 
61  float valueAt(blitz::TinyVector<double,3> const &positionUm) const;
62  std::string stringValueAt(
63  blitz::TinyVector<double,3> const &positionUm) const;
64 
65  int selectedViewType() const;
67 
70 
72  blitz::TinyVector<double,3> const &positionUm, bool intersecting = false);
73  Marker *addMarker(blitz::TinyVector<double,3> const &positionUm);
74 
75  void addMarker(Marker *marker);
76  void labelMarker(Marker *marker);
77  void removeMarker(Marker *marker);
78 
79  void selectMarker(Marker *marker);
80  Marker const *selectedMarker() const;
82 
84 
85  blitz::TinyVector<float,3> colorForLabel(int label) const;
86  void setColorForLabel(int label, blitz::TinyVector<float,3> const &color);
87  std::map< int,blitz::TinyVector<float,3> > &colorMap();
88 
89  float alphaForLabel(int label) const;
90  void setAlphaForLabel(int label, float alpha);
91  std::map< int,float > &alphaMap();
92 
93  void resizeFeatures(size_t newSize);
94 
95  std::vector<Marker*> const &markers() const;
96  const_iterator begin() const;
97  iterator begin();
98  const_iterator end() const;
99  iterator end();
100  Marker const *operator[](size_t index) const;
101  Marker *operator[](size_t index);
102 
104 
105  blitz::TinyVector<double,3> const &elementSizeUm() const;
106 
108  std::string const &fileName, iRoCS::ProgressReporter *pr = NULL);
109  void load(BlitzH5File const &inFile, iRoCS::ProgressReporter *pr = NULL);
111  std::string const &fileName, iRoCS::ProgressReporter *pr = NULL) const;
112  void save(BlitzH5File &outFile, iRoCS::ProgressReporter *pr = NULL) const;
113 
114  void saveCSV(std::string const &fileName) const;
115  static AnnotationChannelSpecs *loadCSV(std::string const &fileName);
116 
117 signals:
118 
119  void featureSizeChanged(int size);
120 
121 public slots:
122 
123  void setCoordinateUpdateButtonEnabled(bool enable);
124 
125 private slots:
126 
127  void updateBoundingBox();
128  void updateSelectedMarker();
129  void updateCoordinates();
130 
131 private:
132 
133  Marker::MarkerType _markerType;
134  Marker *_selectedMarker;
135  std::vector<Marker*> _markers;
136 
137  MarkerPresetWidget *p_presetWidget;
138  MarkerControlWidget *p_controlWidget;
139 
140  QComboBox *p_viewTypeComboBox;
141  QComboBox *p_operationComboBox;
142  QPushButton *p_coordinateUpdateButton;
143 
144  std::map< int,blitz::TinyVector<float,3> > _colorMap;
145  std::map< int,float > _alphaMap;
146 
147 };
148 
149 #endif
ChannelSpecs::ChannelType channelType() const
float alpha() const
void selectMarker(Marker *marker)
void saveCSV(std::string const &fileName) const
HDF5DataIO::RetVal save(std::string const &fileName, iRoCS::ProgressReporter *pr=NULL) const
const_iterator begin() const
void labelMarker(Marker *marker)
int selectedViewType() const
static AnnotationChannelSpecs * loadCSV(std::string const &fileName)
std::string stringValueAt(blitz::TinyVector< double, 3 > const &positionUm) const
blitz::TinyVector< float, 3 > colorForLabel(int label) const
The Marker class specifies the properties of an abstract Marker that can be contained in an Annotatio...
Definition: Marker.hh:56
AnnotationChannelSpecs(Marker::MarkerType markerType, MultiChannelModel *model=NULL)
std::vector< Marker * >::const_iterator const_iterator
void featureSizeChanged(int size)
ChannelSpecsRenderer * addRenderer(ViewWidget *view)
Marker::MarkerType markerType() const
std::map< int, blitz::TinyVector< float, 3 > > & colorMap()
Marker * closestMarker(blitz::TinyVector< double, 3 > const &positionUm, bool intersecting=false)
Operation selectedOperation() const
std::vector< Marker * >::iterator iterator
HDF5DataIO::RetVal load(std::string const &fileName, iRoCS::ProgressReporter *pr=NULL)
MarkerControlWidget * markerControlWidget()
blitz::TinyVector< double, 3 > const & elementSizeUm() const
const_iterator end() const
float valueAt(blitz::TinyVector< double, 3 > const &positionUm) const
Marker const * selectedMarker() const
std::vector< Marker * > const & markers() const
float alphaForLabel(int label) const
void setColorForLabel(int label, blitz::TinyVector< float, 3 > const &color)
void removeMarker(Marker *marker)
MarkerPresetWidget * markerPresetWidget()
MultiChannelModel * model() const
std::map< int, float > & alphaMap()
void resizeFeatures(size_t newSize)
void setAlphaForLabel(int label, float alpha)
MarkerType
Marker.hh "liblabelling_qt4/Marker.hh".
Definition: Marker.hh:73
void setCoordinateUpdateButtonEnabled(bool enable)
Marker const * operator[](size_t index) const
Marker * addMarker(blitz::TinyVector< double, 3 > const &positionUm)