sanitize_cloud.cpp
Go to the documentation of this file.
00001 #include <pcl/apps/cloud_composer/tools/sanitize_cloud.h>
00002 #include <pcl/apps/cloud_composer/items/cloud_item.h>
00003 #include <pcl/filters/passthrough.h>
00004 
00005 
00006 
00007 Q_EXPORT_PLUGIN2(cloud_composer_sanitize_cloud_tool, pcl::cloud_composer::SanitizeCloudToolFactory)
00008 
00009 
00010 pcl::cloud_composer::SanitizeCloudTool::SanitizeCloudTool (PropertiesModel* parameter_model, QObject* parent)
00011 : ModifyItemTool (parameter_model, parent)
00012 {
00013   
00014   
00015 }
00016 
00017 pcl::cloud_composer::SanitizeCloudTool::~SanitizeCloudTool ()
00018 {
00019   
00020 }
00021 
00022 QList <pcl::cloud_composer::CloudComposerItem*>
00023 pcl::cloud_composer::SanitizeCloudTool::performAction (ConstItemList input_data, PointTypeFlags::PointType type)
00024 {
00025   QList <CloudComposerItem*> output;
00026   const CloudComposerItem* input_item;
00027   // Check input data length
00028   if ( input_data.size () == 0)
00029   {
00030     qCritical () << "Empty input in SanitizeCloudTool!";
00031     return output;
00032   }
00033   input_item = input_data.value (0);
00034   
00035   if (input_item->type () ==  CloudComposerItem::CLOUD_ITEM )
00036   {
00037     pcl::PCLPointCloud2::ConstPtr input_cloud = input_item->data (ItemDataRole::CLOUD_BLOB).value <pcl::PCLPointCloud2::ConstPtr> ();
00038     
00039     bool keep_organized = parameter_model_->getProperty("Keep Organized").toBool ();
00040    
00042     // Create the filtering object
00043     pcl::PassThrough<pcl::PCLPointCloud2> pass_filter;
00044     pass_filter.setInputCloud (input_cloud);
00045     pass_filter.setKeepOrganized (keep_organized);
00046         
00047     //Create output cloud
00048     pcl::PCLPointCloud2::Ptr cloud_filtered = boost::make_shared<pcl::PCLPointCloud2> ();
00049     //Filter!  
00050     pass_filter.filter (*cloud_filtered);
00051     
00053     //Get copies of the original origin and orientation
00054     Eigen::Vector4f source_origin = input_item->data (ItemDataRole::ORIGIN).value<Eigen::Vector4f> ();
00055     Eigen::Quaternionf source_orientation =  input_item->data (ItemDataRole::ORIENTATION).value<Eigen::Quaternionf> ();
00056     //Put the modified cloud into an item, stick in output
00057     CloudItem* cloud_item = new CloudItem (input_item->text () + tr (" sanitized")
00058     , cloud_filtered
00059     , source_origin
00060     , source_orientation);
00061     
00062     
00063     output.append (cloud_item);
00064   }
00065   else
00066   {
00067     qDebug () << "Input item in StatisticalOutlierRemovalTool is not a cloud!!!";
00068   }
00069   
00070   
00071   return output;
00072 }
00073 
00075 pcl::cloud_composer::PropertiesModel*
00076 pcl::cloud_composer::SanitizeCloudToolFactory::createToolParameterModel (QObject* parent)
00077 {
00078   PropertiesModel* parameter_model = new PropertiesModel(parent);
00079   
00080   parameter_model->addProperty ("Keep Organized", false,  Qt::ItemIsEditable | Qt::ItemIsEnabled);
00081   
00082   return parameter_model;
00083 }


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:32:48