GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoDBLineageManager.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 "QGoDBLineageManager.h"
36 #include "GoDBLineageRow.h"
37 #include "GoDBTrackRow.h"
38 #include "GoDBTrackFamilyRow.h"
39 #include <iostream>
40 #include <sstream>
41 
42 // directory for export
43  #include <QFileDialog>
44 #include <QString>
45 
46 //writer
47 #include "vtkSmartPointer.h"
48 #include "vtkTree.h"
49 #include "vtkTreeWriter.h"
50 #include "vtkMutableDirectedGraph.h"
51 #include "vtkGraphLayoutView.h"
52 #include "LineageStructure.h"
53 
54 QGoDBLineageManager::QGoDBLineageManager(int iImgSessionID, QWidget *iparent) :
55  QGoDBTraceManager(), m_LineageContainerInfoForVisu(NULL), m_TrackContainerInfoForVisu(NULL)
56 {
57  this->SetInfo(iImgSessionID, iparent);
58  this->m_TWContainer = new GoDBTWContainerForLineage(iImgSessionID);
59 }
60 
61 //-------------------------------------------------------------------------
62 
63 //-------------------------------------------------------------------------
65 {
66  if ( this->m_TWContainer )
67  {
68  delete this->m_TWContainer;
69  }
70 }
71 
72 //-------------------------------------------------------------------------
73 
74 //-------------------------------------------------------------------------
76  LineageContainer *iContainerForVisu, TrackContainer *iTrackContainerInfoForVisu)
77 {
78  this->SetTracesInfoContainerForVisuTemplate< LineageContainer >(
79  iContainerForVisu, &this->m_LineageContainerInfoForVisu);
80 
81  this->m_TrackContainerInfoForVisu = iTrackContainerInfoForVisu;
82 
83  // Connect signals
84  // actor picking in visualization
85  QObject::connect( m_TrackContainerInfoForVisu,
86  SIGNAL(UpdateLineageHighlightingFromTrackRootID(unsigned int)),
87  this,
88  SLOT( UpdateElementHighlighting(unsigned int) ) );
89 
90  // for a list of lineages
92  SIGNAL( HighlightLineage(const unsigned int&, const bool&) ),
93  m_TrackContainerInfoForVisu,
94  SLOT( HighlightCollection(const unsigned int&, const bool&) ) );
95 
97  SIGNAL( ShowLineage(const unsigned int&, const bool&) ),
98  m_TrackContainerInfoForVisu,
99  SLOT( ShowCollection(const unsigned int&, const bool&) ) );
100  // export lineage
102  SIGNAL( ExportLineages() ),
103  this,
104  SLOT( ExportLineages() ) );
105 }
106 
107 //-------------------------------------------------------------------------
108 
109 //-------------------------------------------------------------------------
111 {
112  this->m_TraceName = "lineage";
113  this->m_CollectionName = "None";
114  this->m_CollectionOf = "track";
115 }
116 
117 //-------------------------------------------------------------------------
118 
119 //-------------------------------------------------------------------------
121  vtkMySQLDatabase *iDatabaseConnector)
122 {
123  this->DisplayInfoForAllTracesTemplate< GoDBTWContainerForLineage >(
124  this->m_TWContainer, iDatabaseConnector, Qt::Unchecked);
125 }
126 
127 //-------------------------------------------------------------------------
128 
129 //-------------------------------------------------------------------------
131  vtkMySQLDatabase *iDatabaseConnector,
132  const std::list<unsigned int> & iListTPs)
133 {
134  (void) iListTPs;
135  this->DisplayInfoForAllTraces(iDatabaseConnector);
136 }
137 //-------------------------------------------------------------------------
138 
139 //-------------------------------------------------------------------------
140 
142  vtkMySQLDatabase *iDatabaseConnector)
143 {
144  this->m_Table->setSortingEnabled(false);
145 
146  std::vector< int > VectorIDs = this->m_TWContainer->GetAllTraceIDsInContainer();
147  std::list<unsigned int> ListIDs(VectorIDs.begin(), VectorIDs.end());
148 
149  std::list<LineageStructure> list_of_traces =
151  iDatabaseConnector, this->m_ImgSessionID, ListIDs);
152 
155 
156  std::list<LineageStructure>::iterator it = list_of_traces.begin();
157  while ( it != list_of_traces.end() )
158  {
159  LineageStructure Lineage = *it;
160  GoFigureLineageAttributes Attributes =
162  Lineage.TrackRootID, Lineage.rgba);
164  this->m_TWContainer->SetLineageAttributes(Attributes);
165  this->InsertLineageInTW(iDatabaseConnector, Lineage.TraceID);
166  ++it;
167  }
168 
169  this->m_Table->setSortingEnabled(true);
171 }
172 
173 //-------------------------------------------------------------------------
174 
175 //-------------------------------------------------------------------------
176 void QGoDBLineageManager::InsertLineageInTW(vtkMySQLDatabase *iDatabaseConnector,
177  unsigned int iTraceID)
178  {
179  TWContainerType RowContainer =
180  this->m_TWContainer->GetContainerForOneSpecificTrace(iDatabaseConnector,
181  iTraceID);
182 
183 
184  // insert is buggy on sorted table
185  // 1- unsort (if sorted)
186  // 2- insert
187  // 3- sort (if sorted)
188  bool sorting = this->m_Table->isSortingEnabled();
189  if(sorting)
190  {
191  this->m_Table->setSortingEnabled(false);
192  }
193  this->m_Table->InsertOnlyOneNewRow(RowContainer,
194  this->m_TWContainer->GetIndexForGroupColor(this->m_TraceName),
196  this->m_TraceName, this->m_CollectionName, Qt::Unchecked);
197  if(sorting)
198  {
199  this->m_Table->setSortingEnabled(true);
200  }
201  }
202 //-------------------------------------------------------------------------
203 
204 //-------------------------------------------------------------------------
206  vtkMySQLDatabase *iDatabaseConnector)
207 {
208  this->DisplayInfoForLastCreatedTraceTemplate< GoDBTWContainerForLineage >(
209  this->m_TWContainer, iDatabaseConnector);
210 }
211 
212 //-------------------------------------------------------------------------
213 
214 //-------------------------------------------------------------------------
216  vtkMySQLDatabase *iDatabaseConnector, int iTraceID)
217 {
218  this->DisplayInfoForExistingTraceTemplate< GoDBTWContainerForLineage >(
219  this->m_TWContainer, iDatabaseConnector, iTraceID);
220 }
221 
222 //-------------------------------------------------------------------------
223 
224 //-------------------------------------------------------------------------
226  vtkMySQLDatabase *iDatabaseConnector, unsigned int iTrackRoot)
227 {
228  GoDBLineageRow NewLineage;
229  unsigned int NewLineageID =
231  iDatabaseConnector, *this->m_SelectedColorData, NewLineage);
232  this->UpdateTrackRootSelectedLineage(iDatabaseConnector, NewLineageID, iTrackRoot);
233  // pointer to double has to be deleted after usage...
234  double* color = this->GetVectorFromQColor(this->m_SelectedColorData->second);
235  this->m_LineageContainerInfoForVisu->InsertNewLineage(NewLineageID, color
236  , iTrackRoot,
237  true);
238  delete[] color;
239  this->DisplayInfoForLastCreatedTrace(iDatabaseConnector);
240 
241  return NewLineageID;
242 }
243 
244 //-------------------------------------------------------------------------
245 
246 //-------------------------------------------------------------------------
248  vtkMySQLDatabase *iDatabaseConnector)
249 {
251  LineageContainer >(iDatabaseConnector, this->m_LineageContainerInfoForVisu);
252 
253  std::list< unsigned int > oList = this->GetListHighlightedIDs();
254 
255  std::list< unsigned int >::iterator it = oList.begin();
256  while( it != oList.end() )
257  {
258  // pointer to double has to be deleted after usage...
259  double* color = this->GetVectorFromQColor(this->m_SelectedColorData->second);
260  unsigned int trackRoot = this->m_LineageContainerInfoForVisu->GetLineageTrackRootID(*it);
262  delete[] color;
263  ++it;
264  }
265 
266  return oList;
267 }
268 
269 //-------------------------------------------------------------------------
270 
271 //-------------------------------------------------------------------------
273  const std::vector< int > & iVectorImportedTraces,
274  vtkMySQLDatabase *iDatabaseConnector)
275 {
276  //this->UpdateTWAndContainerWithImportedTracesTemplate<
277  // GoDBTWContainerForLineage >(this->m_TWContainer,
278  // iVectorImportedTraces, iDatabaseConnector);
279 
280 }
281 
282 //-------------------------------------------------------------------------
283 
284 //-------------------------------------------------------------------------
285 void QGoDBLineageManager::DeleteCheckedTraces(vtkMySQLDatabase *iDatabaseConnector)
286 {
287  this->DeleteListTraces(iDatabaseConnector, this->GetListHighlightedIDs() );
288 }
289 
290 //-------------------------------------------------------------------------
291 
292 //-------------------------------------------------------------------------
294 DeleteListTraces(vtkMySQLDatabase *iDatabaseConnector,
295  const std::list< unsigned int > & iListTraces)
296 {
297  //delete the lineages from the visu, the database and the TW:
298  this->DeleteTracesTemplate< LineageContainer >(iDatabaseConnector,
299  this->m_LineageContainerInfoForVisu, iListTraces, false);
300 }
301 
302 //-------------------------------------------------------------------------
303 
304 //-------------------------------------------------------------------------
306 {
308 }
309 
310 //-------------------------------------------------------------------------
311 // From table widget
312 //-------------------------------------------------------------------------
314  int iTraceID)
315 {
316  // update lineage container element (invert highlighted boolean)
318  UpdateElementHighlightingWithGivenTraceID(iTraceID);
319  //get root track id
320  unsigned int trackRootID = this->m_LineageContainerInfoForVisu->
321  GetLineageTrackRootID(iTraceID);
322  // is the lineage highlighted?
323  bool highlighted = this->m_LineageContainerInfoForVisu->
324  GetLineageHighlighted(iTraceID);
325  // update divisions
326  this->m_TrackContainerInfoForVisu->HighlightCollection(trackRootID, highlighted);
327 }
328 
329 //-------------------------------------------------------------------------
330 
331 //-------------------------------------------------------------------------
333 {
334  // update container element (invert visible bool)
336  UpdateElementVisibilityWithGivenTraceID(iTraceID);
337  //get root track id
338  unsigned int trackRootID = this->m_LineageContainerInfoForVisu->
339  GetLineageTrackRootID(iTraceID);
340  // is the lineage visible?
341  bool visible = this->m_LineageContainerInfoForVisu->
342  GetLineageVisibile(iTraceID);
343  // update divisions
344  this->m_TrackContainerInfoForVisu->ShowCollection(trackRootID, visible);
345 }
346 
347 //-------------------------------------------------------------------------
348 
349 //-------------------------------------------------------------------------
351  vtkMySQLDatabase *iDatabaseConnector,
352  std::list< unsigned int > iListTraceIDs)
353 {
354  std::list<LineageStructure> list_of_traces =
356  iDatabaseConnector, this->m_ImgSessionID, iListTraceIDs);
357  std::list<LineageStructure>::iterator it = list_of_traces.begin();
358  while ( it != list_of_traces.end() )
359  {
360  LineageStructure Lineage = *it;
362  Lineage.TrackRootID, Lineage.rgba);
364  ++it;
365  }
366 }
367 
368 //-------------------------------------------------------------------------
369 
370 //-------------------------------------------------------------------------
372 {
373  std::string ColumnName = "";
374  std::map<unsigned int, std::string> Values;
375  std::map<unsigned int, std::string> NewValues;
376  m_IsColorCodingOn = IsChecked;
377  //create map track ID/field
378  if (IsChecked)
379  {
380  Values = this->m_Table->GetTraceIDAndColumnsValues(
381  this->m_TraceNameID, ColumnName);
382 
383  // change lineage id by track root id
384  std::map<unsigned int, std::string>::iterator trackRootIt = Values.begin();
385  while(trackRootIt != Values.end())
386  {
387  unsigned int trackRoot =
389  NewValues.insert(
390  std::pair<unsigned int,std::string>(trackRoot, trackRootIt->second) );
391  ++trackRootIt;
392  }
393 
394  vtkLookupTable* LUT = NULL;
395 
396  bool IsRandomIncluded =
397  (ColumnName == this->m_TraceNameID) ||
398  (ColumnName == this->m_CollectionNameID);
399 
400  QGoColorCodingDialog::ColorWay UserColorway =
402  IsRandomIncluded, this->m_Table );
403 
404  switch ( UserColorway )
405  {
407  m_TrackContainerInfoForVisu->SetCollectionColorCode( ColumnName,NewValues );
408  break;
409 
411  m_TrackContainerInfoForVisu->SetDivisionRandomColor(ColumnName,NewValues );
412  break;
413 
415  m_TrackContainerInfoForVisu->SetCollectionColorCode( ColumnName,NewValues );
417  break;
418 
419  default:
421  m_IsColorCodingOn = !IsChecked;
422  break;
423  }
424  }
425  else
426  {
427  m_TrackContainerInfoForVisu->SetCollectionColorCode( ColumnName, NewValues );
428  }
429 }
430 
431 //-------------------------------------------------------------------------
432 
433 //-------------------------------------------------------------------------
435  vtkMySQLDatabase* iDatabaseConnector,
436  unsigned int iLineageID, unsigned int iTrackIDRoot)
437 {
438  GoDBLineageRow LastLineage;
439  LastLineage.SetValuesForSpecificID(iLineageID, iDatabaseConnector);
440  LastLineage.SetField("TrackIDRoot", iTrackIDRoot);
441  LastLineage.SaveInDB(iDatabaseConnector);
442 }
443 //-------------------------------------------------------------------------
444 // actor picking
445 //-------------------------------------------------------------------------
446 void
448 UpdateElementHighlighting(unsigned int iTraceRootID)
449 {
450  unsigned int lineageID = this->m_LineageContainerInfoForVisu->GetTraceIDFromTrackRootID(
451  iTraceRootID);
453 }
454 //-------------------------------------------------------------------------
455 
456 //-------------------------------------------------------------------------
457 void
460 {
461  //get path to export somewhere
462  QString dir = QFileDialog::getExistingDirectory(NULL, tr("Choose Directory"));
463  //get lineages info
464  std::list<unsigned int> rootIDs =
466 
467  std::list<unsigned int> lineageIDs =
469 
470  std::list<unsigned int>::iterator itLineage = lineageIDs.begin();
471  std::list<unsigned int>::iterator itTrack = rootIDs.begin();
472 
473  // export all the lineages
474  while(itLineage != lineageIDs.end() )
475  {
476  vtkMutableDirectedGraph* graph =
478 
479  vtkSmartPointer<vtkTree> tree =
480  vtkSmartPointer<vtkTree>::New();
481  tree->CheckedDeepCopy(graph);
482 
483  //save tree
484  vtkSmartPointer<vtkTreeWriter> writer =
485  vtkSmartPointer<vtkTreeWriter>::New();
486  writer->SetInput(tree);
487  QString name(dir);
488  name.append("/lineage_");
489  name.append( QString::number(*itLineage, 10) );
490  name.append(".vtk");
491  writer->SetFileName(name.toLocal8Bit().data());
492  writer->Write();
493 
494  graph->Delete();
495 
496  ++itLineage;
497  ++itTrack;
498  }
499 }
500 //-------------------------------------------------------------------------
501 
502 //-------------------------------------------------------------------------
503 void
505 UpdateBoundingBoxes(vtkMySQLDatabase *iDatabaseConnector,
506  const std::list< unsigned int > & iListTracesIDs,
507  bool UpdateTW)
508 {
510  iDatabaseConnector, iListTracesIDs);
511 
512  std::list<unsigned int>::const_iterator iter = iListTracesIDs.begin();
513 
514  while(iter != iListTracesIDs.end() )
515  {
516  std::list<unsigned int> Listiter;
517  Listiter.push_back(*iter);
518  //need to check first that the lineage does exist, which corresponds to check if there are tracks that have this lineageid:
519  if (!this->m_CollectionOfTraces->GetListTracesIDsFromThisCollectionOf(iDatabaseConnector, Listiter).empty())
520  {
521  this->UpdateDivisionsInTrackContainer(*iter);
522  if ( UpdateTW )
523  {
524  this->DisplayInfoForExistingTrace(iDatabaseConnector, *iter);
525  }
526  }
527  ++iter;
528  }
529 }
530 //-------------------------------------------------------------------------
531 
532 //-------------------------------------------------------------------------
534 {
535  unsigned int root =
537  double* color = this->m_LineageContainerInfoForVisu->GetLineageColor(iLineageID);
538 
539  GoFigureLineageAttributes Attributes;
540  if(color)
541  {
542  Attributes = m_TrackContainerInfoForVisu->UpdateDivisionsForALineage(root, color);
543  }
544  else
545  {
547  }
548 
549  this->m_TWContainer->SetLineageAttributes(Attributes);
550 }
551 //-------------------------------------------------------------------------
552 
553 //-------------------------------------------------------------------------
555 {
556  std::list<unsigned int> ListLineagesToDelete =
557  this->GetListHighlightedIDs();
558  if ( QGoDBTraceManager::CheckThatThereAreTracesToDelete(ListLineagesToDelete) )
559  {
562  this->m_DatabaseConnector, ListLineagesToDelete );
564 
565  emit CheckedTracesToDelete();
566  }
567 }
568 //-------------------------------------------------------------------------
569 
570 //-------------------------------------------------------------------------
572  vtkMySQLDatabase *iDatabaseConnector,
573  const std::list<unsigned int> & iLineagesID)
574 {
575  std::list<unsigned int> TrackFamiliesToDelete =
576  this->m_CollectionOfTraces->GetTrackFamiliesForLineages(iDatabaseConnector, iLineagesID);
577 
578  std::list<unsigned int>::iterator iter = TrackFamiliesToDelete.begin();
579  while(iter != TrackFamiliesToDelete.end() )
580  {
581  if (*iter != 0)
582  {
583  this->DeleteADivision(iDatabaseConnector, *iter);
584  }
585  ++iter;
586  }
587 }
588 //-------------------------------------------------------------------------
589 
590 //-------------------------------------------------------------------------
592  vtkMySQLDatabase *iDatabaseConnector, unsigned int iTrackFamilyID)
593 {
594  GoDBTrackFamilyRow TrackFamily(iTrackFamilyID, iDatabaseConnector);
595 
596  //update the trackfamilyID of the daughter:
597  GoDBTrackRow Daughter(TrackFamily.GetMapValue<unsigned int>("TrackIDDaughter1"), iDatabaseConnector);
598  Daughter.SetField("TrackFamilyID", 0);
599  Daughter.SaveInDB(iDatabaseConnector);
600  Daughter.SetValuesForSpecificID(TrackFamily.GetMapValue<unsigned int>("TrackIDDaughter2"), iDatabaseConnector);
601  Daughter.SetField("TrackFamilyID", 0);
602  Daughter.SaveInDB(iDatabaseConnector);
603 
604  //delete the division in the visu
606  TrackFamily.GetMapValue<unsigned int>("TrackIDMother") );
607 
608  //delete the division from the database:
609  TrackFamily.DeleteFromDB(iDatabaseConnector);
610 }
std::string m_CollectionNameID
unsigned int TrackRootID
virtual void UpdateHighlightedElementsInVisuContainer(int iTraceID)
void InsertLineageInTW(vtkMySQLDatabase *iDatabaseConnector, unsigned int iTraceID)
virtual TWContainerType GetContainerForOneSpecificTrace(vtkMySQLDatabase *iDatabaseConnector, int iTraceID)
get the results of the queries and put them in the row container corresponding to all the data needed...
QString & append(QChar ch)
QString getExistingDirectory(QWidget *parent, const QString &caption, const QString &dir, QFlags< QFileDialog::Option > options)
virtual void DisplayInfoForLastCreatedTrace(vtkMySQLDatabase *iDatabaseConnector)
Virtual pure method: get the data needed from the database for the last created trace and display the...
void DeleteDivisionsForLineages(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iLineageID)
delete the divisions of a lineage in the database and in the visu
void UpdateTrackRootSelectedLineage(vtkMySQLDatabase *iDatabaseConnector, unsigned int iLineageID, unsigned int iTrackIDRoot)
update the trackID root for the lineage with iTrackIDRoot
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 CreateNewLineageWithTrackRoot(vtkMySQLDatabase *iDatabaseConnector, unsigned int iTrackRoot)
create a new lineage with IDRoot in the database, add it in the TW and in the visu container ...
void SetLineagesInfoContainersForVisu(LineageContainer *iContainerForVisu, TrackContainer *iTrackContainerInfoForvisu)
set the m_LineageContainerInfoForVisu and the m_TrackContainerInfoForVisu to the iContainerForVisu an...
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 ...
void resizeColumnsToContents()
virtual void SetColorCoding(bool IsChecked)
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...
void DeleteFromDB(vtkMySQLDatabase *iDatabaseConnector)
delete from the database the row which has the same TableID
Definition: GoDBRow.cxx:273
std::string m_CollectionName
virtual std::list< unsigned int > GetListHighlightedIDs()
void CheckedTracesToDelete()
signal emitted when the user click on the action &quot;DeleteTraces&quot; from the context menu as it can impac...
void setSortingEnabled(bool enable)
virtual void SetCollectionsTraceNames()
virtual pure method: set the std::string class members
Abstract class inherited by QGoDBContourManager,Mesh,Track,Lineage.
void SetCollectionColorCode(const std::string &iColumnName, const std::map< unsigned int, std::string > &iValues)
std::list< unsigned int > UpdateTheTracesColor(vtkMySQLDatabase *iDatabaseConnector)
virtual pure. update the color of the checked traces in the database, the visu container and the TW a...
void HighlightCollection(const unsigned int &iRootTrackID, const bool &iHighlighted)
NameWithColorData * m_SelectedColorData
vtkMutableDirectedGraph * ExportLineage(const unsigned int &iTrackID)
void Insert(const MultiIndexContainerElementType &iE)
Insert one element in the container.
void SetLookupTableForAllDivisionsColorCoding(const vtkLookupTable *iLut)
QString tr(const char *sourceText, const char *disambiguation, int n)
std::string m_CollectionOf
manages a map with keys matching fields of the gofiguredatabase TrackFamily table and values of the m...
void DeleteADivision(const unsigned int &iMotherID)
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< std::pair< std::string, std::string > > GetListColumnsNamesAndToolTipsForTableWidget()
Return a list with all the ColumnNames and tooltips to be displayed in the tableWidget.
std::map< unsigned int, std::string > GetTraceIDAndColumnsValues(const std::string &iTraceIDName, std::string &ioColumnName)
GoDBTWContainerForLineage * m_TWContainer
const char * name() const
virtual void DeleteTracesFromContextMenu()
std::list< unsigned int > GetListOfTrackRootIDs()
void DisplayInfoAndLoadVisuContainerForAllLineages(vtkMySQLDatabase *iDatabaseConnector)
get all the data from the database to load all the lineages for the imagingsession into the table wid...
this class manages the map with the keys matching the fields of the Lineage gofiguredatabase table an...
QGoDBLineageManager(int iImgSessionID, QWidget *iparent)
QString number(int n, int base)
void DeleteADivision(vtkMySQLDatabase *iDatabaseConnector, unsigned int iTrackFamilyID)
double * GetVectorFromQColor(QColor iColor)
return a double rgba[4] from a QColor
std::list< unsigned int > GetListTracesIDsFromThisCollectionOf(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTraces)
get the list of IDs belonging to the iListTraces as collectionof
bool SetValuesForSpecificID(int ID, vtkMySQLDatabase *iDatabaseConnector)
this class manages the map with the keys matching the fields of the Track gofiguredatabase table and ...
Definition: GoDBTrackRow.h:49
std::vector< int > GetAllTraceIDsInContainer()
return all the traces IDs present in the RowContainer
void SetLineageAttributes(GoFigureLineageAttributes iLineageAttributes)
virtual void DisplayInfoForTracesForSpecificTPs(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTPs)
std::list< unsigned int > GetHighlightedElementsTraceID()
Get the list of highlighted elements TraceID.
void RecalculateDBBoundingBox(vtkMySQLDatabase *iDatabaseConnector, int iCollectionID)
Calculate the bounding box of the corresponding collection and update it in the database.
virtual void UpdateVisibleElementsInVisuContainer(int iTraceID)
virtual void GetTracesInfoFromDBAndModifyContainerForVisu(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iListTraceIDs=std::list< unsigned int >())
get the info needed from the database to update the container for visu
std::list< unsigned int > GetListOfLineageIDs()
unsigned int GetTraceIDFromTrackRootID(const unsigned int &iTraceID)
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::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
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...
unsigned int TraceID
Structure which represent a lineage, and used for interaction between Visualization and TableWidget...
void NeedToGetDatabaseConnection()
QByteArray toLocal8Bit() const
Wraps a boost multi index container of LineageStructure. This class intends to synchronize Lineage re...
std::list< unsigned int > UpdateTheTracesColorTemplate(vtkMySQLDatabase *iDatabaseConnector, C *iContainerInfoForVisu)
update the visu container, the database and the TW with the user selected color for the highlighted t...
GoFigureLineageAttributes UpdateDivisionsForALineage(unsigned int iTrackIDRoot, double *color)
update the color and the divisions scalars of an all lineage which has iTrackIDRoot as track root ...
std::list< unsigned int > GetTrackFamiliesForLineages(vtkMySQLDatabase *iDatabaseConnector, std::list< unsigned int > iLineagesID)
void UpdateDivisionsInTrackContainer(unsigned int iLineageID)
void UpdateCollectionColorsData(const unsigned int &iTrackID, const double *color)
void InsertOnlyOneNewRow(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)
Insert a new row and fill the cells with the data contained in the RowContainer.
bool CheckThatThereAreTracesToDelete(const std::list< unsigned int > &iListTracesIDToDelete)
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
void SetField(const std::string &key, const T &value)
convert the value into a string and assign it to the key in the map
Definition: GoDBRow.h:73
void UpdateElementHighlighting(unsigned int iTraceID)
Update highlighting property of one element given one actor.
TrackContainer * m_TrackContainerInfoForVisu
void ShowCollection(const unsigned int &, const bool &)
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
Wraps a boost multi index container of TrackStructure. This class intends to synchronize Track repres...
unsigned int GetLineageTrackRootID(const unsigned int &iTraceID)
std::string m_TraceNameID
void SetDivisionRandomColor(const std::string &iColumnName, const std::map< unsigned int, std::string > &iValues)
char * data()
LineageContainer * m_LineageContainerInfoForVisu
static ColorWay GetColorWay(std::string iTraceName, vtkLookupTable **ioLUT, bool iRandomIncluded, QWidget *iiParent=0)
get the way the user wants its traces to be colorcoded and the LUT if he chooses the LUT ...
void DisplayColumnNames(const std::list< std::pair< std::string, std::string > > &iColumnNamesAndToolTip)
create the table widget items for the columns Header and set the corresponding tooltips for them ...
GoFigureLineageAttributes UpdateCollectionScalars(const unsigned int &iTrackID)
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...
GoDBTableWidgetContainer::TWContainerType TWContainerType
void DeleteListTraces(vtkMySQLDatabase *iDatabaseConnector, const std::list< unsigned int > &iListTraces)
delete the traces of the list from the database, the TW and the container for visu ...
double rgba[4]
QGoTableWidget * m_Table
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void UpdateElementHighlighting(unsigned int)
vtkMySQLDatabase * m_DatabaseConnector
void DBConnectionNotNeededAnymore()
This class describes the specificities of the GoDBTWContainerForTrackLineage for lineage.
virtual void DeleteCheckedTraces(vtkMySQLDatabase *iDatabaseConnector)
delete the checked traces from the database, the TW and the container for visu
std::string GetMapValue(const std::string &key)
return the value for the field map[key] after having removed the " at the beginning and at the end of...
Definition: GoDBRow.cxx:174
double * GetLineageColor(const unsigned int &iTraceID)
GoDBCollectionOfTraces * m_CollectionOfTraces