43 #include <QFileDialog>
47 #include "vtkSmartPointer.h"
49 #include "vtkTreeWriter.h"
50 #include "vtkMutableDirectedGraph.h"
51 #include "vtkGraphLayoutView.h"
55 QGoDBTraceManager(), m_LineageContainerInfoForVisu(NULL), m_TrackContainerInfoForVisu(NULL)
57 this->
SetInfo(iImgSessionID, iparent);
78 this->SetTracesInfoContainerForVisuTemplate< LineageContainer >(
86 SIGNAL(UpdateLineageHighlightingFromTrackRootID(
unsigned int)),
92 SIGNAL( HighlightLineage(
const unsigned int&,
const bool&) ),
93 m_TrackContainerInfoForVisu,
94 SLOT( HighlightCollection(
const unsigned int&,
const bool&) ) );
97 SIGNAL( ShowLineage(
const unsigned int&,
const bool&) ),
98 m_TrackContainerInfoForVisu,
99 SLOT( ShowCollection(
const unsigned int&,
const bool&) ) );
121 vtkMySQLDatabase *iDatabaseConnector)
123 this->DisplayInfoForAllTracesTemplate< GoDBTWContainerForLineage >(
131 vtkMySQLDatabase *iDatabaseConnector,
132 const std::list<unsigned int> & iListTPs)
142 vtkMySQLDatabase *iDatabaseConnector)
147 std::list<unsigned int> ListIDs(VectorIDs.begin(), VectorIDs.end());
149 std::list<LineageStructure> list_of_traces =
156 std::list<LineageStructure>::iterator it = list_of_traces.begin();
157 while ( it != list_of_traces.end() )
177 unsigned int iTraceID)
206 vtkMySQLDatabase *iDatabaseConnector)
208 this->DisplayInfoForLastCreatedTraceTemplate< GoDBTWContainerForLineage >(
216 vtkMySQLDatabase *iDatabaseConnector,
int iTraceID)
218 this->DisplayInfoForExistingTraceTemplate< GoDBTWContainerForLineage >(
226 vtkMySQLDatabase *iDatabaseConnector,
unsigned int iTrackRoot)
229 unsigned int NewLineageID =
248 vtkMySQLDatabase *iDatabaseConnector)
255 std::list< unsigned int >::iterator it = oList.begin();
256 while( it != oList.end() )
273 const std::vector< int > & iVectorImportedTraces,
274 vtkMySQLDatabase *iDatabaseConnector)
295 const std::list< unsigned int > & iListTraces)
298 this->DeleteTracesTemplate< LineageContainer >(iDatabaseConnector,
318 UpdateElementHighlightingWithGivenTraceID(iTraceID);
321 GetLineageTrackRootID(iTraceID);
324 GetLineageHighlighted(iTraceID);
336 UpdateElementVisibilityWithGivenTraceID(iTraceID);
339 GetLineageTrackRootID(iTraceID);
342 GetLineageVisibile(iTraceID);
351 vtkMySQLDatabase *iDatabaseConnector,
352 std::list< unsigned int > iListTraceIDs)
354 std::list<LineageStructure> list_of_traces =
357 std::list<LineageStructure>::iterator it = list_of_traces.begin();
358 while ( it != list_of_traces.end() )
373 std::string ColumnName =
"";
374 std::map<unsigned int, std::string> Values;
375 std::map<unsigned int, std::string> NewValues;
384 std::map<unsigned int, std::string>::iterator trackRootIt = Values.begin();
385 while(trackRootIt != Values.end())
387 unsigned int trackRoot =
390 std::pair<unsigned int,std::string>(trackRoot, trackRootIt->second) );
394 vtkLookupTable* LUT = NULL;
396 bool IsRandomIncluded =
402 IsRandomIncluded, this->
m_Table );
404 switch ( UserColorway )
435 vtkMySQLDatabase* iDatabaseConnector,
436 unsigned int iLineageID,
unsigned int iTrackIDRoot)
440 LastLineage.
SetField(
"TrackIDRoot", iTrackIDRoot);
441 LastLineage.
SaveInDB(iDatabaseConnector);
464 std::list<unsigned int> rootIDs =
467 std::list<unsigned int> lineageIDs =
470 std::list<unsigned int>::iterator itLineage = lineageIDs.begin();
471 std::list<unsigned int>::iterator itTrack = rootIDs.begin();
474 while(itLineage != lineageIDs.end() )
476 vtkMutableDirectedGraph* graph =
479 vtkSmartPointer<vtkTree> tree =
480 vtkSmartPointer<vtkTree>::New();
481 tree->CheckedDeepCopy(graph);
484 vtkSmartPointer<vtkTreeWriter> writer =
485 vtkSmartPointer<vtkTreeWriter>::New();
486 writer->SetInput(tree);
506 const std::list< unsigned int > & iListTracesIDs,
510 iDatabaseConnector, iListTracesIDs);
512 std::list<unsigned int>::const_iterator iter = iListTracesIDs.begin();
514 while(iter != iListTracesIDs.end() )
516 std::list<unsigned int> Listiter;
517 Listiter.push_back(*iter);
556 std::list<unsigned int> ListLineagesToDelete =
572 vtkMySQLDatabase *iDatabaseConnector,
573 const std::list<unsigned int> & iLineagesID)
575 std::list<unsigned int> TrackFamiliesToDelete =
578 std::list<unsigned int>::iterator iter = TrackFamiliesToDelete.begin();
579 while(iter != TrackFamiliesToDelete.end() )
592 vtkMySQLDatabase *iDatabaseConnector,
unsigned int iTrackFamilyID)
598 Daughter.
SetField(
"TrackFamilyID", 0);
599 Daughter.
SaveInDB(iDatabaseConnector);
601 Daughter.
SetField(
"TrackFamilyID", 0);
602 Daughter.
SaveInDB(iDatabaseConnector);
606 TrackFamily.
GetMapValue<
unsigned int>(
"TrackIDMother") );
std::string m_CollectionNameID
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
std::string m_CollectionName
virtual std::list< unsigned int > GetListHighlightedIDs()
void CheckedTracesToDelete()
signal emitted when the user click on the action "DeleteTraces" 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 "0", update the existing traceRow if the TraceI...
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 ...
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 "0", update the existing traceRow if the TraceI...
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...
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)
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
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)
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 ...
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 ...
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...
double * GetLineageColor(const unsigned int &iTraceID)
GoDBCollectionOfTraces * m_CollectionOfTraces