35 #ifndef __GoDBExport_h
36 #define __GoDBExport_h
38 #include "vtkMySQLDatabase.h"
41 #include "QGoIOConfigure.h"
52 GoDBExport(std::string iServerName, std::string iLogin,
53 std::string iPassword,
int iImagingSessionID,
54 std::string iFilename);
63 void ExportContours();
96 std::vector< std::pair< std::string, std::string > > GetImagingSessionInfoFromDB();
105 std::pair< std::string, std::string > GetOneInfoFromDBForImgSession(
106 std::string iNameInfo);
111 void WriteGeneraleInfo();
121 template<
typename T >
127 this->m_DatabaseConnector, TableRow.GetTableName(),
128 TableRow.GetTableIDName(), iField, iValue);
129 std::vector< std::string >::iterator iter = ListTableIDs.begin();
130 while ( iter != ListTableIDs.end() )
132 std::vector< std::pair< std::string, std::string > > EntityInfo =
133 this->GetOneEntityInfoFromDB(*iter, TableRow);
134 this->WriteOnTheOutputFile(TableRow.GetTableName(), EntityInfo);
145 template<
typename T >
150 if ( iListIDs.empty() )
152 this->WriteNumberOfEntities(TableRow.GetTableName(), 0);
155 this->WriteNumberOfEntities( TableRow.GetTableName(), iListIDs.size() );
156 std::vector< std::string >::iterator iter = iListIDs.begin();
157 while ( iter != iListIDs.end() )
159 std::vector< std::pair< std::string, std::string > > EntityInfo =
160 this->GetOneEntityInfoFromDB(*iter, TableRow);
161 this->WriteOnTheOutputFile(TableRow.GetTableName(), EntityInfo);
174 template<
typename T >
175 std::vector< std::pair< std::string, std::string > >
178 std::vector< std::pair< std::string, std::string > > oEntityInfo =
179 std::vector< std::pair< std::string, std::string > >();
180 iTableRow.SetValuesForSpecificID(atoi( iEntityID.c_str() ),
181 this->m_DatabaseConnector);
182 std::vector< std::string > FieldNames = iTableRow.GetVectorColumnNames();
183 std::vector< std::string >::iterator iter = FieldNames.begin();
184 while ( iter != FieldNames.end() )
186 std::pair< std::string, std::string > FieldInfo;
187 FieldInfo.first = *iter;
188 FieldInfo.second = iTableRow.GetMapValue(*iter);
189 oEntityInfo.push_back(FieldInfo);
204 void GetVectorsTableNamesTracesIDsAndFields(
205 std::vector< std::string > & ioVectorTableNames,
206 std::vector< std::vector< std::string > > & ioVectorTracesIDs,
207 std::vector< std::string > & ioVectorFields,
208 bool IncludeChannelIDs =
false);
214 void WriteCellTypeAndSubCellTypeInfoFromDatabase();
220 void WriteContoursInfoFromDatabase();
226 void WriteTracksInfoFromDatabase();
232 void WriteMeshesInfoFromDatabase();
238 void WriteLineagesInfoFromDatabase();
244 void WriteChannelsInfoFromDatabase();
250 void WriteIntensityInfoFromDatabase();
256 void UpdateVectorContourIDsForExportContours();
263 void UpdateVectorMeshIDsForExportContours();
269 void UpdateVectorContourIDsForExportMeshes();
276 void UpdateVectorMeshIDsForExportMeshes();
282 void UpdateVectorChannelIDsForExportMeshes();
289 void UpdateVectorTrackIDsToExportInfo();
296 void UpdateVectorLineageIDsToExportInfo();
302 void UpdateAllVectorTracesIDsToExportContours();
308 void UpdateAllVectorTracesIDsToExportMeshes();
314 void WriteTheColorsInfoFromDatabase();
321 void WriteCoordinatesInfoFromDatabase();
328 std::string GetNameWithBrackets(std::string iName);
335 std::string GetNameWithSlashBrackets(std::string iName);
343 void WriteOnTheOutputFile(std::string iNameOfEntity,
344 std::vector< std::pair< std::string, std::string > > iInfoToWrite);
351 void WriteNumberOfEntities(std::string iNameOfEntity,
size_t iNumber);
356 void AddTabulation();
361 void OpenDBConnection();
366 void CloseDBConnection();
std::vector< std::string > m_VectorLineageIDs
std::vector< std::pair< std::string, std::string > > GetOneEntityInfoFromDB(std::string iEntityID, T iTableRow)
get the info with their names for an entity from the database and put them in a vector of pair of str...
std::vector< std::string > m_VectorMeshIDs
std::vector< std::string > m_VectorContourIDs
void WriteTableInfoFromDB(std::vector< std::string > iListIDs)
get the info from the database for all the entities from a table which IDs are in iListIDs and write ...
void WriteTableInfoFromDB(std::string iField, std::string iValue)
get the info from the database for all the entities from a table or with a limitation defined with fi...
export the data from the database into a textfile
std::vector< std::string > ListSpecificValuesForOneColumn(vtkMySQLDatabase *iDatabaseConnector, const std::string &TableName, const std::string &ColumnName, const std::string &field, const std::string &value, bool ExcludeZero)
SELECT ColumnName FROM TableName WHERE field = value and ColumnName <> 0 (if excludezero) ...
vtkMySQLDatabase * m_DatabaseConnector
std::vector< std::string > m_VectorTrackIDs
std::vector< std::string > m_VectorChannelIDs