GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GoDBTWContainerForLineage.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 =========================================================================*/
35 
37  GoDBTWContainerForTrackLineage("lineage", "None", iImgSessionID)
38 {
40 }
41 
42 //--------------------------------------------------------------------------
43 
44 //--------------------------------------------------------------------------
46 {
47 }
48 
49 //--------------------------------------------------------------------------
50 
51 //--------------------------------------------------------------------------
53 {
55 
56  std::pair< GoDBTraceInfoForTableWidget,
57  std::vector< std::string > > PairTemp;
58 
59  //Get the info for the TrackIDRoot:
60  temp.InfoName = "TrackIDRoot";
61  temp.ColumnNameDatabase = "TrackIDRoot";
62  temp.TableNameDatabase = "lineage";
63  m_ColumnsInfos.push_back(temp);
64  PairTemp.first = temp;
65  m_RowContainer.push_back(PairTemp);
66  temp.Clear();
67 
68  //Get the info for the Max Depth:
69  temp.InfoName = "MaxDepth";
70  temp.ColumnNameTableWidget = "MaxDepth";
71  temp.ToolTip = "TBD";
72  m_ColumnsInfos.push_back(temp);
73  PairTemp.first = temp;
74  m_RowContainer.push_back(PairTemp);
75  temp.Clear();
76 
77  //Get the info for the Min Depth:
78  temp.InfoName = "MinDepth";
79  temp.ColumnNameTableWidget = "MinDepth";
80  temp.ToolTip = "TBD";
81  m_ColumnsInfos.push_back(temp);
82  PairTemp.first = temp;
83  m_RowContainer.push_back(PairTemp);
84  temp.Clear();
85 
86  //Get the info for the number of divisions:
87  temp.InfoName = "NbDivisions";
88  temp.ColumnNameTableWidget = "NbDivisions";
89  temp.ToolTip = "Number of divisions";
90  m_ColumnsInfos.push_back(temp);
91  PairTemp.first = temp;
92  m_RowContainer.push_back(PairTemp);
93  temp.Clear();
94 
95  //Get the info for the number of leaves:
96  temp.InfoName = "NbLeaves";
97  temp.ColumnNameTableWidget = "NbLeaves";
98  temp.ToolTip = "Number of leaves";
99  m_ColumnsInfos.push_back(temp);
100  PairTemp.first = temp;
101  m_RowContainer.push_back(PairTemp);
102  temp.Clear();
103 
104 }
105 //--------------------------------------------------------------------------
106 
107 //--------------------------------------------------------------------------
109 {
110  this->m_LineageAttributes = iLineageAttributes;
111 }
112 //--------------------------------------------------------------------------
113 
114 //--------------------------------------------------------------------------
116 {
117  std::vector< std::string > VectorNames;
118  std::vector< std::vector< std::string > > VectorValues;
120  VectorNames);
121  this->FillRowContainer(VectorValues, VectorNames, "ColumnNameTableWidget");
122  this->m_LineageAttributes.clear();
123 }
124 //--------------------------------------------------------------------------
125 
126 //--------------------------------------------------------------------------
129  vtkMySQLDatabase *iDatabaseConnector, int iTraceID)
130 {
132  iTraceID);
134  return this->m_RowContainer;
135 }
136 
137 //--------------------------------------------------------------------------
138 
139 //--------------------------------------------------------------------------
141  GoFigureLineageAttributes iLineageAttributes,
142  std::vector< std::vector< std::string > > & ioValues,
143  std::vector< std::string > & ioNames)
144 {
145  std::vector< std::string > temp;
146  ioNames.push_back("MaxDepth");
147  temp.push_back( ConvertToString< unsigned int >(iLineageAttributes.MaxDepth) );
148  ioNames.push_back("MinDepth");
149  temp.push_back( ConvertToString< unsigned int >(iLineageAttributes.MinDepth) );
150  ioNames.push_back("NbDivisions");
151  temp.push_back( ConvertToString< unsigned int >(iLineageAttributes.NumberOfDivisions) );
152  ioNames.push_back("NbLeaves");
153  temp.push_back( ConvertToString< unsigned int >(iLineageAttributes.NumberOfLeaves) );
154  ioValues.push_back(temp);
155 }
156 //--------------------------------------------------------------------------
157 
158 //--------------------------------------------------------------------------
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...
GoDBTWContainerForLineage(int iImgSessionID)
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...
This class describes the specificities of the GoDBTableWidgetContainer for track and lineage...
std::vector< std::pair< GoDBTraceInfoForTableWidget, std::vector< std::string > > > TWContainerType
void SetLineageAttributes(GoFigureLineageAttributes iLineageAttributes)
structure to pass the column information between the Table Widget and the Database ...
void GetValuesAndNamesForLineageComputedValues(GoFigureLineageAttributes iLineageAttributes, std::vector< std::vector< std::string > > &ioValues, std::vector< std::string > &ioNames)
void FillRowContainer(std::vector< std::vector< std::string > > iResultsFromQuery, std::vector< std::string > iSelectFields, std::string BaseOn="")
fill the columns of the row container following the vector of string containing the columns to be fil...
std::vector< GoDBTraceInfoForTableWidget > m_ColumnsInfos
void SetSpecificInfoForLineageTable()
add the specific info for a lineage to the columns description
void FillRowContainerForLineageComputedValues()
get the values from m_LineageAttributes and the names of the calculated values from m_LineageAttribut...
GoFigureLineageAttributes m_LineageAttributes