Point Cloud Library (PCL)  1.7.0
correspondence_rejection_features.hpp
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2011, Willow Garage, Inc.
6  * Copyright (c) 2012-, Open Perception, Inc.
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
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
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  * * Neither the name of the copyright holder(s) nor the names of its
21  * contributors may be used to endorse or promote products derived
22  * from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  *
37  * $Id$
38  *
39  */
40 #ifndef PCL_REGISTRATION_IMPL_CORRESPONDENCE_REJECTION_FEATURES_HPP_
41 #define PCL_REGISTRATION_IMPL_CORRESPONDENCE_REJECTION_FEATURES_HPP_
42 
43 //////////////////////////////////////////////////////////////////////////////////////////////
44 template <typename FeatureT> inline void
46  const typename pcl::PointCloud<FeatureT>::ConstPtr &source_feature, const std::string &key)
47 {
48  if (features_map_.count (key) == 0)
50  boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->setSourceFeature (source_feature);
51 }
52 
53 //////////////////////////////////////////////////////////////////////////////////////////////
54 template <typename FeatureT> inline typename pcl::PointCloud<FeatureT>::ConstPtr
56 {
57  if (features_map_.count (key) == 0)
58  return (boost::shared_ptr<pcl::PointCloud<const FeatureT> > ());
59  else
60  return (boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->getSourceFeature ());
61 }
62 
63 //////////////////////////////////////////////////////////////////////////////////////////////
64 template <typename FeatureT> inline void
66  const typename pcl::PointCloud<FeatureT>::ConstPtr &target_feature, const std::string &key)
67 {
68  if (features_map_.count (key) == 0)
69  features_map_[key].reset (new FeatureContainer<FeatureT>);
70  boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->setTargetFeature (target_feature);
71 }
72 
73 //////////////////////////////////////////////////////////////////////////////////////////////
74 template <typename FeatureT> inline typename pcl::PointCloud<FeatureT>::ConstPtr
76 {
77  if (features_map_.count (key) == 0)
78  return (boost::shared_ptr<const pcl::PointCloud<FeatureT> > ());
79  else
80  return (boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->getTargetFeature ());
81 }
82 
83 //////////////////////////////////////////////////////////////////////////////////////////////
84 template <typename FeatureT> inline void
86  double thresh, const std::string &key)
87 {
88  if (features_map_.count (key) == 0)
89  features_map_[key].reset (new FeatureContainer<FeatureT>);
90  boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->setDistanceThreshold (thresh);
91 }
92 
93 
94 
95 //////////////////////////////////////////////////////////////////////////////////////////////
96 template <typename FeatureT> inline void
99  const std::string &key)
100 {
101  if (features_map_.count (key) == 0)
102  features_map_[key].reset (new FeatureContainer<FeatureT>);
103  boost::static_pointer_cast<FeatureContainer<FeatureT> > (features_map_[key])->setFeatureRepresentation (fr);
104 }
105 
106 
107 #endif /* PCL_REGISTRATION_IMPL_CORRESPONDENCE_REJECTION_FEATURES_HPP_ */