GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoDBMeshManager.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 __QGoDBMeshManager_h
36 #define __QGoDBMeshManager_h
37 
38 #include "QGoTableWidget.h"
39 #include "GoDBCollectionOfTraces.h"
40 #include "GoDBTWContainerForMesh.h"
41 #include "QGoDBTraceManager.h"
42 #include "GoDBMeshRow.h"
43 #include "MeshContainer.h"
44 #include "QGoGUILibConfigure.h"
45 
52 class QGOGUILIB_EXPORT QGoDBMeshManager:public QGoDBTraceManager
53 {
54  Q_OBJECT
55 public:
56  QGoDBMeshManager(int iImgSessionID,
57  QWidget *iparent);
59 
64  void SetMeshesInfoContainerForVisu(MeshContainer *iContainerForVisu);
65 
71  void DisplayInfoAndLoadVisuContainerForAllMeshes(vtkMySQLDatabase *iDatabaseConnector);
72 
73  void DisplayInfoAndLoadVisuContainerForAllMeshesForSpecificTPs(
74  vtkMySQLDatabase *iDatabaseConnector, const std::list<unsigned int> & iListTPs);
75 
76  void AddInfoInTWAndVisuContainerForMeshesForSpecificTPs(
77  vtkMySQLDatabase *iDatabaseConnector, const std::list<unsigned int> & iListTPs);
78 
79  void RemoveTracesFromTWAndContainerForVisuForSpecificTPs(
80  vtkMySQLDatabase *iDatabaseConnector,
81  const std::list<unsigned int> & iListTPs);
82 
83  virtual void DisplayInfoForLastCreatedTrace(vtkMySQLDatabase *iDatabaseConnector);
84 
85  void DisplayInfoForLastCreatedMesh(vtkMySQLDatabase *iDatabaseConnector,
86  GoFigureMeshAttributes *iMeshAttributes);
87 
88  virtual void DisplayInfoForExistingTrace(vtkMySQLDatabase *iDatabaseConnector,
89  int iTraceID);
90 
91  void DisplayInfoForExistingTraceForMesh(vtkMySQLDatabase *iDatabaseConnector,
92  int iTraceID,
93  GoFigureMeshAttributes *iMeshAttributes);
94 
101  void DisplayOnlyVolumeAreaForExistingMesh(GoFigureMeshAttributes *iMeshAttributes,
102  unsigned iMeshID);
103 
104  unsigned int CreateNewMeshWithNoContourNoPoints(
105  vtkMySQLDatabase *iDatabaseConnector);
106 
107  unsigned int SaveNewMeshFromVisu(unsigned int iXCoordMin,
108  unsigned int iYCoordMin,
109  unsigned int iZCoordMin,
110  unsigned int iXCoordMax,
111  unsigned int iYCoordMax,
112  unsigned int iZCoordMax,
113  int iTShift,
114  vtkPolyData *iTraceNodes,
115  vtkMySQLDatabase *iDatabaseConnector,
116  GoFigureMeshAttributes *iMeshAttributes);
117 
118  unsigned int SaveNewMeshFromVisu(unsigned int iXCoordMin,
119  unsigned int iYCoordMin,
120  unsigned int iZCoordMin,
121  unsigned int iXCoordMax,
122  unsigned int iYCoordMax,
123  unsigned int iZCoordMax,
124  int iTShift,
125  vtkPolyData *iTraceNodes,
126  vtkMySQLDatabase *iDatabaseConnector,
127  GoFigureMeshAttributes *iMeshAttributes,
128  unsigned int iTrackID);
129 
130  unsigned int SaveNewMeshWithNoTrackFromVisu(unsigned int iXCoordMin,
131  unsigned int iYCoordMin,
132  unsigned int iZCoordMin,
133  unsigned int iXCoordMax,
134  unsigned int iYCoordMax,
135  unsigned int iZCoordMax,
136  int iTShift,
137  vtkPolyData *iTraceNodes,
138  vtkMySQLDatabase *iDatabaseConnector,
139  GoFigureMeshAttributes *iMeshAttributes);
140 
141  void SaveGeneratedMeshFromVisu(unsigned int iXCoordMin, unsigned int iYCoordMin,
142  unsigned int iZCoordMin,
143  unsigned int iXCoordMax, unsigned int iYCoordMax,
144  unsigned int iZCoordMax, vtkPolyData *iTraceNodes,
145  vtkMySQLDatabase *iDatabaseConnector,
146  GoFigureMeshAttributes *iMeshAttributes);
147 
151  std::list< unsigned int > UpdateTheTracesColor(vtkMySQLDatabase *iDatabaseConnector);
152 
156  void UpdateBoundingBoxes(vtkMySQLDatabase *iDatabaseConnector,
157  const std::list< unsigned int > & iListTracesIDs);
158 
159  //virtual pure method in QGoDBTraceManager
161  const std::vector< int > & iVectorImportedTraces,
162  vtkMySQLDatabase *iDatabaseConnector);
163 
164  //virtual pure method in QGoDBTraceManager
165  virtual void DeleteCheckedTraces(vtkMySQLDatabase *iDatabaseConnector);
166 
167  //virtual pure method in QGoDBTraceManager
168  virtual std::list< unsigned int > GetListHighlightedIDs();
169 
174  void SetSelectedCellType(std::string* iCellType);
175 
180  void SetSelectedSubCellType(std::string* iSubCellType);
181 
190  MeshContainer* GetMeshesInfoFromDBAndCreateContainerForVisu(
191  vtkMySQLDatabase* iDatabaseConnector,
192  const std::list< unsigned int > & iListCollectionIDs);
193 
194  //method in QGoDBTraceManager
195  virtual std::list< NameWithColorData > GetAllTraceIDsWithColor(
196  vtkMySQLDatabase *iDatabaseConnector, std::string & ioIDToSelect);
197 
201  std::list< std::pair<unsigned int, double> > GetListVolumes();
202 
206  std::list< std::pair<unsigned int, double> > GetListVolumes(
207  const std::list<unsigned int> & iMeshIDs);
208 
212  double GetVolume(unsigned int iMeshID);
213 
214  void CleanTWAndContainerForGivenTimePoint(vtkMySQLDatabase *iDatabaseConnector,
215  const std::list<unsigned int>& iTimePoints);
216 
217  void ModifyTrackIDInVisuContainer(unsigned int iTrackID,
218  const std::list< unsigned int > & iToTrack,
219  const std::list< unsigned int > & iToNull);
220 
221 
222 public slots:
229  std::map<unsigned int,double*> GetMeshesInfoForImportedMesh(
230  std::list<unsigned int> iMeshesIDs);
231 
242  unsigned int ReassignTrackIDForPreviousMeshWithSameTimePoint(
243  vtkMySQLDatabase *iDatabaseConnector,unsigned int iTrackID,
244  unsigned int iTimePoint);
245 
256  QString CheckExistingMeshesForTheTrack(
257  unsigned int iTrackID, vtkMySQLDatabase* iDatabaseConnector, int iTCoord);//int iShift = 0);
258 
262  QString CheckExistingMeshesForTheTrack(
263  unsigned int iTrackID,vtkMySQLDatabase* iDatabaseConnector,
264  std::list<unsigned int> & ioListMeshIDs,
265  std::list< unsigned int > & ioNullListMeshIDs);
266 
281  std::string CheckListMeshesFromDifferentTimePoints(
282  vtkMySQLDatabase *iDatabaseConnector,
283  std::list< unsigned int > iListMeshIDs,
284  std::list<unsigned int> & ioListMeshIDsToBePartOfTrack,
285  std::list<unsigned int> & ioListMeshIDsToReassign);
286 
297  std::list<unsigned int> GetMeshesWithTimePointInfToTheCheckedOne(
298  unsigned int iTrackID, vtkMySQLDatabase* iDatabaseConnector,
299  std::list<unsigned int> iListMeshesBelongingToTrack);
300 
301 protected:
304  std::string* m_SelectedCellType;
305  std::string* m_SelectedSubCellType;
306 
307  //virtual pure method in QGoDBTraceManager
308  virtual void SetCollectionsTraceNames();
309 
310  void PrintValuesForMeshWithNoPoints(unsigned int iTraceID);
311 
312  virtual void AddActionsContextMenu(QMenu *iMenu);
313 
314  //virtual pure method in QGoDBTraceManager
315  virtual void DisplayInfoForAllTraces(vtkMySQLDatabase *iDatabaseConnector);
316 
317  //virtual pure method in QGoDBTraceManager
318  virtual void DisplayInfoForTracesForSpecificTPs(vtkMySQLDatabase *iDatabaseConnector,
319  const std::list<unsigned int> & iListTPs);
320 
321  void AddInfoForMeshesInTWForSpecificTPs(vtkMySQLDatabase *iDatabaseConnector,
322  const std::list<unsigned int> & iListTPs);
323 
324  void SetMeshBoundingBoxAndPoints(unsigned int iXCoordMin,
325  unsigned int iYCoordMin,
326  unsigned int iZCoordMin,
327  unsigned int iXCoordMax,
328  unsigned int iYCoordMax,
329  unsigned int iZCoordMax,
330  vtkPolyData *iTraceNodes,
331  vtkMySQLDatabase *iDatabaseConnector,
332  GoDBMeshRow & iMesh,
333  GoFigureMeshAttributes *iMeshAttributes,
334  int iShift = 0);
335  //virtual pure method in QGoDBTraceManager
337  vtkMySQLDatabase* iDatabaseConnector,
338  std::list<unsigned int> iVectIDs = std::list< unsigned int >());
339 
347  std::pair<unsigned int, unsigned int> GetInfoForTheOnlyOneCheckedMeshOfTheTrack(
348  vtkMySQLDatabase* iDatabaseConnector, unsigned int iTrackID);
349 
350 protected slots:
351  //virtual pure method in QGoDBTraceManager
352  virtual void UpdateHighlightedElementsInVisuContainer(int iTraceID);
353 
354  //virtual pure method in QGoDBTraceManager
355  virtual void UpdateVisibleElementsInVisuContainer(int iTraceID);
356 
357  //virtual pure method in QGoDBTraceManager
358  virtual void SetColorCoding(bool IsChecked);
359 
363  void UpdateCellType();
364 
368  void UpdateSubCellType();
369 
370 };
371 #endif