GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GoFigureFileInfoMultiIndexContainerHelper.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 
36 
37 // method to speed up the display
38 std::map< unsigned int, std::list< std::string > >
41  const unsigned int & iT,
42  const unsigned int & iMinCh,
43  const unsigned int & iMaxCh
44  )
45 {
46  std::map< unsigned int, std::list< std::string > > oList;
47 
48  using boost::multi_index::index;
49  using boost::multi_index::get;
50  using boost::tuples::tie;
51 
52  index< GoFigureFileInfoHelperMultiIndexContainer, m_TCoord >::type::iterator it0, it1;
53  tie(it0, it1) = get< m_TCoord >(iContainer).equal_range(iT);
54 
56 
57  while ( it0 != it1 )
58  {
59  subset.insert(&*it0);
60  ++it0;
61  }
62 
63  GoFigureFileInfoHelperChannelViewContainer::nth_index< 0 >::type::iterator ic0, ic1;
64  ic0 = subset.get< 0 >().lower_bound(iMinCh);
65  ic1 = subset.get< 0 >().upper_bound(iMaxCh);
66 
68 
69  while ( ic0 != ic1 )
70  {
71  final_container.insert(*ic0);
72  ++ic0;
73  }
74 
75  GoFigureFileInfoHelperZCoordViewContainer::iterator z_it0 = final_container.begin();
76  GoFigureFileInfoHelperZCoordViewContainer::iterator z_it1 = final_container.end();
77 
78  while ( z_it0 != z_it1 )
79  {
80  oList[( *z_it0 )->m_Channel].push_back( ( *z_it0 )->m_Filename );
81  ++z_it0;
82  }
83 
84  return oList;
85 }
86 
87 std::map< unsigned int, std::list< std::string > >
90  const unsigned int & iZ,
91  const unsigned int & iMinCh,
92  const unsigned int & iMaxCh
93  )
94 {
95  std::map< unsigned int, std::list< std::string > > oList;
96 
97  using boost::multi_index::index;
98  using boost::multi_index::get;
99  using boost::tuples::tie;
100 
101  index< GoFigureFileInfoHelperMultiIndexContainer, m_ZCoord >::type::iterator it0, it1;
102  tie(it0, it1) = get< m_ZCoord >(iContainer).equal_range(iZ);
103 
105 
106  while ( it0 != it1 )
107  {
108  subset.insert(&*it0);
109  ++it0;
110  }
111 
112  GoFigureFileInfoHelperChannelViewContainer::nth_index< 0 >::type::iterator ic0, ic1;
113  ic0 = subset.get< 0 >().lower_bound(iMinCh);
114  ic1 = subset.get< 0 >().upper_bound(iMaxCh);
115 
117 
118  while ( ic0 != ic1 )
119  {
120  final_container.insert(*ic0);
121  ++ic0;
122  }
123 
124  GoFigureFileInfoHelperTCoordViewContainer::iterator z_it0 = final_container.begin();
125  GoFigureFileInfoHelperTCoordViewContainer::iterator z_it1 = final_container.end();
126 
127  while ( z_it0 != z_it1 )
128  {
129  oList[( *z_it0 )->m_Channel].push_back( ( *z_it0 )->m_Filename );
130  ++z_it0;
131  }
132 
133  return oList;
134 }
135 
138  const unsigned int & iT,
139  const unsigned int & iCh)
140 {
141  std::list< std::string > oList;
142 
143  using boost::multi_index::index;
144  using boost::multi_index::get;
145  using boost::tuples::tie;
146 
147  index< GoFigureFileInfoHelperMultiIndexContainer, m_TCoord >::type::iterator it0, it1;
148  tie(it0, it1) = get< m_TCoord >(iContainer).equal_range(iT);
149 
151 
152  while ( it0 != it1 )
153  {
154  subset.insert(&*it0);
155  ++it0;
156  }
157 
158  GoFigureFileInfoHelperChannelViewContainer::nth_index< 0 >::type::iterator ic0, ic1;
159  ic0 = subset.get< 0 >().lower_bound(iCh);
160  ic1 = subset.get< 0 >().upper_bound(iCh);
161 
163 
164  while ( ic0 != ic1 )
165  {
166  final_container.insert(*ic0);
167  ++ic0;
168  }
169 
170  GoFigureFileInfoHelperZCoordViewContainer::iterator z_it0 = final_container.begin();
171  GoFigureFileInfoHelperZCoordViewContainer::iterator z_it1 = final_container.end();
172 
173  while ( z_it0 != z_it1 )
174  {
175  oList.push_back( ( *z_it0 )->m_Filename );
176  ++z_it0;
177  }
178 
179  return oList;
180 }
181 
184  const unsigned int & iZ,
185  const unsigned int & iCh)
186 {
187  std::list< std::string > oList;
188 
189  using boost::multi_index::index;
190  using boost::multi_index::get;
191  using boost::tuples::tie;
192 
193  index< GoFigureFileInfoHelperMultiIndexContainer, m_ZCoord >::type::iterator it0, it1;
194  tie(it0, it1) = get< m_ZCoord >(iContainer).equal_range(iZ);
195 
197 
198  while ( it0 != it1 )
199  {
200  subset.insert(&*it0);
201  ++it0;
202  }
203 
204  GoFigureFileInfoHelperChannelViewContainer::nth_index< 0 >::type::iterator ic0, ic1;
205  ic0 = subset.get< 0 >().lower_bound(iCh);
206  ic1 = subset.get< 0 >().upper_bound(iCh);
207 
209 
210  while ( ic0 != ic1 )
211  {
212  final_container.insert(*ic0);
213  ++ic0;
214  }
215 
216  GoFigureFileInfoHelperTCoordViewContainer::iterator z_it0 = final_container.begin();
217  GoFigureFileInfoHelperTCoordViewContainer::iterator z_it1 = final_container.end();
218 
219  while ( z_it0 != z_it1 )
220  {
221  oList.push_back( ( *z_it0 )->m_Filename );
222  ++z_it0;
223  }
224 
225  return oList;
226 }
227 
228 std::map< unsigned int, std::list< std::string > >
231  const unsigned int & iCh,
232  const std::set< unsigned int > & iTCoordList
233  )
234 {
235  std::map< unsigned int, std::list< std::string > > oList;
236 
237  std::set< unsigned int >::const_iterator t_it = iTCoordList.begin();
238 
239  while ( t_it != iTCoordList.end() )
240  {
241  oList[*t_it] = GetAllFileNamesForGivenTCoordAndChannel(iContainer, *t_it, iCh);
242  ++t_it;
243  }
244 
245  return oList;
246 }
boost::multi_index::multi_index_container< const GoFigureFileInfoHelper *, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< > >> GoFigureFileInfoHelperChannelViewContainer
std::list< std::string > GetAllFileNamesForGivenZCoordPointAndChannel(const GoFigureFileInfoHelperMultiIndexContainer &iContainer, const unsigned int &iZ, const unsigned int &iCh)
boost::multi_index::multi_index_container< const GoFigureFileInfoHelper *, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< > >> GoFigureFileInfoHelperZCoordViewContainer
std::map< unsigned int, std::list< std::string > > GetAllFileNamesForGivenTCoord(const GoFigureFileInfoHelperMultiIndexContainer &iContainer, const unsigned int &iT, const unsigned int &iMinCh, const unsigned int &iMaxCh)
std::map< unsigned int, std::list< std::string > > GetAllFileNamesForGivenZCoord(const GoFigureFileInfoHelperMultiIndexContainer &iContainer, const unsigned int &iZ, const unsigned int &iMinCh, const unsigned int &iMaxCh)
boost::multi_index::multi_index_container< const GoFigureFileInfoHelper *, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< > >> GoFigureFileInfoHelperTCoordViewContainer
std::list< std::string > GetAllFileNamesForGivenTCoordAndChannel(const GoFigureFileInfoHelperMultiIndexContainer &iContainer, const unsigned int &iT, const unsigned int &iCh)
boost::multi_index::multi_index_container< GoFigureFileInfoHelper, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_PCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_RCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_CCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_XTileCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_YTileCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_ZTileCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_ZCoord >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_Channel >, >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< m_TCoord >, > >> GoFigureFileInfoHelperMultiIndexContainer
std::map< unsigned int, std::list< std::string > > GetAllFileNamesForGivenChannelAndTCoords(const GoFigureFileInfoHelperMultiIndexContainer &iContainer, const unsigned int &iCh, const std::set< unsigned int > &iTCoordList)