GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoDBMeshManager.cxx
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 #include "QGoDBMeshManager.h"
36 #include "GoDBMeshRow.h"
37 #include <iostream>
38 #include <sstream>
39 
40 QGoDBMeshManager::QGoDBMeshManager(int iImgSessionID, QWidget *iparent) :
41  QGoDBTraceManager(), m_MeshContainerInfoForVisu(NULL), m_SelectedCellType(NULL),
42  m_SelectedSubCellType(NULL)
43 {
44  this->SetInfo(iImgSessionID, iparent);
45  this->m_TWContainer = new GoDBTWContainerForMesh(iImgSessionID);
46 }
47 
48 //-------------------------------------------------------------------------
49 
50 //-------------------------------------------------------------------------
52 {
53  if ( this->m_TWContainer )
54  {
55  delete this->m_TWContainer;
56  }
57 }
58 
59 //-------------------------------------------------------------------------
60 
61 //-------------------------------------------------------------------------
63  MeshContainer *iContainerForVisu)
64 {
65  this->SetTracesInfoContainerForVisuTemplate< MeshContainer >(
66  iContainerForVisu, &this->m_MeshContainerInfoForVisu);
67 }
68 
69 //-------------------------------------------------------------------------
70 
71 //-------------------------------------------------------------------------
73 {
74  this->m_TraceName = "mesh";
75  this->m_CollectionName = "track";
76  this->m_CollectionOf = "contour";
77 }
78 
79 //-------------------------------------------------------------------------
80 
81 //-------------------------------------------------------------------------
83  vtkMySQLDatabase *iDatabaseConnector)
84 {
86  GoDBTWContainerForMesh >(this->m_TWContainer, iDatabaseConnector);
87 }
88 
89 //-------------------------------------------------------------------------
90 
91 //-------------------------------------------------------------------------
93  vtkMySQLDatabase *iDatabaseConnector,
94  const std::list<unsigned int> & iListTPs)
95 {
96  this->DisplayInfoAndLoadVisuContainerWithAllTracesForSpecificTPs< ContourMeshContainer >
97  (iDatabaseConnector, this->m_MeshContainerInfoForVisu, iListTPs);
98 }
99 //-------------------------------------------------------------------------
100 
101 //-------------------------------------------------------------------------
103  vtkMySQLDatabase *iDatabaseConnector,
104  const std::list<unsigned int> & iListTPs)
105  {
106  //this->AddInfoInTWAndContainerForVisuForSpecificTPs< ContourMeshContainer >
107  // (iDatabaseConnector, this->m_ContourContainerInfoForVisu, iListTPs);
108 
109  this->AddInfoForMeshesInTWForSpecificTPs(iDatabaseConnector, iListTPs);
110  std::list<unsigned int> ListIDs =
112  iDatabaseConnector, iListTPs);
113  std::list<ContourMeshContainer::MultiIndexContainerElementType> list_of_traces =
114  this->m_CollectionOfTraces->
115  GetListStructureFromDB<ContourMeshContainer::MultiIndexContainerElementType>(
116  iDatabaseConnector, this->m_ImgSessionID, ListIDs);
119  }
120 
121 //-------------------------------------------------------------------------
122 
123 //-------------------------------------------------------------------------
125  vtkMySQLDatabase *iDatabaseConnector,
126  const std::list<unsigned int> & iListTPs)
127 {
128  //int IndexShowColumn = this->m_TWContainer->GetIndexShowColumn();
129 
130  /*this->AddInfoForTracesInTWForSpecificTPsTemplate<GoDBTWContainerForContourMesh>(
131  this->m_TWContainer,
132  iDatabaseConnector, Qt::Unchecked, IndexShowColumn );*/
133  //load the container with the traces infos for the TW for the TimePoints contained
134  //in iListTPs:
135  TWContainerType RowContainer =
136  this->m_TWContainer->GetContainerLoadedWithAllFromDB(iDatabaseConnector, iListTPs);
137 
138  this->m_Table->InsertNewRows(RowContainer,
139  this->m_TWContainer->GetIndexForGroupColor(this->m_TraceName),
141  this->m_TraceName,
142  this->m_CollectionName,
143  Qt::Unchecked);
144  }
145 //-------------------------------------------------------------------------
146 
147 //-------------------------------------------------------------------------
149  vtkMySQLDatabase *iDatabaseConnector)
150 {
151  int IndexShowColumn = this->m_TWContainer->GetIndexShowColumn();
152 
153  this->DisplayInfoForAllTracesTemplate< GoDBTWContainerForMesh >(
154  this->m_TWContainer, iDatabaseConnector, Qt::Unchecked, IndexShowColumn);
155 }
156 
157 //-------------------------------------------------------------------------
158 
159 //-------------------------------------------------------------------------
161 DisplayInfoForTracesForSpecificTPs( vtkMySQLDatabase *iDatabaseConnector,
162  const std::list<unsigned int> & iListTPs)
163 {
164  int IndexShowColumn = this->m_TWContainer->GetIndexShowColumn();
165  this->DisplayInfoForTracesForSpecificTPsTemplate<GoDBTWContainerForMesh >(
166  this->m_TWContainer, iDatabaseConnector, Qt::Unchecked, iListTPs,
167  IndexShowColumn);
168 }
169 //-------------------------------------------------------------------------
170 
171 //-------------------------------------------------------------------------
174  vtkMySQLDatabase *iDatabaseConnector,
175  const std::list<unsigned int> & iListTPs)
176 {
177  this->RemoveTracesFromTWAndContainerForVisuForSpecificTPsTemplate< ContourMeshContainer >
178  (iDatabaseConnector, this->m_MeshContainerInfoForVisu, iListTPs);
179 }
180 
181 //-------------------------------------------------------------------------
182 
183 //-------------------------------------------------------------------------
185  vtkMySQLDatabase *iDatabaseConnector)
186 {
187  this->DisplayInfoForLastCreatedTraceTemplate< GoDBTWContainerForMesh >(
188  this->m_TWContainer, iDatabaseConnector);
189 }
190 
191 //-------------------------------------------------------------------------
192 
193 //-------------------------------------------------------------------------
195  GoFigureMeshAttributes *iMeshAttributes, unsigned iMeshID)
196 {
197  if ( iMeshAttributes != 0 )
198  {
199  std::vector< std::string > ColumnNames (2);
200  std::vector< std::string > Values (2);
201  ColumnNames.at(0) = "SurfaceArea";
202  Values.at(0) = ConvertToString< double >(iMeshAttributes->m_Area);
203  ColumnNames.at(1) = "Volume";
204  Values.at(1) = ConvertToString< double >(iMeshAttributes->m_Volume);
205  this->m_Table->AddValuesForID(ColumnNames, Values, iMeshID, "meshID");
206  }
207 }
208 
209 //-------------------------------------------------------------------------
210 
211 //-------------------------------------------------------------------------
213  vtkMySQLDatabase *iDatabaseConnector, GoFigureMeshAttributes *iMeshAttributes)
214 {
215  this->m_TWContainer->SetMeshAttributes(iMeshAttributes);
216  this->DisplayInfoForLastCreatedTrace(iDatabaseConnector);
217 }
218 
219 //-------------------------------------------------------------------------
220 
221 //-------------------------------------------------------------------------
223  vtkMySQLDatabase *iDatabaseConnector, int iTraceID)
224 {
225  this->DisplayInfoForExistingTraceTemplate< GoDBTWContainerForMesh >(
226  this->m_TWContainer, iDatabaseConnector, iTraceID);
227 }
228 
229 //-------------------------------------------------------------------------
230 
231 //-------------------------------------------------------------------------
233  vtkMySQLDatabase *iDatabaseConnector, int iTraceID,
234  GoFigureMeshAttributes *iMeshAttributes)
235 {
236  this->m_TWContainer->SetMeshAttributes(iMeshAttributes);
237  this->DisplayInfoForExistingTrace(iDatabaseConnector, iTraceID);
238 }
239 
240 //-------------------------------------------------------------------------
241 
242 //-------------------------------------------------------------------------
244 {
248  tr("Add the selected CellType '%1' to the checked meshes")
249  .arg( this->m_SelectedCellType->c_str() ), this, SLOT( UpdateCellType() ) );
251  tr("Add the selected SubCellType '%1' to the checked meshes")
252  .arg( this->m_SelectedSubCellType->c_str() ), this, SLOT( UpdateSubCellType() ) );
253 }
254 
255 //-------------------------------------------------------------------------
256 
257 //-------------------------------------------------------------------------
259  unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin,
260  unsigned int iXCoordMax, unsigned int iYCoordMax,
261  unsigned int iZCoordMax, int iTCoord,//int iTShift,
262  vtkPolyData *iTraceNodes,
263  vtkMySQLDatabase *iDatabaseConnector,
264  GoFigureMeshAttributes *iMeshAttributes,
265  unsigned int iTrackID)
266 {
267  GoDBMeshRow NewMesh(this->m_ImgSessionID);
268 
269  NewMesh.SetCellType(iDatabaseConnector, *this->m_SelectedCellType);
270  NewMesh.SetSubCellType(iDatabaseConnector, *this->m_SelectedSubCellType);
271 
272  this->SetMeshBoundingBoxAndPoints(iXCoordMin, iYCoordMin, iZCoordMin,
273  iXCoordMax, iYCoordMax, iZCoordMax, iTraceNodes, iDatabaseConnector, NewMesh,
274  iMeshAttributes, iTCoord);
275  //save the intensities for each channel !!!
276  unsigned int NewMeshID = this->m_CollectionOfTraces->CreateNewTraceInDB< GoDBMeshRow >(
277  NewMesh, iDatabaseConnector, *this->m_SelectedColorData, iTrackID );
278  // pointer to double has to be deleted after usage...
279  double *rgba = this->GetVectorFromQColor(this->m_SelectedColorData->second);
281  NewMeshID, rgba);
283  delete[] rgba;
284  this->DisplayInfoForLastCreatedMesh(iDatabaseConnector, iMeshAttributes);
285  return NewMeshID;
286 }
287 //-------------------------------------------------------------------------
288 
289 //-------------------------------------------------------------------------
291  unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin,
292  unsigned int iXCoordMax, unsigned int iYCoordMax,
293  unsigned int iZCoordMax, int iTCoord, vtkPolyData *iTraceNodes,
294  vtkMySQLDatabase *iDatabaseConnector,
295  GoFigureMeshAttributes *iMeshAttributes)
296 {
297  return SaveNewMeshFromVisu(iXCoordMin, iYCoordMin, iZCoordMin, iXCoordMax, iYCoordMax,
298  iZCoordMax, iTCoord, iTraceNodes, iDatabaseConnector, iMeshAttributes,
299  ss_atoi<unsigned int>(this->m_SelectedCollectionData->first) );
300 }
301 
302 //-------------------------------------------------------------------------
303 
304 //-------------------------------------------------------------------------
306  unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin,
307  unsigned int iXCoordMax, unsigned int iYCoordMax,
308  unsigned int iZCoordMax, int iTShift, vtkPolyData *iTraceNodes,
309  vtkMySQLDatabase *iDatabaseConnector,
310  GoFigureMeshAttributes *iMeshAttributes)
311 {
312  return SaveNewMeshFromVisu(iXCoordMin, iYCoordMin, iZCoordMin, iXCoordMax, iYCoordMax,
313  iZCoordMax, iTShift, iTraceNodes, iDatabaseConnector, iMeshAttributes, 0 );
314 }
315 //-------------------------------------------------------------------------
316 
317 //-------------------------------------------------------------------------
318 
319 void QGoDBMeshManager::SaveGeneratedMeshFromVisu(unsigned int iXCoordMin,
320  unsigned int iYCoordMin,
321  unsigned int iZCoordMin,
322  unsigned int iXCoordMax,
323  unsigned int iYCoordMax,
324  unsigned int iZCoordMax,
325  vtkPolyData *iTraceNodes,
326  vtkMySQLDatabase *iDatabaseConnector,
327  GoFigureMeshAttributes *iMeshAttributes)
328 {
329  unsigned int TraceID =
331  GoDBMeshRow GeneratedMesh;
332 
333  GeneratedMesh.SetValuesForSpecificID(TraceID, iDatabaseConnector);
334 
335  this->SetMeshBoundingBoxAndPoints(iXCoordMin,
336  iYCoordMin,
337  iZCoordMin,
338  iXCoordMax,
339  iYCoordMax,
340  iZCoordMax,
341  iTraceNodes,
342  iDatabaseConnector,
343  GeneratedMesh,
344  iMeshAttributes);
345  //save the intensity for each channel !!!
346  GeneratedMesh.SaveInDB(iDatabaseConnector);
347  this->DisplayInfoForExistingTraceForMesh(iDatabaseConnector, TraceID, iMeshAttributes);
348 }
349 
350 //-------------------------------------------------------------------------
351 
352 //-------------------------------------------------------------------------
354  vtkMySQLDatabase *iDatabaseConnector)
355 {
356  GoDBMeshRow NewMesh;
357 
358  NewMesh.SetCellType(iDatabaseConnector, *this->m_SelectedCellType);
359  NewMesh.SetSubCellType(iDatabaseConnector, *this->m_SelectedSubCellType);
360 
361  //unsigned int TrackID = 0;
362 
363  // if( this->m_SelectedCollectionData->first != "Add a new mesh ..."
364  // && this->m_SelectedCollectionData->first != "Add a new track ...")
365  // {
366  // TrackID = ss_atoi<unsigned int>(this->m_SelectedCollectionData->first);
367  // }
368  // if ( TrackID != 0 )
369  // {
370  //NewMesh.SetCollectionID(TrackID);
371  // }
372  NewMesh.SetCollectionID( ss_atoi< unsigned int >(this->m_SelectedCollectionData->first) );
373 
374  unsigned int NewMeshID =
376  iDatabaseConnector, *this->m_SelectedColorData, NewMesh, *this->m_CurrentTimePoint);
377  // pointer to double has to be deleted after usage...
378  double *color = this->GetVectorFromQColor(this->m_SelectedColorData->second);
381  NewMeshID, color);
382  delete[] color;
384  this->DisplayInfoForLastCreatedTrace(iDatabaseConnector);
385 
386  NameWithColorData NewMeshData(ConvertToString< unsigned int >(NewMeshID),
387  this->m_SelectedColorData->second);
388  emit AddNewTraceIDInTS(NewMeshData);
389  return NewMeshID;
390 }
391 
392 //-------------------------------------------------------------------------
393 
394 //-------------------------------------------------------------------------
395 std::list< unsigned int > QGoDBMeshManager::UpdateTheTracesColor(
396  vtkMySQLDatabase *iDatabaseConnector)
397 {
398  return this->UpdateTheTracesColorTemplate< GoDBMeshRow, ContourMeshContainer >(
399  iDatabaseConnector, this->m_MeshContainerInfoForVisu);
400 }
401 
402 //-------------------------------------------------------------------------
403 
404 //-------------------------------------------------------------------------
406 UpdateBoundingBoxes(vtkMySQLDatabase *iDatabaseConnector,
407  const std::list< unsigned int > & iListTracesIDs)
408 {
409  std::list< unsigned int > ListMeshesWithNoPoints =
411  iListTracesIDs, iDatabaseConnector);
412  if ( !ListMeshesWithNoPoints.empty() )
413  {
414  QGoDBTraceManager::UpdateBoundingBoxes(iDatabaseConnector, ListMeshesWithNoPoints);
415  }
416 }
417 
418 //-------------------------------------------------------------------------
419 
420 //-------------------------------------------------------------------------
422  unsigned int iYCoordMin,
423  unsigned int iZCoordMin,
424  unsigned int iXCoordMax,
425  unsigned int iYCoordMax,
426  unsigned int iZCoordMax,
427  vtkPolyData *iTraceNodes,
428  vtkMySQLDatabase *iDatabaseConnector,
429  GoDBMeshRow & iMesh,
430  GoFigureMeshAttributes *iMeshAttributes,
431  int iTCoord)
432  //int iShift)
433 {
434  GoDBCoordinateRow coord_min = this->GetCoordinateFromInt(iXCoordMin,
435  iYCoordMin, iZCoordMin, iTCoord);//*this->m_CurrentTimePoint + iShift);
436  GoDBCoordinateRow coord_max = this->GetCoordinateFromInt(iXCoordMax,
437  iYCoordMax, iZCoordMax, iTCoord);//*this->m_CurrentTimePoint + +iShift);
438 
439  iMesh.SetTheDataFromTheVisu(iDatabaseConnector, iTraceNodes,
440  coord_min, coord_max, iMeshAttributes);
441 }
442 
443 //-------------------------------------------------------------------------
444 
445 //-------------------------------------------------------------------------
447  const std::vector< int > & iVectorImportedTraces,
448  vtkMySQLDatabase *iDatabaseConnector)
449 {
452  iVectorImportedTraces, iDatabaseConnector);
453  //update the visualization and the data from visu in the container for visu:
455  UpdateVisualizationForGivenIDs< std::vector< int > >(
456  iVectorImportedTraces);
457 }
458 
459 //-------------------------------------------------------------------------
460 
461 //-------------------------------------------------------------------------
462 void QGoDBMeshManager::DeleteCheckedTraces(vtkMySQLDatabase *iDatabaseConnector)
463 {
464  this->DeleteTracesTemplate< ContourMeshContainer >(iDatabaseConnector,
466 }
467 
468 //-------------------------------------------------------------------------
469 
470 //-------------------------------------------------------------------------
471 std::list< unsigned int > QGoDBMeshManager::GetListHighlightedIDs()
472 {
474 }
475 
476 //-------------------------------------------------------------------------
477 
478 //-------------------------------------------------------------------------
480  int iTraceID)
481 {
483  UpdateElementHighlightingWithGivenTraceID(iTraceID);
484 }
485 
486 //-------------------------------------------------------------------------
487 
488 //-------------------------------------------------------------------------
490 {
492  UpdateElementVisibilityWithGivenTraceID(iTraceID);
493 }
494 
495 //-------------------------------------------------------------------------
496 
497 //-------------------------------------------------------------------------
499  vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTraceIDs)
500 {
501  this->GetTracesInfoFromDBAndModifyContainerForVisuTemplate< MeshContainer >(
502  this->m_MeshContainerInfoForVisu, iDatabaseConnector, iListTraceIDs);
503 }
504 
505 //-------------------------------------------------------------------------
506 
507 //-------------------------------------------------------------------------
509  vtkMySQLDatabase *iDatabaseConnector,
510  const std::list< unsigned int > & iListCollectionIDs)
511 {
512  std::list< unsigned int > ListMeshesInvolved =
513  this->GetListTracesIDsBelongingToCollectionIDs(iDatabaseConnector, iListCollectionIDs);
514 
515  MeshContainer * oMeshContainer = new MeshContainer(this, NULL);
516 
517  std::list< ContourMeshStructure > ListMeshesInfo =
519  iDatabaseConnector, this->m_ImgSessionID, ListMeshesInvolved);
520 
521  std::list< ContourMeshStructure >::iterator it = ListMeshesInfo.begin();
522 
523  while ( it != ListMeshesInfo.end() )
524  {
525  oMeshContainer->Insert(*it);
526  ++it;
527  }
528  return oMeshContainer;
529 }
530 
531 //-------------------------------------------------------------------------
532 
533 //-------------------------------------------------------------------------
534 std::map< unsigned int, double * > QGoDBMeshManager::GetMeshesInfoForImportedMesh(
535  std::list< unsigned int > iMeshesIDs)
536 {
537  return this->m_MeshContainerInfoForVisu->GetMeshesPoints(iMeshesIDs);
538 }
539 
540 //-------------------------------------------------------------------------
541 
542 //-------------------------------------------------------------------------
544 {
545  this->SetColorCodingTemplate< ContourMeshContainer >(
546  this->m_MeshContainerInfoForVisu, IsChecked);
547 }
548 
549 //-------------------------------------------------------------------------
550 
551 //-------------------------------------------------------------------------
552 void QGoDBMeshManager::SetSelectedCellType(std::string *iCellType)
553 {
554  this->m_SelectedCellType = iCellType;
555 }
556 
557 //-------------------------------------------------------------------------
558 
559 //-------------------------------------------------------------------------
560 void QGoDBMeshManager::SetSelectedSubCellType(std::string *iSubCellType)
561 {
562  this->m_SelectedSubCellType = iSubCellType;
563 }
564 
565 //-------------------------------------------------------------------------
566 
567 //-------------------------------------------------------------------------
569 {
571 
572  std::list< unsigned int > ListCheckedMeshes =
574  int CellTypeID = GoDBMeshRow::GetCellTypeID(this->m_DatabaseConnector,
575  *this->m_SelectedCellType);
577  this->m_DatabaseConnector, "CellTypeID", ConvertToString< int >(CellTypeID),
578  ListCheckedMeshes);
579  this->DisplayInfoForExistingTraces(this->m_DatabaseConnector, ListCheckedMeshes);
581 }
582 
583 //-------------------------------------------------------------------------
584 
585 //-------------------------------------------------------------------------
587 {
589 
590  std::list< unsigned int > ListCheckedMeshes =
592  int SubCellTypeID = GoDBMeshRow::GetSubCellTypeID(this->m_DatabaseConnector,
593  *this->m_SelectedSubCellType);
595  this->m_DatabaseConnector, "SubCellularID", ConvertToString< int >(SubCellTypeID),
596  ListCheckedMeshes);
597  this->DisplayInfoForExistingTraces(this->m_DatabaseConnector, ListCheckedMeshes);
599 }
600 
601 //-------------------------------------------------------------------------
602 
603 //-------------------------------------------------------------------------
604 unsigned int QGoDBMeshManager::ReassignTrackIDForPreviousMeshWithSameTimePoint(vtkMySQLDatabase *iDatabaseConnector,
605  unsigned int iTrackID,
606  unsigned int iTimePoint)
607 {
608  unsigned int oExistingMeshID = 0;
609 
610  //get meshID with same timepoint and same TrackID:
611  std::list< unsigned int > ExistingMeshID =
613  iDatabaseConnector, iTrackID, iTimePoint);
614  if ( ExistingMeshID.empty() )
615  {
616  return oExistingMeshID;
617  }
618  if ( ExistingMeshID.size() > 1 )
619  {
620  std::cout << "there is more than 1 existing mesh for this track at this timepoint ";
621  std::cout << "Debug: In " << __FILE__ << ", line " << __LINE__;
622  std::cout << std::endl;
623  return oExistingMeshID;
624  }
625  oExistingMeshID = ExistingMeshID.front();
626  GoDBMeshRow ExistingMesh(oExistingMeshID, iDatabaseConnector);
627  // modify table widget and DB
628  ExistingMesh.SetCollectionID(0);
629  ExistingMesh.SaveInDB(iDatabaseConnector);
630  // modify visu container as well
632  this->DisplayInfoForExistingTrace(iDatabaseConnector, oExistingMeshID); //update
633  // the
634  // TW
635  return oExistingMeshID;
636 }
637 
638 //-------------------------------------------------------------------------
639 
640 //-------------------------------------------------------------------------
642  unsigned int iTrackID, vtkMySQLDatabase *iDatabaseConnector,
643  int iTCoord)
644 {
645  QString MessageToPrint("");
646 
647  if ( iTrackID != 0 ) //if the user has not created a track yet
648  {
649  unsigned int MeshIDKickedOut =
651  iDatabaseConnector, iTrackID, iTCoord);
652  if ( MeshIDKickedOut != 0 )
653  {
654  MessageToPrint = QString::number(MeshIDKickedOut);
655  }
656  }
657  return MessageToPrint;
658 }
659 
660 //-------------------------------------------------------------------------
661 
662 //-------------------------------------------------------------------------
664  unsigned int iTrackID, vtkMySQLDatabase *iDatabaseConnector,
665  std::list< unsigned int > & ioListMeshIDs,
666  std::list< unsigned int > & ioNullListMeshIDs)
667 {
668  QString MessageQString("");
669 
670  if ( iTrackID != 0 )
671  {
672  std::string MessageToPrint = "";
673  std::list< unsigned int > ListTimePoints =
674  this->m_CollectionOfTraces->GetListTimePointsFromTraceIDs(iDatabaseConnector, ioListMeshIDs);
675  if ( !ListTimePoints.empty() )
676  {
677  std::string MeshIDToPrint = "";
678  std::list< unsigned int >::iterator iter = ListTimePoints.begin();
679  while ( iter != ListTimePoints.end() )
680  {
681  unsigned int MeshIDKickedOut =
683  iDatabaseConnector, iTrackID, *iter);
684  if ( MeshIDKickedOut != 0 )
685  {
686  ioNullListMeshIDs.push_back(MeshIDKickedOut);
687  MeshIDToPrint += ConvertToString< unsigned int >(MeshIDKickedOut);
688  MeshIDToPrint += ", ";
689  }
690  ++iter;
691  }
692  if ( !MeshIDToPrint.empty() )
693  {
694  MeshIDToPrint = MeshIDToPrint.substr(0, MeshIDToPrint.size() - 2);
695  MessageToPrint += "The trackID of the meshes ";
696  MessageToPrint += MeshIDToPrint;
697  MessageToPrint += " have been reassigned to 0";
698  }
699  }
700  MessageQString = MessageToPrint.c_str();
701  }
702  return MessageQString;
703 }
704 
705 //-------------------------------------------------------------------------
706 
707 //-------------------------------------------------------------------------
709  vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListMeshIDs,
710  std::list< unsigned int > & ioListMeshIDsToBePartOfTrack,
711  std::list< unsigned int > & ioListMeshIDsToReassign)
712 {
713  std::string MessageToPrint = "";
714 
715  ioListMeshIDsToBePartOfTrack = iListMeshIDs;
716 
717  std::list< unsigned int >::iterator iter;
718 
719  if ( !iListMeshIDs.empty() )
720  {
721  std::list< unsigned int > TimePointsWithSeveralMeshes =
723  iDatabaseConnector, iListMeshIDs);
724 
725  iter = TimePointsWithSeveralMeshes.begin();
726 
727  while ( iter != TimePointsWithSeveralMeshes.end() )
728  {
729  int MaxMeshIDForTimePoint =
731  iDatabaseConnector, iListMeshIDs, *iter);
732  if ( MaxMeshIDForTimePoint != -1 )
733  {
734  std::list< unsigned int > TraceIDs =
736  iDatabaseConnector, iListMeshIDs, *iter, MaxMeshIDForTimePoint);
737  std::copy( TraceIDs.begin(), TraceIDs.end(), std::back_inserter(ioListMeshIDsToReassign) );
738  std::list< unsigned int >::iterator iterTraceIDToRemove = TraceIDs.begin();
739  while ( iterTraceIDToRemove != TraceIDs.end() )
740  {
741  std::list< unsigned int >::iterator Find =
742  std::find(ioListMeshIDsToBePartOfTrack.begin(), ioListMeshIDsToBePartOfTrack.end(),
743  *iterTraceIDToRemove);
744  ioListMeshIDsToBePartOfTrack.erase(Find);
745  ++iterTraceIDToRemove;
746  }
747  }
748  ++iter;
749  }
750  if ( !ioListMeshIDsToReassign.empty() )
751  {
752  MessageToPrint = "Warning: the meshIDs ";
753  std::list< unsigned int >::iterator iterIDs = ioListMeshIDsToReassign.begin();
754  while ( iterIDs != ioListMeshIDsToReassign.end() )
755  {
756  std::string temp = ConvertToString< unsigned int >(*iterIDs);
757  MessageToPrint += temp;
758  MessageToPrint += ", ";
759  ++iterIDs;
760  }
761  MessageToPrint = MessageToPrint.substr(0, MessageToPrint.size() - 1);
762  MessageToPrint += "have not been reassigned ";
763  MessageToPrint += "to the trackID because several meshes were selected for the same ";
764  MessageToPrint += "timepoints ";
765 
766  iter = TimePointsWithSeveralMeshes.begin();
767 
768  while ( iter != TimePointsWithSeveralMeshes.end() )
769  {
770  std::string temp = ConvertToString< unsigned int >(*iter);
771  MessageToPrint += temp;
772  MessageToPrint += ", ";
773  ++iter;
774  }
775  MessageToPrint = MessageToPrint.substr(0, MessageToPrint.size() - 2);
776  }
777  }
778  return MessageToPrint;
779 }
780 
781 //-------------------------------------------------------------------------
782 
783 //-------------------------------------------------------------------------
784 std::list< unsigned int >
786  unsigned int iTrackID, vtkMySQLDatabase *iDatabaseConnector,
787  std::list< unsigned int > iListMeshesBelongingToTrack)
788 {
789  std::list< unsigned int > oListMeshesTimePointInf = std::list< unsigned int >();
790  std::pair< unsigned int, unsigned int > InfoSplitMesh =
791  this->GetInfoForTheOnlyOneCheckedMeshOfTheTrack(iDatabaseConnector, iTrackID);
792  if ( InfoSplitMesh.first != 0 )
793  {
794  oListMeshesTimePointInf = this->m_CollectionOfTraces->GetTraceIDsWithTimePointInf(
795  iDatabaseConnector, iListMeshesBelongingToTrack, InfoSplitMesh.second);
796  //oListMeshesTimePointSup.push_back(InfoSplitMesh.first);
797  }
798  return oListMeshesTimePointInf;
799 }
800 
801 //-------------------------------------------------------------------------
802 
803 //-------------------------------------------------------------------------
804 std::pair< unsigned int, unsigned int > QGoDBMeshManager::GetInfoForTheOnlyOneCheckedMeshOfTheTrack(
805  vtkMySQLDatabase *iDatabaseConnector,
806  unsigned int
807  iTrackID)
808 {
809  std::pair< unsigned int, unsigned int > oInfo =
810  std::pair< unsigned int, unsigned int >(0, 0);
811  std::list< unsigned int > ListCheckedMeshes =
813  std::list< unsigned int > ListCheckedMeshesBelongingToTrackID =
814  std::list< unsigned int >();
815  if ( !ListCheckedMeshes.empty() )
816  {
817  ListCheckedMeshesBelongingToTrackID =
819  iDatabaseConnector, ListCheckedMeshes, iTrackID);
820  }
821  if ( ListCheckedMeshesBelongingToTrackID.size() != 1 )
822  {
823  QMessageBox msgBox;
824  msgBox.setText(
825  tr("Please select one and only one Mesh where to split the Track") );
826  msgBox.exec();
827  return oInfo;
828  }
829 
830  unsigned int CheckedMesh = ListCheckedMeshesBelongingToTrackID.front();
831  oInfo.first = CheckedMesh;
832  std::list< unsigned int > MeshesIDs;
833  MeshesIDs.push_back(CheckedMesh);
834  std::list< unsigned int > ListTimePoints =
835  this->m_CollectionOfTraces->GetTimePointsForTraceIDs(iDatabaseConnector, MeshesIDs);
836 
837  if ( ListTimePoints.size() != 1 )
838  {
839  std::cout << "more than one timepoint";
840  std::cout << "Debug: In " << __FILE__ << ", line " << __LINE__;
841  std::cout << std::endl;
842  return oInfo;
843  }
844  oInfo.second = ListTimePoints.front();
845  return oInfo;
846 }
847 //-------------------------------------------------------------------------
848 
849 //-------------------------------------------------------------------------
850 std::list< QGoDBTraceManager::NameWithColorData >
852  vtkMySQLDatabase *iDatabaseConnector, std::string & ioIDToSelect)
853 {
854  ioIDToSelect = this->m_LastSelectedTraceAsCollection;
856  iDatabaseConnector, *this->m_CurrentTimePoint);
857 }
858 //-------------------------------------------------------------------------
859 
860 //-------------------------------------------------------------------------
861 std::list< std::pair<unsigned int, double> >
864 {
865  std::list< std::pair<unsigned int, double> > oList;
866 
867  QGoTableWidget* tableWidget = this->GetTableWidget();
868 
869  std::list<unsigned int> list = this->GetListHighlightedIDs();
870  std::list<unsigned int>::iterator it = list.begin();
871 
872  while(it!=list.end())
873  {
874  double volume = (tableWidget->GetValue( *it, "mesh", "Volume" )).toDouble();
875  int trackID = (tableWidget->GetValue( *it, "mesh", "trackID" )).toInt();
876 
877  std::pair<unsigned int, double> trackAndVolume(trackID, volume);
878  oList.push_back(trackAndVolume);
879  ++it;
880  }
881 
882  return oList;
883 
884 }
885 //-------------------------------------------------------------------------
886 
887 //-------------------------------------------------------------------------
888 std::list< std::pair<unsigned int, double> >
890 GetListVolumes(const std::list<unsigned int> & iMeshIDs)
891 {
892  std::list< std::pair<unsigned int, double> > oList;
893  QGoTableWidget* tableWidget = this->GetTableWidget();
894 
895  std::list<unsigned int>::const_iterator it = iMeshIDs.begin();
896 
897  while(it!=iMeshIDs.end())
898  {
899  double volume = (tableWidget->GetValue( *it, "mesh", "Volume" )).toDouble();
900  int trackID = (tableWidget->GetValue( *it, "mesh", "trackID" )).toInt();
901 
902  std::pair<unsigned int, double> trackAndVolume(trackID, volume);
903  oList.push_back(trackAndVolume);
904  ++it;
905  }
906 
907  return oList;
908 
909 }
910 //-------------------------------------------------------------------------
911 
912 //-------------------------------------------------------------------------
913 double
915 GetVolume(unsigned int iMeshID)
916 {
917  return (this->GetTableWidget()->GetValue( iMeshID, "mesh", "Volume" )).toDouble();
918 }
919 //-------------------------------------------------------------------------
920 
921 //-------------------------------------------------------------------------
922 void
924 CleanTWAndContainerForGivenTimePoint(vtkMySQLDatabase *iDatabaseConnector,
925  const std::list<unsigned int>& iTimePoints)
926 {
927  this->RemoveTracesFromTWAndContainerForVisuForSpecificTPsTemplate<MeshContainer>(
928  iDatabaseConnector, this->m_MeshContainerInfoForVisu, iTimePoints);
929 }
930 //-------------------------------------------------------------------------
931 
932 //-------------------------------------------------------------------------
933 void
935 ModifyTrackIDInVisuContainer(unsigned int iTrackID,
936  const std::list< unsigned int > & iToTrack,
937  const std::list< unsigned int > & iToNull)
938 {
941 }
virtual void SetColorCoding(bool IsChecked)
std::pair< unsigned int, unsigned int > GetInfoForTheOnlyOneCheckedMeshOfTheTrack(vtkMySQLDatabase *iDatabaseConnector, unsigned int iTrackID)
check that there is one and only one mesh checked belonging to the track and return its ID and its ti...
virtual std::list< NameWithColorData > GetAllTraceIDsWithColor(vtkMySQLDatabase *iDatabaseConnector, std::string &ioIDToSelect)
return the distinct traces with their color for the imagingsession, for all timepoints if the timepoi...
void UpdateValueForListTraces(vtkMySQLDatabase *iDatabaseConnector, std::string iNameValue, std::string iValue, std::list< unsigned int > iListTraceIDs)
update in the database the iNameValue with iValue for the traces from iListTraceIDs ...
MeshContainer * GetMeshesInfoFromDBAndCreateContainerForVisu(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListCollectionIDs)
get the info needed from the database for the meshes who belongs to the collectionIDs contained in iL...
void ModifyTrackIDInVisuContainer(unsigned int iTrackID, const std::list< unsigned int > &iToTrack, const std::list< unsigned int > &iToNull)
std::list< NameWithColorData > GetTracesIDsWithColorForATimePoint(vtkMySQLDatabase *iDatabaseConnector, unsigned int iTimePoint)
get all the distinct traces IDs with their QColor for a given timepoint
std::map< unsigned int, double * > GetMeshesPoints(std::list< unsigned int > iMeshID)
int CreateCollectionWithNoTracesNoPoints(vtkMySQLDatabase *iDatabaseConnector, NameWithColorData iColor, T iNewCollection, int iTimePoint=-1)
save the collection in the database after getting an empty bounding box and return the corresponding ...
std::list< unsigned int > UpdateTheTracesColor(vtkMySQLDatabase *iDatabaseConnector)
virtual pure method in QGoDBTraceManager
virtual void DisplayInfoForExistingTrace(vtkMySQLDatabase *iDatabaseConnector, int iTraceID)
Virtual pure method: get the data needed from the database for the existing trace with iTraceID and u...
virtual void DisplayInfoForLastCreatedTrace(vtkMySQLDatabase *iDatabaseConnector)
Virtual pure method: get the data needed from the database for the last created trace and display the...
virtual void AddActionsContextMenu(QMenu *iMenu)
std::string CheckListMeshesFromDifferentTimePoints(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListMeshIDs, std::list< unsigned int > &ioListMeshIDsToBePartOfTrack, std::list< unsigned int > &ioListMeshIDsToReassign)
check if in the iListMeshIDs, several have the same timepoint, if so, return the list of meshIDs that...
void SetTheDataFromTheVisu(vtkMySQLDatabase *DatabaseConnector, vtkPolyData *TraceVisu, GoDBCoordinateRow iCoordMin, GoDBCoordinateRow iCoordMax, GoFigureMeshAttributes *iMeshAttributes)
virtual void UpdateTWAndContainerForImportedTraces(const std::vector< int > &iVectorImportedTraces, vtkMySQLDatabase *iDatabaseConnector)
get the data needed from the database for the imported traces,display them in new inserted rows of th...
unsigned int CreateNewMeshWithNoContourNoPoints(vtkMySQLDatabase *iDatabaseConnector)
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...
void UpdateCurrentElementFromDB(unsigned int iTraceID, double irgba[4], bool IsVisible=false)
Update Current Element from te database.
void DisplayInfoAndLoadVisuContainerWithAllTraces(T *iTWContainer, vtkMySQLDatabase *iDatabaseConnector)
get all the data from the database to load all the traces for the imagingsession into the table widge...
std::string m_CollectionName
QString CheckExistingMeshesForTheTrack(unsigned int iTrackID, vtkMySQLDatabase *iDatabaseConnector, int iTCoord)
if the track has already a mesh assigned for the current timepoint, the track of the previous mesh wi...
void addAction(QAction *action)
MeshContainer * m_MeshContainerInfoForVisu
void SetCollectionID(unsigned int iCollectionID)
set the collectionID field to iCollectionID
Abstract class inherited by QGoDBContourManager,Mesh,Track,Lineage.
void UpdateSubCellType()
update the subcelltype of the checked meshes with the selected one
int GetIndexShowColumn()
return the index of the column in the RowContainer corresponding to the show/hide column ...
void AddNewTraceIDInTS(std::pair< std::string, QColor > iTraceToAddData)
signal emitted when a new trace is created that need to be added in the trace settings widget...
double GetVolume(unsigned int iMeshID)
Get volume of given mesh ID.
std::list< std::pair< unsigned int, double > > GetListVolumes()
Get volume of checked mesh IDs.
virtual void GetTracesInfoFromDBAndModifyContainerForVisu(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iVectIDs=std::list< unsigned int >())
get the info needed from the database to update the container for visu
void AddSpecificActionsForContourMesh(QMenu *iMenu)
NameWithColorData * m_SelectedColorData
void UpdateBoundingBoxes(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTracesIDs)
update the bounding boxes for the meshes with no points
int GetMaxTraceIDsForSpecificTimePoint(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTraceIDs, unsigned int iTimePoint)
get the max of the IDs for the traceIDs in iListTraceIDs that have a timepoint equal to iTimePoint ...
void Insert(const MultiIndexContainerElementType &iE)
Insert one element in the container.
static int GetSubCellTypeID(vtkMySQLDatabase *iDatabaseConnector, std::string iSubCellTypeName)
static method.get the SubCellTypeID base on the name of the subcelltype
void DisplayInfoAndLoadVisuContainerForAllMeshesForSpecificTPs(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTPs)
manages a map with keys matching fields of the gofiguredatabase Coordinate table and values of the ma...
std::string * m_SelectedSubCellType
QString tr(const char *sourceText, const char *disambiguation, int n)
GoDBTWContainerForMesh * m_TWContainer
std::string m_CollectionOf
void AssignToGivenCollection(unsigned int iCollection, std::list< unsigned int > iToBeAssigned)
NameWithColorData * m_SelectedCollectionData
std::list< unsigned int > GetTraceIDsBelongingToListTimePoints(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTPs)
unsigned int SaveNewMeshWithNoTrackFromVisu(unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin, unsigned int iXCoordMax, unsigned int iYCoordMax, unsigned int iZCoordMax, int iTShift, vtkPolyData *iTraceNodes, vtkMySQLDatabase *iDatabaseConnector, GoFigureMeshAttributes *iMeshAttributes)
This class describes the specificities of the GoDBTWContainerForContourMesh for mesh.
virtual void SetCollectionsTraceNames()
virtual pure method: set the std::string class members
QString number(int n, int base)
void SaveGeneratedMeshFromVisu(unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin, unsigned int iXCoordMax, unsigned int iYCoordMax, unsigned int iZCoordMax, vtkPolyData *iTraceNodes, vtkMySQLDatabase *iDatabaseConnector, GoFigureMeshAttributes *iMeshAttributes)
std::list< unsigned int > GetTimePointsForTraceIDs(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTraceIDs)
get the timepoints (non distinct) for all the traceIDs in iListTraceIDs
std::list< unsigned int > GetListTracesIDsBelongingToCollectionIDs(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListCollectionIDs)
get the list of tracesIDs belonging to the collection listed in iListCollectionIDs ...
double * GetVectorFromQColor(QColor iColor)
return a double rgba[4] from a QColor
void UpdateTWAndContainerWithImportedTracesTemplate(T *iTWContainer, const std::vector< int > &iVectorTraceIDs, vtkMySQLDatabase *iDatabaseConnector)
update for the imported traces the table widget and the database info of the container for visu...
bool SetValuesForSpecificID(int ID, vtkMySQLDatabase *iDatabaseConnector)
QString GetValue(unsigned int iTraceID, const std::string &iTraceName, const std::string &iColumn)
inherits from the Qt class QTableWidget, manages all the interactions between the user and the data r...
virtual void DeleteCheckedTraces(vtkMySQLDatabase *iDatabaseConnector)
delete the checked traces from the database, the TW and the container for visu
std::list< unsigned int > GetHighlightedElementsTraceID()
Get the list of highlighted elements TraceID.
void DisplayOnlyVolumeAreaForExistingMesh(GoFigureMeshAttributes *iMeshAttributes, unsigned iMeshID)
display in the TW the volume and area extracted from iMeshAttributes called when loading all meshes f...
void UpdateCurrentElementCollection(unsigned int iCollectionID)
void setText(const QString &text)
virtual void DisplayInfoForAllTraces(vtkMySQLDatabase *iDatabaseConnector)
Virtual pure method: get the data needed from the database and display them in the m_Table for all tr...
std::string * m_SelectedCellType
void RemoveTracesFromTWAndContainerForVisuForSpecificTPs(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTPs)
void DisplayInfoForExistingTraceForMesh(vtkMySQLDatabase *iDatabaseConnector, int iTraceID, GoFigureMeshAttributes *iMeshAttributes)
virtual TWContainerType GetContainerLoadedWithAllFromDB(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTPs=std::list< unsigned int >())
get the results of the queries and put them in the row container corresponding to all the data needed...
GoDBCoordinateRow GetCoordinateFromInt(int iXCoord, int iYCoord, int iZCoord, int iTCoord)
create a GoDBCoordinateRow and set its fields X,Y,Z,Tcoord
virtual void UpdateVisibleElementsInVisuContainer(int iTraceID)
std::vector< int > GetIndexForGroupColor(std::string iGroupName)
get the results of the queries and put them in the row container corresponding to all the data needed...
void SetInfo(unsigned int iImgSessionID, QWidget *iParent)
set the variables class members
std::map< unsigned int, double * > GetMeshesInfoForImportedMesh(std::list< unsigned int > iMeshesIDs)
get the coordinate info for meshes needed for the visu for imported tracks
std::list< unsigned int > GetMeshesWithTimePointInfToTheCheckedOne(unsigned int iTrackID, vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListMeshesBelongingToTrack)
for the track, get the list of its meshes with a timepoint inferior than the checked mesh ...
void NeedToGetDatabaseConnection()
void CleanTWAndContainerForGivenTimePoint(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iTimePoints)
void SetSubCellType(vtkMySQLDatabase *DatabaseConnector, std::string SubCellTypeName)
put the value of map[&quot;SubCelltype&quot;] to SubCellTypeName
void DisplayInfoForLastCreatedMesh(vtkMySQLDatabase *iDatabaseConnector, GoFigureMeshAttributes *iMeshAttributes)
void SetMeshAttributes(GoFigureMeshAttributes *iMeshAttributes)
set m_MeshAttributes to iMeshAttributes, needs to be called before displaying the volume...
void SetCellType(vtkMySQLDatabase *DatabaseConnector, std::string CellTypeName)
put the value of map[&quot;Celltype&quot;] to CellTypeName
void InsertNewRows(const TWContainerType &iTWRowContainer, const std::vector< int > &iIndexColorTraceRowContainer, const std::vector< int > &iIndexColorCollectionRowContainer, const std::string &iTraceName, const std::string &iCollectionName, Qt::CheckState iVisible=Qt::Checked)
std::list< unsigned int > GetListTracesIDWithNoPoints(std::list< unsigned int > iListTracesIDs, vtkMySQLDatabase *iDatabaseConnector)
get the list of tracesIDs that have no points
std::list< unsigned int > GetTraceIDsBelongingToCollectionID(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTraceIDs, unsigned int iCollectionID)
get the tracesIDs contained in iListTraceIDs that have iCollectionID as a collectionID ...
QGoTableWidget * GetTableWidget()
get the m_Table
std::list< unsigned int > GetTraceIDsWithTimePointAndCollectionID(vtkMySQLDatabase *iDatabaseConnector, unsigned int iCollectionID, unsigned int iTimePoint)
get the tracesIDs from the database which have iTimePoint as TCoordMin and iCollectionID as collectio...
virtual void DisplayInfoForTracesForSpecificTPs(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTPs)
void ResetCurrentElement()
Reset Current Element to a default state.
void SetMeshesInfoContainerForVisu(MeshContainer *iContainerForVisu)
set the m_MeshContainerInfoForVisu to the iContainerForVisu
std::list< T > GetListStructureFromDB(vtkMySQLDatabase *iDatabaseConnector, unsigned int iImgSessionID, std::list< unsigned int > iListTraces)
get a list of structures filled with data from the database
MultiIndexContainerElementType m_CurrentElement
Current Element of the trace type.
Wraps a boost::multi_index_container of ContourMeshStructure. This class is specialized for the means...
Definition: MeshContainer.h:46
Structure which represent a contour or a mesh, and used for interaction between Visualization and Tab...
virtual void UpdateHighlightedElementsInVisuContainer(int iTraceID)
void UpdateCellType()
update the celltype of the checked meshes with the selected one
void AddInfoInTWAndVisuContainerForMeshesForSpecificTPs(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTPs)
static int GetCellTypeID(vtkMySQLDatabase *iDatabaseConnector, std::string iCellTypeName)
static method.get the CellTypeID base on the name of the celltype
std::list< unsigned int > GetTraceIDsWithTimePointInf(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTraceIDs, unsigned int iTimePoint)
get the tracesIDs belonging to iListTraceIDs with a timepoint inf to iTimePoint
this class manages the map with the keys matching the fields of the Mesh gofiguredatabase table and v...
Definition: GoDBMeshRow.h:55
virtual std::list< unsigned int > GetListHighlightedIDs()
std::string m_LastSelectedTraceAsCollection
std::pair< std::string, QColor > NameWithColorData
void AddValuesForID(const std::vector< std::string > &iColumnsNames, const std::vector< std::string > &iValues, unsigned int iID, const std::string &iColumnNameForTraceID)
add values in the table for the corresponding traceID and column names
GoDBTableWidgetContainer::TWContainerType TWContainerType
void DisplayInfoAndLoadVisuContainerForAllMeshes(vtkMySQLDatabase *iDatabaseConnector)
get all the data from the database to load all the meshes for the imagingsession into the table widge...
virtual int SaveInDB(vtkMySQLDatabase *DatabaseConnector)
save the row in the database if the TraceID is set to &quot;0&quot;, update the existing traceRow if the TraceI...
std::list< unsigned int > GetTimePointWithSeveralTracesFromTheList(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTraceIDs)
get the list of timepoints where several traces from the list of traces have the same ones ...
QGoTableWidget * m_Table
void DisplayInfoForExistingTraces(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTraces)
get the data from the database corresponding to the iListTraces and display them in the Table Widget ...
unsigned int CreateNewTraceInDB(T iTrace, vtkMySQLDatabase *iDatabaseConnector, NameWithColorData iColor, unsigned int iCollectionID)
set the bounding box, the color and the collectionID of the trace,save it in the database and return ...
QGoDBMeshManager(int iImgSessionID, QWidget *iparent)
void SetSelectedSubCellType(std::string *iSubCellType)
set the m_SelectedSubCelltype to iSubCelltype
vtkMySQLDatabase * m_DatabaseConnector
void DBConnectionNotNeededAnymore()
unsigned int ReassignTrackIDForPreviousMeshWithSameTimePoint(vtkMySQLDatabase *iDatabaseConnector, unsigned int iTrackID, unsigned int iTimePoint)
check in the database if there is an existing mesh belonging to iTrackID with iTimePoint, if yes, reassign the trackID to 0 and return the ID of the mesh with the new trackID set to 0.
void SetMeshBoundingBoxAndPoints(unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin, unsigned int iXCoordMax, unsigned int iYCoordMax, unsigned int iZCoordMax, vtkPolyData *iTraceNodes, vtkMySQLDatabase *iDatabaseConnector, GoDBMeshRow &iMesh, GoFigureMeshAttributes *iMeshAttributes, int iShift=0)
unsigned int SaveNewMeshFromVisu(unsigned int iXCoordMin, unsigned int iYCoordMin, unsigned int iZCoordMin, unsigned int iXCoordMax, unsigned int iYCoordMax, unsigned int iZCoordMax, int iTShift, vtkPolyData *iTraceNodes, vtkMySQLDatabase *iDatabaseConnector, GoFigureMeshAttributes *iMeshAttributes)
virtual void AddActionsContextMenu(QMenu *iMenu)
void AddInfoForMeshesInTWForSpecificTPs(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTPs)
void SetSelectedCellType(std::string *iCellType)
set the m_SelectedCelltype to iCelltype
std::list< unsigned int > GetNonMaxTraceIDsForSpecificTimePoint(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTraceIDs, unsigned int iTimePoint, unsigned int iMaxTraceID)
get all the traceIDs except the iMaxTraceID for the timepoint
std::list< unsigned int > GetListTimePointsFromTraceIDs(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTraceIDs)
get the list of timepoints for each trace in iListTraceIDs
GoDBCollectionOfTraces * m_CollectionOfTraces
void InsertCurrentElement()
Insert Current Element in the container.