00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2010-2012, Willow Garage, Inc. 00006 * 00007 * All rights reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * * Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * * Redistributions in binary form must reproduce the above 00016 * copyright notice, this list of conditions and the following 00017 * disclaimer in the documentation and/or other materials provided 00018 * with the distribution. 00019 * * Neither the name of Willow Garage, Inc. nor the names of its 00020 * contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00026 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00027 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00028 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00029 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00032 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00033 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 * POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 * $Id: extract_indices.h 6144 2012-07-04 22:06:28Z rusu $ 00037 * 00038 */ 00039 00040 #ifndef PCL_FILTERS_EXTRACT_INDICES_H_ 00041 #define PCL_FILTERS_EXTRACT_INDICES_H_ 00042 00043 #include <pcl/filters/filter_indices.h> 00044 00045 namespace pcl 00046 { 00069 template<typename PointT> 00070 class ExtractIndices : public FilterIndices<PointT> 00071 { 00072 protected: 00073 typedef typename FilterIndices<PointT>::PointCloud PointCloud; 00074 typedef typename PointCloud::Ptr PointCloudPtr; 00075 typedef typename PointCloud::ConstPtr PointCloudConstPtr; 00076 typedef typename pcl::traits::fieldList<PointT>::type FieldList; 00077 00078 public: 00082 ExtractIndices (bool extract_removed_indices = false) : 00083 FilterIndices<PointT>::FilterIndices (extract_removed_indices) 00084 { 00085 use_indices_ = true; 00086 filter_name_ = "ExtractIndices"; 00087 } 00088 00097 void 00098 filterDirectly (PointCloudPtr &cloud); 00099 00100 protected: 00101 using PCLBase<PointT>::input_; 00102 using PCLBase<PointT>::indices_; 00103 using PCLBase<PointT>::use_indices_; 00104 using Filter<PointT>::filter_name_; 00105 using Filter<PointT>::getClassName; 00106 using FilterIndices<PointT>::negative_; 00107 using FilterIndices<PointT>::keep_organized_; 00108 using FilterIndices<PointT>::user_filter_value_; 00109 using FilterIndices<PointT>::extract_removed_indices_; 00110 using FilterIndices<PointT>::removed_indices_; 00111 00115 void 00116 applyFilter (PointCloud &output); 00117 00121 void 00122 applyFilter (std::vector<int> &indices) 00123 { 00124 applyFilterIndices (indices); 00125 } 00126 00130 void 00131 applyFilterIndices (std::vector<int> &indices); 00132 }; 00133 00135 00156 template<> 00157 class PCL_EXPORTS ExtractIndices<sensor_msgs::PointCloud2> : public FilterIndices<sensor_msgs::PointCloud2> 00158 { 00159 public: 00160 typedef sensor_msgs::PointCloud2 PointCloud2; 00161 typedef PointCloud2::Ptr PointCloud2Ptr; 00162 typedef PointCloud2::ConstPtr PointCloud2ConstPtr; 00163 00165 ExtractIndices () 00166 { 00167 use_indices_ = true; 00168 filter_name_ = "ExtractIndices"; 00169 } 00170 00171 protected: 00172 using PCLBase<PointCloud2>::input_; 00173 using PCLBase<PointCloud2>::indices_; 00174 using PCLBase<PointCloud2>::use_indices_; 00175 using Filter<PointCloud2>::filter_name_; 00176 using Filter<PointCloud2>::getClassName; 00177 using FilterIndices<PointCloud2>::negative_; 00178 using FilterIndices<PointCloud2>::keep_organized_; 00179 using FilterIndices<PointCloud2>::user_filter_value_; 00180 00184 void 00185 applyFilter (PointCloud2 &output); 00186 00190 void 00191 applyFilter (std::vector<int> &indices); 00192 }; 00193 } 00194 00195 #endif // PCL_FILTERS_EXTRACT_INDICES_H_ 00196