40 #ifndef PCL_OUTOFCORE_RAM_CONTAINER_IMPL_H_ 41 #define PCL_OUTOFCORE_RAM_CONTAINER_IMPL_H_ 47 #include <pcl/outofcore/octree_ram_container.h> 54 template<
typename Po
intT>
57 template<
typename Po
intT>
60 template<
typename Po
intT>
void 63 if (!container_.empty ())
65 FILE* fxyz = fopen (path.string ().c_str (),
"w");
67 boost::uint64_t num = size ();
68 for (boost::uint64_t i = 0; i < num; i++)
70 const PointT& p = container_[i];
75 ss << p.x <<
"\t" << p.y <<
"\t" << p.z <<
"\n";
77 fwrite (ss.str ().c_str (), 1, ss.str ().size (), fxyz);
80 assert ( fclose (fxyz) == 0 );
86 template<
typename Po
intT>
void 89 container_.insert (container_.end (), start, start + count);
94 template<
typename Po
intT>
void 99 for (boost::uint64_t i = 0; i < count; i++)
103 container_.insert (container_.end (), temp.begin (), temp.end ());
108 template<
typename Po
intT>
void 113 memcpy (v.data (), container_.data () + start, count *
sizeof(
PointT));
118 template<
typename Po
intT>
void 120 const boost::uint64_t count,
121 const double percent,
124 boost::uint64_t samplesize =
static_cast<boost::uint64_t
> (percent *
static_cast<double> (count));
126 boost::mutex::scoped_lock lock (rng_mutex_);
128 boost::uniform_int < boost::uint64_t > buffdist (start, start + count);
129 boost::variate_generator<boost::mt19937&, boost::uniform_int<boost::uint64_t> > buffdie (
rand_gen_, buffdist);
131 for (boost::uint64_t i = 0; i < samplesize; i++)
133 boost::uint64_t buffstart = buffdie ();
134 v.push_back (container_[buffstart]);
143 #endif //PCL_OUTOFCORE_RAM_CONTAINER_IMPL_H_ void readRange(const uint64_t start, const uint64_t count, AlignedPointTVector &v)
This file defines compatibility wrappers for low level I/O functions.
static boost::mutex rng_mutex_
void insertRange(const PointT *start, const uint64_t count)
inserts count number of points into container; uses the container_ type's insert function ...
void convertToXYZ(const boost::filesystem::path &path)
Writes ascii x,y,z point data to path.string().c_str()
static boost::mt19937 rand_gen_
boost::uuids::basic_random_generator< boost::mt19937 > OutofcoreOctreeDiskContainer< PointT >::uuid_gen_ & rand_gen_
OutofcoreAbstractNodeContainer< PointT >::AlignedPointTVector AlignedPointTVector
A point structure representing Euclidean xyz coordinates, and the RGB color.
void readRangeSubSample(const uint64_t start, const uint64_t count, const double percent, AlignedPointTVector &v)
grab percent*count random points.