GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GoDBTWContainerForTrack.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 #include <vtkUnicodeString.h>
36 
38  GoDBTWContainerForTrackLineage("track", "lineage", iImgSessionID),
39  m_TrackAttributes(NULL)
40 {
42 }
43 
44 //--------------------------------------------------------------------------
45 
46 //--------------------------------------------------------------------------
48 {
49 }
50 
51 //--------------------------------------------------------------------------
52 
53 //--------------------------------------------------------------------------
55 {
57 
58  std::pair< GoDBTraceInfoForTableWidget,
59  std::vector< std::string > > PairTemp;
60 
61  //Get the info for the Deplacement:
62  temp.InfoName = "Deplacement";
63  temp.ColumnNameTableWidget = "Deplacement";
64  temp.ToolTip = "micron";
65  m_ColumnsInfos.push_back(temp);
66  PairTemp.first = temp;
67  m_RowContainer.push_back(PairTemp);
68  temp.Clear();
69 
70  //Get the info for the Distance:
71  temp.InfoName = "Distance";
72  temp.ColumnNameTableWidget = "Distance";
73  temp.ToolTip = "micron";
74  m_ColumnsInfos.push_back(temp);
75  PairTemp.first = temp;
76  m_RowContainer.push_back(PairTemp);
77  temp.Clear();
78 
79  //Get the info for theta:
80  temp.InfoName = "Theta";
81  temp.ColumnNameTableWidget = "Theta";
82  m_ColumnsInfos.push_back(temp);
83  PairTemp.first = temp;
84  m_RowContainer.push_back(PairTemp);
85  temp.Clear();
86 
87  //Get the info for phi:
88  temp.InfoName = "Phi";
89  temp.ColumnNameTableWidget = "Phi";
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 AvgSpeed:
96  temp.InfoName = "AvgSpeed";
97  temp.ColumnNameTableWidget = "AvgSpeed";
98  temp.ToolTip = "micron/s";
99  m_ColumnsInfos.push_back(temp);
100  PairTemp.first = temp;
101  m_RowContainer.push_back(PairTemp);
102  temp.Clear();
103 
104  //Get the info for MaxSpeed:
105  temp.InfoName = "MaxSpeed";
106  temp.ColumnNameTableWidget = "MaxSpeed";
107  temp.ToolTip = "micron/s";
108  m_ColumnsInfos.push_back(temp);
109  PairTemp.first = temp;
110  m_RowContainer.push_back(PairTemp);
111  temp.Clear();
112 
113  //Get the info for MaxSpeed:
114  temp.InfoName = "AvgVolume";
115  temp.ColumnNameTableWidget = "AvgVolume";
116  temp.ToolTip = "micron cube";
117  m_ColumnsInfos.push_back(temp);
118  PairTemp.first = temp;
119  m_RowContainer.push_back(PairTemp);
120 
121  //Get the info for Number of meshes:
122  temp.InfoName = "NumberOfMeshes";
123  temp.ColumnNameTableWidget = "NumberOfMeshes";
124  m_ColumnsInfos.push_back(temp);
125  PairTemp.first = temp;
126  m_RowContainer.push_back(PairTemp);
127 
128  //Get the info for Tmax - Tmin:
129  temp.InfoName = "Tmax - Tmin";
130  temp.ColumnNameTableWidget = "Tmax - Tmin";
131  m_ColumnsInfos.push_back(temp);
132  PairTemp.first = temp;
133  m_RowContainer.push_back(PairTemp);
134 
135  temp.Clear();
136 }
137 
138 //--------------------------------------------------------------------------
139 
140 //--------------------------------------------------------------------------
142 {
143  this->m_TrackAttributes = iTrackAttributes;
144 }
145 
146 //--------------------------------------------------------------------------
147 
148 //--------------------------------------------------------------------------
151  vtkMySQLDatabase *iDatabaseConnector, int iTraceID)
152 {
154  iTraceID);
156  return this->m_RowContainer;
157 }
158 
159 //--------------------------------------------------------------------------
160 
161 //--------------------------------------------------------------------------
163 {
164  std::vector< std::string > VectorNames;
165  std::vector< std::vector< std::string > > VectorValues;
167  VectorNames);
168  this->FillRowContainer(VectorValues, VectorNames, "ColumnNameTableWidget");
169  this->m_TrackAttributes = 0;
170 }
171 
172 //--------------------------------------------------------------------------
173 
174 //--------------------------------------------------------------------------
176  GoFigureTrackAttributes *iTrackAttributes,
177  std::vector< std::vector< std::string > > & ioValues,
178  std::vector< std::string > & ioNames)
179 {
180  if ( iTrackAttributes != 0 )
181  {
182  std::vector< std::string > temp;
183  ioNames.push_back("Deplacement");
184  temp.push_back( ConvertToString< double >(iTrackAttributes->total_length) );
185  ioNames.push_back("Distance");
186  temp.push_back( ConvertToString< double >(iTrackAttributes->distance) );
187  ioNames.push_back("Theta");
188  temp.push_back( ConvertToString< double >(iTrackAttributes->theta) );
189  ioNames.push_back("Phi");
190  temp.push_back( ConvertToString< double >(iTrackAttributes->phi) );
191  ioNames.push_back("AvgSpeed");
192  temp.push_back( ConvertToString< double >(iTrackAttributes->avg_speed) );
193  ioNames.push_back("MaxSpeed");
194  temp.push_back( ConvertToString< double >(iTrackAttributes->max_speed) );
195  ioNames.push_back("AvgVolume");
196  temp.push_back( ConvertToString< double >(iTrackAttributes->avg_volume) );
197  ioNames.push_back("NumberOfMeshes");
198  temp.push_back( ConvertToString< unsigned int >(iTrackAttributes->number_meshes) );
199  ioNames.push_back("Tmax - Tmin");
200  temp.push_back( ConvertToString< unsigned int >(iTrackAttributes->temporal_extent) );
201  ioValues.push_back(temp);
202  }
203 }
void FillRowContainerForTrackComputedValues()
get the values from m_TrackAttributes and the names of the calculated values from m_TrackAttributes a...
void SetSpecificInfoForTrackTable()
add the specific info for a track to the columns description
GoDBTWContainerForTrack(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
structure to pass the column information between the Table Widget and the Database ...
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 GetValuesAndNamesForTrackComputedValues(GoFigureTrackAttributes *iTrackAttributes, std::vector< std::vector< std::string > > &ioValues, std::vector< std::string > &ioNames)
void SetTrackAttributes(GoFigureTrackAttributes *iTrackAttributes)
set m_TrackAttributes to iTrackAttributes, needs to be called before displaying the volume...
GoFigureTrackAttributes * m_TrackAttributes
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...