Bibliography.cpp
Go to the documentation of this file.
1 // kate: replace-tabs off; indent-width 4; indent-mode normal
2 // vim: ts=4:sw=4:noexpandtab
3 /*
4 
5 Copyright (c) 2010--2012,
6 François Pomerleau and Stephane Magnenat, ASL, ETHZ, Switzerland
7 You can contact the authors at <f dot pomerleau at gmail dot com> and
8 <stephane at magnenat dot net>
9 
10 All rights reserved.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright
15  notice, this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright
17  notice, this list of conditions and the following disclaimer in the
18  documentation and/or other materials provided with the distribution.
19  * Neither the name of the <organization> nor the
20  names of its contributors may be used to endorse or promote products
21  derived from this software without specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 DISCLAIMED. IN NO EVENT SHALL ETH-ASL BE LIABLE FOR ANY
27 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
36 #include "Bibliography.h"
37 
38 #include <boost/typeof/typeof.hpp>
39 #include <boost/lexical_cast.hpp>
40 #define BOOST_ASSIGN_MAX_PARAMS 6
41 #include <iostream>
42 #include <cassert>
43 #include <stdexcept>
44 
46 {
47  using namespace std;
48 
49  template<typename M>
50  bool contains(const M& m, const typename M::key_type& k)
51  {
52  BOOST_AUTO(it,m.find(k));
53  return (it!=m.end());
54  }
55 
56  template<typename M>
57  const typename M::mapped_type& get(const M& m, const typename M::key_type& k)
58  {
59  BOOST_AUTO(it,m.find(k));
60  if (it!=m.end())
61  return it->second;
62  else
63  throw std::runtime_error("unknown key");
64  }
65 
67  {
68  return {
69  {"Phillips2007VarTrimmed", {
70  {"type", "inproceedings"},
71  {"title", "Outlier robust ICP for minimizing fractional RMSD"},
72  {"author", "Phillips, J.M. and Liu, R. and Tomasi, C."},
73  {"booktitle", "3-D Digital Imaging and Modeling, 2007. 3DIM '07. Sixth International Conference on"},
74  {"year", "2007"},
75  {"pages", "427--434"},
76  {"publisher", "IEEE Press"},
77  {"doi", "10.1109/3DIM.2007.39"},
78  {"fulltext", "http://x86.cs.duke.edu/~tomasi/papers/phillips/phillips3DIM07.pdf"}
79  }},
80  {"Chetverikov2002Trimmed", {
81  {"type", "inproceedings"},
82  {"title", "The Trimmed Iterative Closest Point Algorithm"},
83  {"author", "Chetverikov, D. and Svirko, D. and Stepanov, D. and Krsek, P."},
84  {"booktitle", "Pattern Recognition, 2002. Proceedings. 16th International Conference on"},
85  {"year", "2002"},
86  {"pages", "545--548"},
87  {"publisher", "IEEE Press"},
88  {"doi", "10.1109/ICPR.2002.1047997 "},
89  {"fulltext", "http://hci.iwr.uni-heidelberg.de/publications/dip/2002/ICPR2002/DATA/10_1_03.PDF"}
90  }},
91  {"Besl1992Point2Point", {
92  {"type", "inproceedings"},
93  {"title", "A Method for Registration of 3-D Shapes"},
94  {"author", "Besl, P.J. and McKay, H.D."},
95  {"booktitle", "Pattern Analysis and Machine Intelligence, IEEE Transactions"},
96  {"year", "1992"},
97  {"pages", "239--256"},
98  {"publisher", "IEEE Press"},
99  {"doi", "10.1109/34.121791"},
100  {"fulltext", "http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=121791"}
101  }},
102  {"Censi2007ICPCovariance", {
103  {"type", "inproceedings" },
104  {"title", "An Accurate Closed-Form Estimate of {ICP}'s Covariance" },
105  {"author", "Censi, A." },
106  {"booktitle", "Proceedings of the {IEEE} International Conference on Robotics and Automation ({ICRA})" },
107  {"year", "2007" },
108  {"pages", "3167--3172" },
109  {"publisher", "IEEE Press" },
110  {"doi", "10.1109/ROBOT.2007.363961" },
111  {"fulltext", "http://purl.org/censi/research/2007-icra-icpcov.pdf"}
112  }},
113  {"Chen1991Point2Plane", {
114  {"type", "inproceedings"},
115  {"title", "Object modeling by registration of multiple range images"},
116  {"author", "Chen, Y. and Medioni, G."},
117  {"booktitle", "Robotics and Automation, 1991. Proceedings., 1991 IEEE International Conference on"},
118  {"year", "1991"},
119  {"pages", "2724--2729"},
120  {"publisher", "IEEE Press"},
121  {"doi", "10.1109/ROBOT.1991.132043"},
122  {"fulltext", "http://ieeexplore.ieee.org/search/srchabstract.jsp?tp=&arnumber=132043"}
123  }},
124  {"Prakhya2015Point2Plane", {
125  {"type", "inproceedings"},
126  {"title", "A closed-form estimate of 3D ICP covariance"},
127  {"author", "Prakhya, S.M. and Bingbing, L. and Rui, Y. and Lin, W."},
128  {"booktitle", "2015 14th IAPR International Conference on Machine Vision Applications (MVA)"},
129  {"year", "2015"},
130  {"pages", "526--529"},
131  {"publisher", "IEEE Press"},
132  {"doi", "10.1109/MVA.2015.7153246"},
133  {"fulltext", "https://ieeexplore.ieee.org/search/srchabstract.jsp?tp=&arnumber=7153246"}
134  }},
135  {"Masuda1996Random", {
136  {"type", "inproceedings"},
137  {"title", "Registration and integration of multiple range images for 3-D model construction"},
138  {"author", "Masuda, T. and Sakaue, K. and Yokoya, N."},
139  {"booktitle", "Pattern Recognition, 1996., Proceedings of the 13th International Conference on"},
140  {"year", "1996"},
141  {"pages", "879--883"},
142  {"publisher", "IEEE Press"},
143  {"doi", "10.1109/ICPR.1996.546150"},
144  {"fulltext", "http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=546150"}
145  }},
146  {"Diebel2004Median", {
147  {"type", "inproceedings"},
148  {"title", "Simultaneous Localization and Mapping with Active Stereo Vision"},
149  {"author", "Diebel, J. and Reutersward, K. and Thrun, S. and Davis, J. and Gupta, R."},
150  {"booktitle", "Intelligent Robots and Systems, 2004. (IROS 2004). Proceedings. 2004 IEEE/RSJ International Conference on"},
151  {"year", "2004"},
152  {"pages", "3436--3443"},
153  {"publisher", "IEEE Press"},
154  {"doi", "10.1109/IROS.2004.1389948"},
155  {"fulltext", "http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1389948"}
156  }},
157  {"Pomerleau2012Noise", {
158  {"type", "inproceedings"},
159  {"title", "Noise Characterization of Depth Sensors for Surface Inspections"},
160  {"author", "F. Pomerleau, A. Breitenmoser, M. Liu, F. Colas, R. Siegwart"},
161  {"booktitle", " International Conference on Applied Robotics for the Power Industry, 2012. (CARPI 2012). Proceedings of the IEEE"},
162  {"year", "2012"},
163  {"pages", "1--8"},
164  {"publisher", "IEEE Press"},
165  {"doi", ""},
166  {"fulltext", ""}
167  }},
168  {"RobustWeightFunctions", {
169  {"type", "article"},
170  {"title", "Robust regression using iteratively reweighted least-squares"},
171  {"author", "Paul W Holland and Roy E Welsch"},
172  {"booktitle", "Communications in Statistics - Theory and Methods"},
173  {"year", "1977"},
174  {"pages", "813-827"},
175  {"publisher", ""},
176  {"doi", "10.1080/03610927708827533"},
177  {"fulltext", ""}
178  }},
179  {"Umeyama1991", {
180  {"type", "article"},
181  {"author", "Umeyama, Shinji"},
182  {"title", "Least-Squares Estimation of Transformation Parameters Between Two Point Patterns"},
183  {"journal", "IEEE Trans. Pattern Anal. Mach. Intell."},
184  {"issue_date", "April 1991"},
185  {"volume", "13"},
186  {"number", "4"},
187  {"month", "apr"},
188  {"year", "1991"},
189  {"issn", "0162-8828"},
190  {"pages", "376--380"},
191  {"numpages", "5"},
192  {"url", "https://doi.org/10.1109/34.88573"},
193  {"doi", "10.1109/34.88573"},
194  {"acmid", "105525"},
195  {"publisher", "IEEE Computer Society"},
196  {"address", "Washington, DC, USA"}
197  }},
198  {"Rusinkiewicz2001", {
199  {"type", "inproceedings"},
200  {"author", "Rusinkiewicz, Szymon and Levoy, Marc"},
201  {"title", "Efficient Variants of the ICP Algorithm"},
202  {"journal", "Proceedings Third International Conference on 3-D Digital Imaging and Modeling"},
203  {"year", "2001"},
204  {"isbn", "0769509843"},
205  {"pages", "145--152"},
206  {"doi", "10.1109/IM.2001.924423"},
207  {"publisher", "IEEE Computer Society"},
208  {"address", "Quebec City, Quebec, Canada"}
209  }},
210  {"Gelfand2003", {
211  {"type", "inproceedings"},
212  {"author", "Gelfand, N. and Ikemoto, L. and Rusinkiewicz, Szymon and Levoy, M."},
213  {"title", "Geometrically stable sampling for the ICP algorithm"},
214  {"journal", "Fourth International Conference on 3-D Digital Imaging and Modeling, 2003. 3DIM 2003. Proceedings."},
215  {"year", "2003"},
216  {"isbn", "0-7695-1991-1"},
217  {"pages", "260--267"},
218  {"doi", "10.1109/IM.2003.1240258"},
219  {"publisher", "IEEE Computer Society"}
220  }},
221  {"Labussiere2020", {
222  {"type", "article"},
223  {"author", "Labussière, Mathieu and Laconte, Johann and Pomerleau, François"},
224  {"title", "Geometry Preserving Sampling Method Based on Spectral Decomposition for Large-Scale Environments"},
225  {"journal", "Frontiers in Robotics and AI"},
226  {"month", "sep"},
227  {"year", "2020"},
228  {"volume", "7"},
229  {"isbn", "2296-9144"},
230  {"pages", "134--148"},
231  {"doi", "10.3389/frobt.2020.572054"},
232  {"fulltext", "https://www.frontiersin.org/article/10.3389/frobt.2020.572054"}
233  }}
234  };
235  }
236 
238  mode(mode)
239  {}
240 
241  void CurrentBibliography::dump(std::ostream& os) const
242  {
243  switch (mode)
244  {
245  case NORMAL: dumpText(os); break;
246  case ROSWIKI: dumpWiki(os); break;
247  case BIBTEX: dumpBibtex(os); break;
248  default: assert(false); break;
249  };
250  }
251 
252  void CurrentBibliography::dumpText(std::ostream& os) const
253  {
254  Bibliography biblio(bibliography());
255  for (size_t i = 0; i < entries.size(); ++i)
256  {
257  const string& entryName(entries[i]);
258  if (!contains(biblio, entryName))
259  throw runtime_error(string("Broken bibliography, missing entry " + entryName));
260  const StringMap& entry(get(biblio, entryName));
261 
262  os << "[" << i+1 << "]";
263  if (contains(entry, "title"))
264  os << " " << get(entry, "title") << ".";
265  if (contains(entry, "author"))
266  os << " " << get(entry, "author") << "";
267  if (contains(entry, "booktitle"))
268  os << " In " << get(entry, "booktitle") << ".";
269  if (contains(entry, "journal"))
270  os << " " << get(entry, "journal") << ".";
271  if (contains(entry, "pages"))
272  os << " " << get(entry, "pages") << ".";
273  if (contains(entry, "year"))
274  os << " " << get(entry, "year") << ".";
275  os << endl << endl;
276  }
277  }
278 
279  void CurrentBibliography::dumpWiki(std::ostream& os) const
280  {
281  Bibliography biblio(bibliography());
282  for (size_t i = 0; i < entries.size(); ++i)
283  {
284  const string& entryName(entries[i]);
285  if (!contains(biblio, entryName))
286  throw runtime_error(string("Broken bibliography, missing entry " + entryName));
287  const StringMap& entry(get(biblio, entryName));
288 
289  os << " * " << "<<Anchor(" << entryName << ")>>[" << i+1 << "] -";
290  if (contains(entry, "title"))
291  os << " '''" << get(entry, "title") << ".'''";
292  if (contains(entry, "author"))
293  os << " " << get(entry, "author") << "";
294  if (contains(entry, "booktitle"))
295  os << " ''In " << get(entry, "booktitle") << ".''";
296  if (contains(entry, "journal"))
297  os << " " << get(entry, "journal") << ".";
298  if (contains(entry, "pages"))
299  os << " " << get(entry, "pages") << ".";
300  if (contains(entry, "year"))
301  os << " " << get(entry, "year") << ".";
302  if (contains(entry, "doi"))
303  os << " DOI: [[https://doi.org/" << get(entry, "doi") << "|" << get(entry, "doi") << "]].";
304  if (contains(entry, "fulltext"))
305  os << " [[" << get(entry, "fulltext") << "|full text]].";
306  os << endl;
307  }
308  }
309 
310  void CurrentBibliography::dumpBibtex(std::ostream& os) const
311  {
312  Bibliography biblio(bibliography());
313  for (size_t i = 0; i < entries.size(); ++i)
314  {
315  const string& entryName(entries[i]);
316  if (!contains(biblio, entryName))
317  throw runtime_error(string("Broken bibliography, missing entry " + entryName));
318  const StringMap& entry(get(biblio, entryName));
319 
320  os << "@" << get(entry, "type") << "{" << entryName << endl;
321  if (contains(entry, "title"))
322  os << "\ttitle={" << get(entry, "title") << "}," << endl;
323  if (contains(entry, "author"))
324  os << "\tauthor={" << get(entry, "author") << "}," << endl;
325  if (contains(entry, "booktitle"))
326  os << "\tbooktitle={" << get(entry, "booktitle") << "}," << endl;
327  if (contains(entry, "journal"))
328  os << "\tjournal={" << get(entry, "journal") << "}," << endl;
329  if (contains(entry, "pages"))
330  os << "\tpages={" << get(entry, "pages") << "}," << endl;
331  if (contains(entry, "year"))
332  os << "\tyear={" << get(entry, "year") << "}," << endl;
333  os << "}" << endl << endl;
334  }
335  }
336 
337  static StringVector splitString(const string& text, char delim)
338  {
340  size_t pos = 0;
341  while(true)
342  {
343  const size_t nextPos = text.find(delim, pos);
344  if (nextPos == text.npos)
345  {
346  res.push_back(text.substr(pos));
347  break;
348  }
349  else
350  res.push_back(text.substr(pos, nextPos - pos));
351  pos = nextPos + 1;
352  }
353  return res;
354  }
355 
357  {
358  CurrentBibliography::Mode mode(curBib.mode);
359  BibIndices& indices(curBib.indices);
360  StringVector& entries(curBib.entries);
361 
362  string newText;
363  const StringVector words(splitString(text, ' '));
364  for (size_t i = 0; i < words.size(); ++i)
365  {
366  const string& word(words[i]);
367  const size_t l(word.length());
368  const size_t p(word.find('}'));
369  if ((l > 7) && (word.substr(0, 6) == "\\cite{") && (p != string::npos))
370  {
371  if (mode == CurrentBibliography::ROSWIKI)
372  newText += "&#91;";
373  else
374  newText += '[';
375  const StringVector keys(splitString(word.substr(6, p-6), ','));
376  for (size_t j = 0; j < keys.size(); ++j)
377  {
378  const string key(keys[j]);
379  if (mode == CurrentBibliography::ROSWIKI)
380  newText += "[[#" + key + "|";
381  if (contains(indices, key))
382  {
383  newText += std::to_string(get(indices, key)+1);
384  }
385  else
386  {
387  size_t index(entries.size());
388  entries.push_back(key);
389  indices[key] = index;
390  newText += std::to_string(index+1);
391  }
392  if (mode == CurrentBibliography::ROSWIKI)
393  newText += "]]";
394  if (j+1 != keys.size())
395  newText += ',';
396  }
397  if (mode == CurrentBibliography::ROSWIKI)
398  newText += "&#93;";
399  else
400  newText += ']';
401  newText += word.substr(p+1);
402  }
403  else
404  newText += word;
405  if (i+1 != words.size())
406  newText += ' ';
407  }
408  if (mode == CurrentBibliography::BIBTEX)
409  return text;
410  else
411  return newText;
412  }
413 }; // PointMatcherSupport
PointMatcherSupport::CurrentBibliography::Mode
Mode
Definition: Bibliography.h:53
PointMatcherSupport::CurrentBibliography::entries
StringVector entries
Definition: Bibliography.h:60
PointMatcherSupport::BibIndices
std::map< std::string, unsigned > BibIndices
Definition: Bibliography.h:49
res
res
PointMatcherSupport::getAndReplaceBibEntries
std::string getAndReplaceBibEntries(const std::string &, CurrentBibliography &curBib)
PointMatcherSupport::CurrentBibliography::CurrentBibliography
CurrentBibliography(Mode mode=NORMAL)
Definition: Bibliography.cpp:237
PointMatcherSupport::CurrentBibliography::dumpBibtex
void dumpBibtex(std::ostream &os) const
PointMatcherSupport::Bibliography
StringMapMap Bibliography
Definition: Bibliography.h:48
testing::internal::string
::std::string string
Definition: gtest.h:1979
PointMatcherSupport::StringVector
std::vector< std::string > StringVector
Definition: Bibliography.h:45
PointMatcherSupport::StringMap
std::map< std::string, std::string > StringMap
Definition: Bibliography.h:46
PointMatcherSupport::contains
bool contains(const M &m, const typename M::key_type &k)
Definition: Bibliography.cpp:50
PointMatcherSupport::CurrentBibliography::dumpText
void dumpText(std::ostream &os) const
Definition: Bibliography.cpp:252
PointMatcherSupport::CurrentBibliography::ROSWIKI
@ ROSWIKI
Definition: Bibliography.h:56
PointMatcherSupport::bibliography
static Bibliography bibliography()
Definition: Bibliography.cpp:66
PointMatcherSupport::CurrentBibliography::dump
void dump(std::ostream &os) const
Definition: Bibliography.cpp:241
PointMatcherSupport::CurrentBibliography::NORMAL
@ NORMAL
Definition: Bibliography.h:55
std
PointMatcherSupport::get
const M::mapped_type & get(const M &m, const typename M::key_type &k)
Definition: Bibliography.cpp:57
PointMatcherSupport::CurrentBibliography::BIBTEX
@ BIBTEX
Definition: Bibliography.h:57
PointMatcherSupport
Functions and classes that are not dependant on scalar type are defined in this namespace.
Definition: Bibliography.cpp:45
PointMatcherSupport::CurrentBibliography::indices
BibIndices indices
Definition: Bibliography.h:59
Bibliography.h
PointMatcherSupport::CurrentBibliography::mode
enum PointMatcherSupport::CurrentBibliography::Mode mode
PointMatcherSupport::CurrentBibliography::dumpWiki
void dumpWiki(std::ostream &os) const
Definition: Bibliography.cpp:279
PointMatcherSupport::CurrentBibliography
Definition: Bibliography.h:51


libpointmatcher
Author(s):
autogenerated on Mon Sep 16 2024 02:24:07