GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoDBTrackManager.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 __QGoDBTrackManager_h
36 #define __QGoDBTrackManager_h
37 
38 #include "QGoTableWidget.h"
39 #include "GoDBCollectionOfTraces.h"
41 #include "QGoDBTraceManager.h"
42 #include "QGoGUILibConfigure.h"
43 #include "TrackContainer.h"
44 #include "GoDBTrackFamilyRow.h"
45 
46 class TrackStructure;
47 
54 class QGOGUILIB_EXPORT QGoDBTrackManager:public QGoDBTraceManager
55 {
56  Q_OBJECT
57 public:
58  QGoDBTrackManager(int iImgSessionID, QWidget *iparent);
60 
61  virtual void DisplayInfoForLastCreatedTrace(vtkMySQLDatabase *iDatabaseConnector);
62 
63  virtual void DisplayInfoForExistingTrace(vtkMySQLDatabase *iDatabaseConnector,
64  int iTraceID);
65 
70  void SetTracksInfoContainerForVisu(TrackContainer *iContainerForVisu);
71 
77  void DisplayInfoAndLoadVisuContainerForAllTracks(
78  vtkMySQLDatabase *iDatabaseConnector);
79 
85  void LoadInfoVisuContainerForTrackFamilies(vtkMySQLDatabase *iDatabaseConnector);
86 
93  void DisplayOnlyCalculatedValuesForExistingTrack(
94  GoFigureTrackAttributes *iTrackAttributes, unsigned int iTrackID);
95 
102  unsigned int CreateNewTrackWithNoMesh(
103  vtkMySQLDatabase *iDatabaseConnector);
104 
105  //virtual pure method in QGoDBTraceManager
106  std::list< unsigned int > UpdateTheTracesColor(vtkMySQLDatabase *iDatabaseConnector);
107 
108  //virtual pure method in QGoDBTraceManager
110  const std::vector< int > & iVectorImportedTraces,
111  vtkMySQLDatabase *iDatabaseConnector);
112 
120  void DeleteListTraces(vtkMySQLDatabase *iDatabaseConnector,
121  const std::list<unsigned int> & iListTraces);
122 
123  //virtual pure method in QGoDBTraceManager
124  virtual void DeleteCheckedTraces( vtkMySQLDatabase *iDatabaseConnector);
125 
126 
127  //virtual pure method in QGoDBTraceManager
128  virtual std::list< unsigned int > GetListHighlightedIDs();
129 
134  void UpdateCurrentElementTrackContainer();
135 
140  void UpdatePointsOfCurrentElementForImportedTrack(
141  std::map<unsigned int,double*> iMeshesInfo,
142  vtkMySQLDatabase* iDatabaseConnector);
143 
144  //method in QGoDBTraceManager
145  void UpdateBoundingBoxes(
146  vtkMySQLDatabase *iDatabaseConnector,
147  const std::list< unsigned int > & iListTracesIDs);
148 
155  std::string CheckMeshCanBeAddedToTrack( vtkMySQLDatabase* iDatabaseConnector,
156  unsigned int iTrackID,
157  unsigned int iMeshTimePoint,
158  std::list<unsigned int> &ioMotherTrackDivisionToUpdate);
159 
163  void UpdateDivisions(const std::list<unsigned int> & iListMotherTrackIDs);
164 
168  void AddVolume(const unsigned int& iTrackID, const double& iVolume);
169 
173  void AddVolumes(const std::list< std::pair<unsigned int, double> > & iVolumes);
174 
178  void RemoveVolumes(const std::list< std::pair<unsigned int, double> > & iVolumes);
179 
183  void AddVolumes(const std::list< std::pair<unsigned int, double> > & iVolumes,
184  unsigned int iTrackID);
185 
189  void RemoveVolumes(const std::list< std::pair<unsigned int, double> > & iVolumes,
190  unsigned int iTrackID);
191 
192  std::vector<unsigned int> GetTrackFamily(vtkMySQLDatabase* iDatabaseConnector,
193  unsigned int iTrackID);
194 
195  bool isMother(vtkMySQLDatabase* iDatabaseConnector, unsigned int iTrackID);
196 
205  int CreateTrackFamily(vtkMySQLDatabase* iDatabaseConnector,
206  unsigned int iMotherTrackID,
207  const std::list<unsigned int> & iDaughtersID);
208 
209 signals:
210  void NeedMeshesInfoForImportedTrack(unsigned int iTrackID);
211  void TrackToSplit(unsigned int iTrackID, std::list<unsigned int> iListMeshIDs);
212  void TrackIDToBeModifiedWithWidget(std::list<unsigned int> iListTracksID);
213  void MeshesToAddToTrack(std::list<unsigned int> iListMeshes, unsigned int iTrackID);
214 
215  void CheckedTracksToAddToSelectedLineage(std::list<unsigned int> iDaughtersID, unsigned int iLineageID,
216  std::list<unsigned> iLineagesToDelete);
217 
218  void NewLineageToCreateFromTracks( std::list<unsigned int> iCheckedTracksIDs, unsigned int iTrackIDRoot,
219  std::list<unsigned> iLineagesToDelete);
220 
221  void NeedToGoToTheRealLocation(double, double, double, int);
222 
223 public slots:
227  void DeleteTheDivisions(std::list<unsigned int> iDivisions = std::list<unsigned int>());
228 
232  void CreateCorrespondingTrackFamily(std::list<unsigned int> iDivisions = std::list<unsigned int>());
233 
234 protected:
237 
238  //virtual pure method in QGoDBTraceManager
239  virtual void SetCollectionsTraceNames();
240 
241  //virtual pure method in QGoDBTraceManager
242  virtual void DisplayInfoForAllTraces(vtkMySQLDatabase *iDatabaseConnector);
243 
245  vtkMySQLDatabase *iDatabaseConnector, const std::list<unsigned int> & iListTPs);
246 
247  //virtual pure method in QGoDBTraceManager
249  vtkMySQLDatabase* iDatabaseConnector,
250  std::list<unsigned int> iListTraceIDs = std::list< unsigned int >());
251 
259  void UpdateTrackPolydataForVisu(vtkMySQLDatabase *iDatabaseConnector,unsigned int iTrackID);
260 
261  //virtual in QGoDBTraceManager
262  void AddActionsContextMenu(QMenu *iMenu);
263 
270  void SaveTrackCurrentElement(vtkMySQLDatabase* iDatabaseConnector);
271 
272  void SaveTrackStructure(vtkMySQLDatabase* iDatabaseConnector,
273  TrackStructure* iStructure);
274 
284  bool CheckOverlappingTracks(std::list<unsigned int> iTrackIDs,
285  unsigned int &ioTraceIDToKeep, unsigned int &ioTraceIDToDelete,
286  vtkMySQLDatabase* iDatabaseConnector);
287 
296  void UpdateTrackFamilyIDForDaughter(vtkMySQLDatabase* iDatabaseConnector,
297  unsigned int iDaughterID,unsigned int iTrackFamilyID);
298 
308  bool IdentifyMotherDaughtersToCreateTrackFamily(
309  vtkMySQLDatabase* iDatabaseConnector,
310  const std::list<unsigned int> & iListTracksID,
311  int &ioMotherID,
312  std::list<unsigned int> &ioDaughtersID);
313 
322  std::list<unsigned int> GetTrackIDFromDaughtersFamilies( vtkMySQLDatabase* iDatabaseConnector,
323  std::list<unsigned int> &ioTrackIDsOfTheFamilies);
324 
331  void DeleteOneDivision(GoDBTrackFamilyRow iDivision, vtkMySQLDatabase* iDatabaseConnector,
332  std::list<unsigned int> &ioTrackIDsNoLineage, std::list<unsigned int> &ioMotherLineageToDelete);
333 
339  void PrintAMessageForTracksWithNoDivision(std::list<unsigned int> iTracksNoDivision);
340 
346  void CreateALineageWithFormerDaughterOfADeletedDivision(
347  unsigned int iDaughterID, vtkMySQLDatabase* iDatabaseConnector, bool &ioPartOfHigherLineage);
348 
353  unsigned int IsTheTrackAMother(unsigned int iDaughterID,
354  vtkMySQLDatabase* iDatabaseConnector);
355 
360  unsigned int IsTheTrackADaughter(unsigned int iTrackID,
361  vtkMySQLDatabase* iDatabaseConnector);
362 
370  void UpdateFormerDaughtersOfADeletedDivision(
371  std::list<unsigned int> iDaughtersID,
372  std::list<unsigned int> &ioTrackIDsNoLineage,
373  bool &ioPartOfHigherLineage);
374 
378  std::list<unsigned int> GetDivisionIDsTheTrackBelongsTo(
379  vtkMySQLDatabase* iDatabaseConnector, unsigned int iTrackID );
384  unsigned int CheckBoundingBoxDivisionAsAMother(vtkMySQLDatabase* iDatabaseConnector,
385  unsigned int iTimePoint, unsigned int iTrackFamilyID );
386 
391  unsigned int CheckBoundingBoxDivisionAsADaughter(vtkMySQLDatabase* iDatabaseConnector,
392  unsigned int iTimePoint, unsigned int iTrackFamilyID );
393 
394 protected slots:
395 
396  //virtual pure method in QGoDBTraceManager
397  virtual void UpdateHighlightedElementsInVisuContainer(int iTraceID);
398 
399  //virtual pure method in QGoDBTraceManager
400  virtual void UpdateVisibleElementsInVisuContainer(int iTraceID);
401 
402 
403  //virtual pure method in QGoDBTraceManager
404  virtual void SetColorCoding(bool IsChecked);
405 
410  void SplitMergeTrackWithWidget();
411 
416  void TrackIDToEmit();
417 
426  void MergeTracks();
427 
428  void GoToTrackEnd();
429  void GoToTrackBegin();
430 };
431 #endif
virtual void DisplayInfoForLastCreatedTrace(vtkMySQLDatabase *iDatabaseConnector)=0
Virtual pure method: get the data needed from the database for the last created trace and display the...
virtual void UpdateBoundingBoxes(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTracesIDs, bool UpdateTW=true)
update in the database the bounding boxes corresponding to the TracesIDs and update the corresponding...
Abstract class inherited by QGoDBContourManager,Mesh,Track,Lineage.
virtual void SetCollectionsTraceNames()=0
virtual pure method: set the std::string class members
virtual void UpdateHighlightedElementsInVisuContainer(int iTraceID)=0
modify to the opposite one the highlighted property of the corresponding trace base on traceID in the...
manages a map with keys matching fields of the gofiguredatabase TrackFamily table and values of the m...
virtual void DisplayInfoForExistingTrace(vtkMySQLDatabase *iDatabaseConnector, int iTraceID)=0
Virtual pure method: get the data needed from the database for the existing trace with iTraceID and u...
TrackContainer * m_TrackContainerInfoForVisu
virtual void UpdateTWAndContainerForImportedTraces(const std::vector< int > &iVectorImportedTraces, vtkMySQLDatabase *iDatabaseConnector)=0
get the data needed from the database for the imported traces,display them in new inserted rows of th...
This class describes the specificities of the GoDBTWContainerForTrackLineage for track.
Structure which represent a track, and used for interaction between Visualization and TableWidget...
This class manages the database queries, the table widget and the data from the database in the Conta...
virtual void SetColorCoding(bool IsChecked)=0
ColorCode the traces in the visualization base on a selected column in the table widget.
virtual void DisplayInfoForTracesForSpecificTPs(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTPs)=0
void GetTracesInfoFromDBAndModifyContainerForVisu(vtkMySQLDatabase *iDatabaseConnector, std::vector< int > iVectIDs, C *iContainerForVisu)
virtual void DeleteCheckedTraces(vtkMySQLDatabase *iDatabaseConnector)=0
delete the checked traces from the database, the TW and the container for visu
Wraps a boost multi index container of TrackStructure. This class intends to synchronize Track repres...
virtual std::list< unsigned int > GetListHighlightedIDs()=0
GoDBTWContainerForTrack * m_TWContainer
virtual std::list< unsigned int > UpdateTheTracesColor(vtkMySQLDatabase *iDatabaseConnector)=0
virtual pure. update the color of the checked traces in the database, the visu container and the TW a...
virtual void UpdateVisibleElementsInVisuContainer(int iTraceID)=0
modify to the opposite one the Visible property of the corresponding trace base on traceID in the con...
virtual void DisplayInfoForAllTraces(vtkMySQLDatabase *iDatabaseConnector)=0
Virtual pure method: get the data needed from the database and display them in the m_Table for all tr...
virtual void AddActionsContextMenu(QMenu *iMenu)