GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoTrackEditingWidget.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-10
4 
5  Copyright (c) 2009-10, 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 __QGoTrackEditingWidget_h
36 #define __QGoTrackEditingWidget_h
37 
38 #include <QDialog>
39 #include <QStatusBar>
40 
41 #include "ui_TrackEditingWidget.h"
42 
43 #include "QGoGUILibConfigure.h"
44 
45 #include "vtkActor.h"
46 
48 #include "vtkEventQtSlotConnect.h"
49 
50 #include "vtkSmartPointer.h"
51 
52 #include "MeshContainer.h"
53 
54 class vtkPoints;
55 
61 class QGOGUILIB_EXPORT QGoTrackEditingWidget:
62  public QDialog,
63  private Ui::TrackEditingWidget
64 {
65  Q_OBJECT
66 public:
67 
68  explicit QGoTrackEditingWidget( MeshContainer* imeshContainer = NULL,
69  QWidget *parent = 0 );
71 
76  void init();
77 
82  std::list< std::list< unsigned int > > GetListOfTracksToBeCreated();
83 
88  std::map< unsigned int, std::list< unsigned int > > GetListOfTracksToBeUpdated();
89 
94  std::list< unsigned int > GetListOfTracksToBeDeleted();
95 
96 public slots:
97 
101  void updateCurrentActorSelection(vtkObject *caller);
102 
107  void restoreTrackIDs();
108 
109  void updateMeshesActors( bool );
110 
111 private:
112 
119  void highlightFirstActor( bool iHighlight );
120 
126  void modifyMeshCollectionID( unsigned int iMeshID, unsigned int iCollectionID);
127 
131  void computeMeshActors();
132 
138  std::list< unsigned int > getMeshIDsInTrack( unsigned int iCollection);
139 
144  void initializeVisualization();
145 
151  void cutTrack( vtkActor* iActor);
152 
163  bool mergeTrack( const unsigned int& iFirstMesh, const unsigned int& iSecondMesh);
164 
166 
172  std::pair< std::pair<unsigned int, unsigned int>,
173  std::pair<unsigned int, unsigned int> >
174  getTrackBorders( const unsigned int& iCollectionID );
175 
179  void reassignTrackIDs();
180 
187  void updateTracksIDs( const unsigned int& iIDToDelete,
188  const unsigned int& iIDToUpdate);
189 
193  void computeLineActors();
194 
195  vtkActor* computeSphere( unsigned int iTraceID, double* iCenter, double radius);
196 
197  void getClosestPoints();
202  void removeLineActors();
203 
212  vtkActor* createPolylineActor( double* iCenter1, double* iCenter2,
213  const double* iColor1 = NULL,
214  const double* iColor2 = NULL );
215 
221  void computeLabelActor();
222 
224 
225  std::list< std::list< unsigned int > > m_ListOfNewTrack;
226  std::map< unsigned int, std::list< unsigned int > > m_ListOfUpdatedTracks;
227  std::list< unsigned int > m_ListOfDeletedTracks;
228 
230 
231  unsigned int m_MaxTrackID;
232  unsigned int m_NumberOfTracks;
233 
235 
236  vtkActor* m_CurrentActor;
237  vtkActor* m_FirstMeshActor;
238  unsigned int m_FirstMeshID;
239 
241 
243  vtkSmartPointer<vtkEventQtSlotConnect> m_VtkEventQtConnector;
244  vtkSmartPointer<vtkRenderer> renderer;
245 
247  {
248  NEW_TRACK = 0,
250  DELETED_TRACK
251  };
252 
254  unsigned int RealID;
256 
257  // Constructors
258  TrackInformation() : RealID( 0 ), Status( NEW_TRACK ) {}
259  TrackInformation(unsigned int A, TrackStatusType B):RealID(A), Status(B){}
260  };
261 
262  typedef std::map< unsigned int, TrackInformation > TrackMapping;
264 
265  typedef std::map< vtkActor*, unsigned int >::iterator LineActor2MeshIDIterator;
266  std::map< vtkActor*, unsigned int > m_Line2MeshID;
267 
268 
269 private:
270  Q_DISABLE_COPY( QGoTrackEditingWidget );
271 
272 };
273 #endif
MultiIndexContainerType::template index< TraceID >::type::iterator MultiIndexContainerTraceIDIterator
std::list< std::list< unsigned int > > m_ListOfNewTrack
vtkSmartPointer< vtkRenderer > renderer
This dialog allows the user to split/merge the tracks using a GUI.
vtkInteractorStyleImage3D * m_InteractorStyle3D
std::list< unsigned int > m_ListOfDeletedTracks
std::map< vtkActor *, unsigned int > m_Line2MeshID
Wraps a boost::multi_index_container of ContourMeshStructure. This class is specialized for the means...
Definition: MeshContainer.h:46
std::map< unsigned int, TrackInformation > TrackMapping
Define the interactor behavior withing a vtkImage3D. 4 modes (Default, Zoom, Pan and Pick) ...
vtkSmartPointer< vtkEventQtSlotConnect > m_VtkEventQtConnector
std::map< unsigned int, std::list< unsigned int > > m_ListOfUpdatedTracks
std::map< vtkActor *, unsigned int >::iterator LineActor2MeshIDIterator
TrackInformation(unsigned int A, TrackStatusType B)