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  {"Masuda1996Random", {
125  {"type", "inproceedings"},
126  {"title", "Registration and integration of multiple range images for 3-D model construction"},
127  {"author", "Masuda, T. and Sakaue, K. and Yokoya, N."},
128  {"booktitle", "Pattern Recognition, 1996., Proceedings of the 13th International Conference on"},
129  {"year", "1996"},
130  {"pages", "879--883"},
131  {"publisher", "IEEE Press"},
132  {"doi", "10.1109/ICPR.1996.546150"},
133  {"fulltext", "http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=546150"}
134  }},
135  {"Diebel2004Median", {
136  {"type", "inproceedings"},
137  {"title", "Simultaneous Localization and Mapping with Active Stereo Vision"},
138  {"author", "Diebel, J. and Reutersward, K. and Thrun, S. and Davis, J. and Gupta, R."},
139  {"booktitle", "Intelligent Robots and Systems, 2004. (IROS 2004). Proceedings. 2004 IEEE/RSJ International Conference on"},
140  {"year", "2004"},
141  {"pages", "3436--3443"},
142  {"publisher", "IEEE Press"},
143  {"doi", "10.1109/IROS.2004.1389948"},
144  {"fulltext", "http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1389948"}
145  }},
146  {"Pomerleau2012Noise", {
147  {"type", "inproceedings"},
148  {"title", "Noise Characterization of Depth Sensors for Surface Inspections"},
149  {"author", "F. Pomerleau, A. Breitenmoser, M. Liu, F. Colas, R. Siegwart"},
150  {"booktitle", " International Conference on Applied Robotics for the Power Industry, 2012. (CARPI 2012). Proceedings of the IEEE"},
151  {"year", "2012"},
152  {"pages", "1--8"},
153  {"publisher", "IEEE Press"},
154  {"doi", ""},
155  {"fulltext", ""}
156  }},
157  {"RobustWeightFunctions", {
158  {"type", "article"},
159  {"title", "Robust regression using iteratively reweighted least-squares"},
160  {"author", "Paul W Holland and Roy E Welsch"},
161  {"booktitle", "Communications in Statistics - Theory and Methods"},
162  {"year", "1977"},
163  {"pages", "813-827"},
164  {"publisher", ""},
165  {"doi", "10.1080/03610927708827533"},
166  {"fulltext", ""}
167  }},
168  {"Umeyama1991", {
169  {"type", "article"},
170  {"author", "Umeyama, Shinji"},
171  {"title", "Least-Squares Estimation of Transformation Parameters Between Two Point Patterns"},
172  {"journal", "IEEE Trans. Pattern Anal. Mach. Intell."},
173  {"issue_date", "April 1991"},
174  {"volume", "13"},
175  {"number", "4"},
176  {"month", "apr"},
177  {"year", "1991"},
178  {"issn", "0162-8828"},
179  {"pages", "376--380"},
180  {"numpages", "5"},
181  {"url", "https://doi.org/10.1109/34.88573"},
182  {"doi", "10.1109/34.88573"},
183  {"acmid", "105525"},
184  {"publisher", "IEEE Computer Society"},
185  {"address", "Washington, DC, USA"}
186  }},
187  {"Rusinkiewicz2001", {
188  {"type", "inproceedings"},
189  {"author", "Rusinkiewicz, Szymon and Levoy, Marc"},
190  {"title", "Efficient Variants of the ICP Algorithm"},
191  {"journal", "Proceedings Third International Conference on 3-D Digital Imaging and Modeling"},
192  {"year", "2001"},
193  {"isbn", "0769509843"},
194  {"pages", "145--152"},
195  {"doi", "10.1109/IM.2001.924423"},
196  {"publisher", "IEEE Computer Society"},
197  {"address", "Quebec City, Quebec, Canada"}
198  }},
199  {"Gelfand2003", {
200  {"type", "inproceedings"},
201  {"author", "Gelfand, N. and Ikemoto, L. and Rusinkiewicz, Szymon and Levoy, M."},
202  {"title", "Geometrically stable sampling for the ICP algorithm"},
203  {"journal", "Fourth International Conference on 3-D Digital Imaging and Modeling, 2003. 3DIM 2003. Proceedings."},
204  {"year", "2003"},
205  {"isbn", "0-7695-1991-1"},
206  {"pages", "260--267"},
207  {"doi", "10.1109/IM.2003.1240258"},
208  {"publisher", "IEEE Computer Society"}
209  }}
210  };
211  }
212 
214  mode(mode)
215  {}
216 
217  void CurrentBibliography::dump(std::ostream& os) const
218  {
219  switch (mode)
220  {
221  case NORMAL: dumpText(os); break;
222  case ROSWIKI: dumpWiki(os); break;
223  case BIBTEX: dumpBibtex(os); break;
224  default: assert(false); break;
225  };
226  }
227 
228  void CurrentBibliography::dumpText(std::ostream& os) const
229  {
230  Bibliography biblio(bibliography());
231  for (size_t i = 0; i < entries.size(); ++i)
232  {
233  const string& entryName(entries[i]);
234  if (!contains(biblio, entryName))
235  throw runtime_error(string("Broken bibliography, missing entry " + entryName));
236  const StringMap& entry(get(biblio, entryName));
237 
238  os << "[" << i+1 << "]";
239  if (contains(entry, "title"))
240  os << " " << get(entry, "title") << ".";
241  if (contains(entry, "author"))
242  os << " " << get(entry, "author") << "";
243  if (contains(entry, "booktitle"))
244  os << " In " << get(entry, "booktitle") << ".";
245  if (contains(entry, "journal"))
246  os << " " << get(entry, "journal") << ".";
247  if (contains(entry, "pages"))
248  os << " " << get(entry, "pages") << ".";
249  if (contains(entry, "year"))
250  os << " " << get(entry, "year") << ".";
251  os << endl << endl;
252  }
253  }
254 
255  void CurrentBibliography::dumpWiki(std::ostream& os) const
256  {
257  Bibliography biblio(bibliography());
258  for (size_t i = 0; i < entries.size(); ++i)
259  {
260  const string& entryName(entries[i]);
261  if (!contains(biblio, entryName))
262  throw runtime_error(string("Broken bibliography, missing entry " + entryName));
263  const StringMap& entry(get(biblio, entryName));
264 
265  os << " * " << "<<Anchor(" << entryName << ")>>[" << i+1 << "] -";
266  if (contains(entry, "title"))
267  os << " '''" << get(entry, "title") << ".'''";
268  if (contains(entry, "author"))
269  os << " " << get(entry, "author") << "";
270  if (contains(entry, "booktitle"))
271  os << " ''In " << get(entry, "booktitle") << ".''";
272  if (contains(entry, "journal"))
273  os << " " << get(entry, "journal") << ".";
274  if (contains(entry, "pages"))
275  os << " " << get(entry, "pages") << ".";
276  if (contains(entry, "year"))
277  os << " " << get(entry, "year") << ".";
278  if (contains(entry, "doi"))
279  os << " DOI: [[https://doi.org/" << get(entry, "doi") << "|" << get(entry, "doi") << "]].";
280  if (contains(entry, "fulltext"))
281  os << " [[" << get(entry, "fulltext") << "|full text]].";
282  os << endl;
283  }
284  }
285 
286  void CurrentBibliography::dumpBibtex(std::ostream& os) const
287  {
288  Bibliography biblio(bibliography());
289  for (size_t i = 0; i < entries.size(); ++i)
290  {
291  const string& entryName(entries[i]);
292  if (!contains(biblio, entryName))
293  throw runtime_error(string("Broken bibliography, missing entry " + entryName));
294  const StringMap& entry(get(biblio, entryName));
295 
296  os << "@" << get(entry, "type") << "{" << entryName << endl;
297  if (contains(entry, "title"))
298  os << "\ttitle={" << get(entry, "title") << "}," << endl;
299  if (contains(entry, "author"))
300  os << "\tauthor={" << get(entry, "author") << "}," << endl;
301  if (contains(entry, "booktitle"))
302  os << "\tbooktitle={" << get(entry, "booktitle") << "}," << endl;
303  if (contains(entry, "journal"))
304  os << "\tjournal={" << get(entry, "journal") << "}," << endl;
305  if (contains(entry, "pages"))
306  os << "\tpages={" << get(entry, "pages") << "}," << endl;
307  if (contains(entry, "year"))
308  os << "\tyear={" << get(entry, "year") << "}," << endl;
309  os << "}" << endl << endl;
310  }
311  }
312 
313  static StringVector splitString(const string& text, char delim)
314  {
316  size_t pos = 0;
317  while(true)
318  {
319  const size_t nextPos = text.find(delim, pos);
320  if (nextPos == text.npos)
321  {
322  res.push_back(text.substr(pos));
323  break;
324  }
325  else
326  res.push_back(text.substr(pos, nextPos - pos));
327  pos = nextPos + 1;
328  }
329  return res;
330  }
331 
333  {
334  CurrentBibliography::Mode mode(curBib.mode);
335  BibIndices& indices(curBib.indices);
336  StringVector& entries(curBib.entries);
337 
338  string newText;
339  const StringVector words(splitString(text, ' '));
340  for (size_t i = 0; i < words.size(); ++i)
341  {
342  const string& word(words[i]);
343  const size_t l(word.length());
344  const size_t p(word.find('}'));
345  if ((l > 7) && (word.substr(0, 6) == "\\cite{") && (p != string::npos))
346  {
347  if (mode == CurrentBibliography::ROSWIKI)
348  newText += "&#91;";
349  else
350  newText += '[';
351  const StringVector keys(splitString(word.substr(6, p-6), ','));
352  for (size_t j = 0; j < keys.size(); ++j)
353  {
354  const string key(keys[j]);
355  if (mode == CurrentBibliography::ROSWIKI)
356  newText += "[[#" + key + "|";
357  if (contains(indices, key))
358  {
359  newText += std::to_string(get(indices, key)+1);
360  }
361  else
362  {
363  size_t index(entries.size());
364  entries.push_back(key);
365  indices[key] = index;
366  newText += std::to_string(index+1);
367  }
368  if (mode == CurrentBibliography::ROSWIKI)
369  newText += "]]";
370  if (j+1 != keys.size())
371  newText += ',';
372  }
373  if (mode == CurrentBibliography::ROSWIKI)
374  newText += "&#93;";
375  else
376  newText += ']';
377  newText += word.substr(p+1);
378  }
379  else
380  newText += word;
381  if (i+1 != words.size())
382  newText += ' ';
383  }
384  if (mode == CurrentBibliography::BIBTEX)
385  return text;
386  else
387  return newText;
388  }
389 }; // 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
test.res
res
Definition: test.py:11
PointMatcherSupport::getAndReplaceBibEntries
std::string getAndReplaceBibEntries(const std::string &, CurrentBibliography &curBib)
PointMatcherSupport::CurrentBibliography::CurrentBibliography
CurrentBibliography(Mode mode=NORMAL)
Definition: Bibliography.cpp:213
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:228
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:217
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:255
PointMatcherSupport::CurrentBibliography
Definition: Bibliography.h:51


mp2p_icp
Author(s):
autogenerated on Fri Dec 20 2024 03:45:57