GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LineageContainer.h
Go to the documentation of this file.
1 /*=========================================================================
2  Authors: The GoFigure Dev. Team.
3  at Megason Lab, Systems biology, Harvard Medical school, 2009-11
4 
5  Copyright (c) 2009-11, President and Fellows of Harvard College.
6  All rights reserved.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  Redistributions of source code must retain the above copyright notice,
12  this list of conditions and the following disclaimer.
13  Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16  Neither the name of the President and Fellows of Harvard College
17  nor the names of its contributors may be used to endorse or promote
18  products derived from this software without specific prior written
19  permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33 =========================================================================*/
34 
35 #ifndef __LineageContainer_h
36 #define __LineageContainer_h
37 
38 #include <QObject>
39 
40 #include "LineageStructure.h"
41 #include "StructureHelper.h"
42 
43 #include "TraceContainerBase.h"
44 
45 #include "QGoImageView3D.h"
46 
47 namespace boost
48 {
49  typedef multi_index::multi_index_container<
51  boost::multi_index::indexed_by<
52  boost::multi_index::ordered_unique<
53  boost::multi_index::tag< TraceID >,
54  BOOST_MULTI_INDEX_MEMBER(TraceStructure, unsigned int, TraceID)
55  >,
56  boost::multi_index::ordered_non_unique<
57  boost::multi_index::tag< CollectionID >,
58  BOOST_MULTI_INDEX_MEMBER(TraceStructure, unsigned int, CollectionID)
59  >,
60  boost::multi_index::ordered_non_unique<
61  boost::multi_index::tag< Highlighted >,
62  BOOST_MULTI_INDEX_MEMBER(TraceStructure, bool, Highlighted)
63  >,
64  boost::multi_index::ordered_non_unique<
65  boost::multi_index::tag< Visible >,
66  BOOST_MULTI_INDEX_MEMBER(TraceStructure, bool, Visible)
67  >,
68  boost::multi_index::ordered_non_unique<
69  boost::multi_index::tag< TrackRootID >,
70  BOOST_MULTI_INDEX_MEMBER(LineageStructure, unsigned int, TrackRootID)
71  >
72  >
74 }
75 
84  public TraceContainerBase< boost::MultiIndexLineageContainer >
85 {
86  Q_OBJECT
87 public:
88 
90 
93 
94  typedef MultiIndexContainerType::index< TrackRootID >::type::iterator
96 
97  //------------------------------------------------------------------------
98 
100  explicit LineageContainer( QObject *iParent,
101  QGoImageView3D *iView);
102 
104  virtual ~LineageContainer();
105 
113  void InsertNewLineage(
114  const unsigned int& iLineageID,
115  double irgba[4],
116  const unsigned int& iTrackIDRoot,
117  const bool& IsVisible = false);
118 
119  /*
120  * \brief Get the list of all the lineages roots, as track IDs
121  * \return list containg the track root ids
122  */
123  std::list<unsigned int> GetListOfTrackRootIDs();
124 
125  /*
126  * \brief Get the list of all the lineages IDs
127  * \return list containg the lineage ids
128  */
129  std::list<unsigned int> GetListOfLineageIDs();
130 
131  /*
132  * \brief Get the track root ID of the given lineage
133  * \param[in] iTraceID lineage ID of interest
134  * \return related track root ID
135  */
136  unsigned int GetLineageTrackRootID( const unsigned int& iTraceID );
137 
138  /*
139  * \brief Get the trace root ID from the track root ID
140  * \param[in] iTraceID track root id
141  * \return related lineage ID
142  */
143  unsigned int GetTraceIDFromTrackRootID( const unsigned int& iTraceID );
144 
145  /*
146  * \brief Get the visibility of the given lineage
147  * \param[in] iTraceID lineage ID of interest
148  * \return visibility
149  */
150  bool GetLineageVisibile( const unsigned int& iTraceID );
151 
152  /*
153  * \brief Get the hilighted of the given lineage
154  * \param[in] iTraceID lineage ID of interest
155  * \return highlighted
156  */
157  bool GetLineageHighlighted( const unsigned int& iTraceID );
158 
159  /*
160  * \brief Get the color of the given lineage
161  * \param[in] iTraceID lineage ID of interest
162  * \return color
163  */
164  double* GetLineageColor( const unsigned int& iTraceID );
165 
167  bool DeleteElement(const unsigned int & iId);
169  std::list< unsigned int > DeleteAllHighlightedElements();
170 
171 signals:
172  void HighlightLineage(const unsigned int&, const bool&);
173  /*
174  \todo Nicolas-Signal there to avoid warning but has to be connected to the box widget
175  */
176  void TraceVisibilityChanged(unsigned int, Qt::CheckState);
177  void ShowLineage(const unsigned int&, const bool&);
178  void DeleteLineage(unsigned int);
180  void TracePicked(unsigned int, Qt::CheckState);
181 
182  void ExportLineages();
183 
184 public slots:
190  virtual void UpdateElementHighlightingWithGivenTraceIDs( const QStringList& iList,
191  const Qt::CheckState& iCheck );
192 
198  virtual void UpdateElementVisibilityWithGivenTraceIDs( const QStringList& iList,
199  const Qt::CheckState& iCheck );
200 
207  void UpdateElementHighlighting(unsigned int iTraceID)
208  {
209  Qt::CheckState state;
211  emit TracePicked(iTraceID, state);
212  }
213 
214 protected:
215  std::vector< vtkActor* > AddTrace( vtkPolyData* , vtkProperty* );
216 
217 private:
219 };
220 
221 #endif // LineageCONTAINER_H
MultiIndexContainerType::value_type MultiIndexContainerElementType
std::list< unsigned int > DeleteAllHighlightedElements()
Delete all highlighted elements.
Q_DISABLE_COPY(LineageContainer)
bool GetLineageHighlighted(const unsigned int &iTraceID)
TraceContainerBase< boost::MultiIndexLineageContainer > Superclass
MultiIndexContainerType::template index< TraceID >::type::iterator MultiIndexContainerTraceIDIterator
void TraceVisibilityChanged(unsigned int, Qt::CheckState)
MultiIndexContainerType::index< TrackRootID >::type::iterator MultiIndexContainerTrackRootIDIterator
LineageContainer(QObject *iParent, QGoImageView3D *iView)
Constructor.
std::list< unsigned int > GetListOfTrackRootIDs()
void ShowLineage(const unsigned int &, const bool &)
class for the visualization of 3D Image represented by one vtkImageData*.
Superclass::MultiIndexContainerType MultiIndexContainerType
Generic interface for trace container. More specific container should inherit from this class and get...
std::list< unsigned int > GetListOfLineageIDs()
unsigned int GetTraceIDFromTrackRootID(const unsigned int &iTraceID)
virtual ~LineageContainer()
Destructor.
bool DeleteElement(const unsigned int &iId)
void TracePicked(unsigned int, Qt::CheckState)
When one track has been picked (highlighted) from the visualization.
Structure which represent a lineage, and used for interaction between Visualization and TableWidget...
bool GetLineageVisibile(const unsigned int &iTraceID)
Wraps a boost multi index container of LineageStructure. This class intends to synchronize Lineage re...
virtual void UpdateElementHighlightingWithGivenTraceIDs(const QStringList &iList, const Qt::CheckState &iCheck)
Change elements highlighting property given a list of TraceIDs and the new status.
std::vector< vtkActor * > AddTrace(vtkPolyData *, vtkProperty *)
void UpdateElementHighlighting(unsigned int iTraceID)
Update highlighting property of one element given one actor.
void InsertNewLineage(const unsigned int &iLineageID, double irgba[4], const unsigned int &iTrackIDRoot, const bool &IsVisible=false)
insert a new element in the container with all the info needed
unsigned int GetLineageTrackRootID(const unsigned int &iTraceID)
void HighlightLineage(const unsigned int &, const bool &)
multi_index::multi_index_container< LineageStructure, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< TraceID >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< CollectionID >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< Highlighted >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< Visible >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< TrackRootID >, > > > MultiIndexLineageContainer
void DeleteLineage(unsigned int)
Superclass::MultiIndexContainerElementType LineageType
void UpdateElementHighlightingWithTraceID(const unsigned int &oTraceId, Qt::CheckState &oState)
Update highlighting property of one element given one actor.
virtual void UpdateElementVisibilityWithGivenTraceIDs(const QStringList &iList, const Qt::CheckState &iCheck)
Change elements visibility property given a list of TraceIDs and the new status.
double * GetLineageColor(const unsigned int &iTraceID)
Structure which represent a trace (contour, mesh, track, lineage), and used for interaction between V...