[Liblas-commits] hg: 7 new changesets
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Aug 19 12:49:24 EDT 2010
changeset ec5660988a59 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=ec5660988a59
summary: colors are supposed to be scaled to 16 bit, so 65535 is a valid value for a color, not merely 255
changeset 6a1cc3bf1bb9 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=6a1cc3bf1bb9
summary: we were reading color incorrectly and only reading the reds over and over again
changeset f499d6bd20e1 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=f499d6bd20e1
summary: remove validation altogether. The maximum size of uint16_t *is allowed* for a scaled 16bit color value for the point
changeset 78658ca551ac in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=78658ca551ac
summary: update doc
changeset 4494968976af in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=4494968976af
summary: boost::property_tree summary methods for header and reader
changeset 5b0f09578c8d in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=5b0f09578c8d
summary: boost::property_tree usage
changeset c7b737060ffb in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=c7b737060ffb
summary: merge
diffstat:
apps/chipper.hpp | 2 +-
apps/las2las2.cpp | 14 +-
apps/laskernel.cpp | 306 +++++++++++++++++++++++++++++++++++++++++-
apps/laskernel.hpp | 8 +
include/liblas/lasheader.hpp | 2 +-
include/liblas/lasindex.hpp | 13 +-
src/detail/reader/point.cpp | 8 +-
src/lascolor.cpp | 6 -
8 files changed, 329 insertions(+), 30 deletions(-)
diffs (truncated from 556 to 300 lines):
diff -r e8da8fe9abbd -r c7b737060ffb apps/chipper.hpp
--- a/apps/chipper.hpp Wed Aug 18 13:34:53 2010 -0500
+++ b/apps/chipper.hpp Thu Aug 19 11:49:06 2010 -0500
@@ -46,7 +46,7 @@
{ return m_vec.begin(); }
std::vector<PtRef>::iterator end()
{ return m_vec.end(); }
- PtRef& operator[](uint32_t pos)
+ PtRef& operator[](boost::uint32_t pos)
{ return m_vec[pos]; }
std::string Dir()
{
diff -r e8da8fe9abbd -r c7b737060ffb apps/las2las2.cpp
--- a/apps/las2las2.cpp Wed Aug 18 13:34:53 2010 -0500
+++ b/apps/las2las2.cpp Thu Aug 19 11:49:06 2010 -0500
@@ -99,7 +99,7 @@
liblas::Header const& header,
std::vector<liblas::FilterI*>& filters,
std::vector<liblas::TransformI*>& transforms,
- uint32_t split_size,
+ boost::uint32_t split_size,
bool verbose)
{
@@ -172,6 +172,14 @@
if (verbose)
std::cout << std::endl;
+ // reader.Reset();
+ // boost::property_tree::ptree pts = SummarizePoints(reader);
+ // boost::property_tree::ptree hdr = SummarizeHeader(reader.GetHeader());
+ // boost::property_tree::ptree top;
+ // top.add_child("summary.header",hdr);
+ // top.add_child("summary.points",pts);
+ // boost::property_tree::write_xml("junk.xml", top);
+
delete writer;
delete ofs;
@@ -195,7 +203,7 @@
int main(int argc, char* argv[])
{
- uint32_t split_size;
+ boost::uint32_t split_size;
std::string input;
std::string output;
@@ -217,7 +225,7 @@
file_options.add_options()
("help,h", "produce help message")
- ("split,s", po::value<uint32_t>(&split_size)->default_value(0), "Split file into multiple files with each being this size in MB or less. If this value is 0, no splitting is done")
+ ("split,s", po::value<boost::uint32_t>(&split_size)->default_value(0), "Split file into multiple files with each being this size in MB or less. If this value is 0, no splitting is done")
("input,i", po::value< string >(), "input LAS file")
("output,o", po::value< string >(&output)->default_value("output.las"), "output LAS file")
("verbose,v", po::value<bool>(&verbose)->zero_tokens(), "Verbose message output")
diff -r e8da8fe9abbd -r c7b737060ffb apps/laskernel.cpp
--- a/apps/laskernel.cpp Wed Aug 18 13:34:53 2010 -0500
+++ b/apps/laskernel.cpp Thu Aug 19 11:49:06 2010 -0500
@@ -16,7 +16,7 @@
{
boost::char_separator<char> sep(SEPARATORS);
- std::vector<uint16_t> returns;
+ std::vector<boost::uint16_t> returns;
tokenizer tokens(return_string, sep);
for (tokenizer::iterator t = tokens.begin(); t != tokens.end(); ++t) {
returns.push_back(atoi((*t).c_str()));
@@ -32,7 +32,7 @@
{
boost::char_separator<char> sep(SEPARATORS);
- std::vector<uint8_t> classes;
+ std::vector<boost::uint8_t> classes;
tokenizer tokens(class_string, sep);
for (tokenizer::iterator t = tokens.begin(); t != tokens.end(); ++t) {
classes.push_back(atoi((*t).c_str()));
@@ -79,8 +79,8 @@
liblas::FilterI* MakeIntensityFilter(std::string intensities, liblas::FilterI::FilterType ftype)
{
- liblas::ContinuousValueFilter<uint16_t>::filter_func f = &liblas::Point::GetIntensity;
- liblas::ContinuousValueFilter<uint16_t>* intensity_filter = new liblas::ContinuousValueFilter<uint16_t>(f, intensities);
+ liblas::ContinuousValueFilter<boost::uint16_t>::filter_func f = &liblas::Point::GetIntensity;
+ liblas::ContinuousValueFilter<boost::uint16_t>* intensity_filter = new liblas::ContinuousValueFilter<boost::uint16_t>(f, intensities);
intensity_filter->SetType(ftype);
return intensity_filter;
}
@@ -95,8 +95,8 @@
liblas::FilterI* MakeScanAngleFilter(std::string intensities, liblas::FilterI::FilterType ftype)
{
- liblas::ContinuousValueFilter<int8_t>::filter_func f = &liblas::Point::GetScanAngleRank;
- liblas::ContinuousValueFilter<int8_t>* intensity_filter = new liblas::ContinuousValueFilter<int8_t>(f, intensities);
+ liblas::ContinuousValueFilter<boost::int8_t>::filter_func f = &liblas::Point::GetScanAngleRank;
+ liblas::ContinuousValueFilter<boost::int8_t>* intensity_filter = new liblas::ContinuousValueFilter<boost::int8_t>(f, intensities);
intensity_filter->SetType(ftype);
return intensity_filter;
}
@@ -115,7 +115,7 @@
filtering_options.add_options()
("extent,e", po::value< string >(), "Extent window that points must fall within to keep.\nUse a comma-separated list, for example, \n -e minx, miny, maxx, maxy\n or \n -e minx, miny, minz, maxx, maxy, maxz")
- ("thin,t", po::value<uint32_t>()->default_value(0), "Simple decimation-style thinning.\nThin the file by removing every t'th point from the file.")
+ ("thin,t", po::value<boost::uint32_t>()->default_value(0), "Simple decimation-style thinning.\nThin the file by removing every t'th point from the file.")
("last_return_only", po::value<bool>()->zero_tokens(), "Keep last returns (cannot be used with --first_return_only)")
("first_return_only", po::value<bool>()->zero_tokens(), "Keep first returns (cannot be used with --last_return_only")
("keep-returns", po::value< string >(), "A comma-separated list of return numbers to keep in the output file: \n--keep-returns 1,2,3")
@@ -333,7 +333,7 @@
std::vector<liblas::Color::value_type> rgb;
for(tokenizer::iterator c = rgbs.begin(); c != rgbs.end(); ++c)
{
- rgb.push_back(atof((*c).c_str()));
+ rgb.push_back(atoi((*c).c_str()));
}
liblas::Color color(rgb[0], rgb[1], rgb[2]);
colors.push_back(color);
@@ -359,7 +359,7 @@
std::vector<liblas::Color::value_type> rgb;
for(tokenizer::iterator c = rgbs.begin(); c != rgbs.end(); ++c)
{
- rgb.push_back(atof((*c).c_str()));
+ rgb.push_back(atoi((*c).c_str()));
}
liblas::Color color(rgb[0], rgb[1], rgb[2]);
colors.push_back(color);
@@ -543,7 +543,7 @@
oss << "Format version must dotted -- ie, '1.0' or '1.2', not " << format_string;
throw std::runtime_error(oss.str());
}
- header.SetVersionMinor(static_cast<uint8_t>(minor));
+ header.SetVersionMinor(static_cast<boost::uint8_t>(minor));
}
if (vm.count("pad-header"))
{
@@ -563,3 +563,289 @@
return transforms;
}
+
+
+boost::property_tree::ptree SummarizePoints(liblas::Reader& reader )
+{
+ using boost::property_tree::ptree;
+ ptree pt;
+
+ boost::array<boost::uint32_t, 32> classes;
+ boost::uint32_t synthetic = 0;
+ boost::uint32_t withheld = 0;
+ boost::uint32_t keypoint = 0;
+ boost::uint32_t count = 0;
+ boost::array<boost::uint32_t, 8> points_by_return;
+ boost::array<boost::uint32_t, 8> returns_of_given_pulse;
+
+ classes.assign(0);
+ points_by_return.assign(0);
+ returns_of_given_pulse.assign(0);
+
+ bool read = reader.ReadNextPoint();
+ if (!read)
+ {
+ throw std::runtime_error("Unable to read any points from file.");
+ }
+
+ bool first = true;
+ liblas::Point min;
+ liblas::Point max;
+
+ while (read)
+ {
+
+ count++;
+ liblas::Point const& p = reader.GetPoint();
+
+ if (first) {
+ min = p;
+ max = p;
+ first = false;
+ }
+
+ min.SetX(std::min(p.GetX(), min.GetX()));
+ max.SetX(std::max(p.GetX(), max.GetX()));
+
+ min.SetY(std::min(p.GetY(), min.GetY()));
+ max.SetY(std::max(p.GetY(), max.GetY()));
+
+ min.SetZ(std::min(p.GetZ(), min.GetZ()));
+ max.SetZ(std::max(p.GetZ(), max.GetZ()));
+
+ min.SetIntensity(std::min(p.GetIntensity(), min.GetIntensity()));
+ max.SetIntensity(std::max(p.GetIntensity(), max.GetIntensity()));
+
+ min.SetTime(std::min(p.GetTime(), min.GetTime()));
+ max.SetTime(std::max(p.GetTime(), max.GetTime()));
+
+ min.SetReturnNumber(std::min(p.GetReturnNumber(), min.GetReturnNumber()));
+ max.SetReturnNumber(std::max(p.GetReturnNumber(), max.GetReturnNumber()));
+
+ min.SetNumberOfReturns(std::min(p.GetNumberOfReturns(), min.GetNumberOfReturns()));
+ max.SetNumberOfReturns(std::max(p.GetNumberOfReturns(), max.GetNumberOfReturns()));
+
+ min.SetScanDirection(std::min(p.GetScanDirection(), min.GetScanDirection()));
+ max.SetScanDirection(std::max(p.GetScanDirection(), max.GetScanDirection()));
+
+ min.SetFlightLineEdge(std::min(p.GetFlightLineEdge(), min.GetFlightLineEdge()));
+ max.SetFlightLineEdge(std::max(p.GetFlightLineEdge(), max.GetFlightLineEdge()));
+
+ min.SetScanAngleRank(std::min(p.GetScanAngleRank(), min.GetScanAngleRank()));
+ max.SetScanAngleRank(std::max(p.GetScanAngleRank(), max.GetScanAngleRank()));
+
+ min.SetUserData(std::min(p.GetUserData(), min.GetUserData()));
+ max.SetUserData(std::max(p.GetUserData(), max.GetUserData()));
+
+ min.SetPointSourceID(std::min(p.GetPointSourceID(), min.GetPointSourceID()));
+ max.SetPointSourceID(std::max(p.GetPointSourceID(), max.GetPointSourceID()));
+
+ liblas::Classification const& cls = p.GetClassification();
+
+ boost::uint8_t minc = std::min(cls.GetClass(), min.GetClassification().GetClass());
+ boost::uint8_t maxc = std::max(cls.GetClass(), max.GetClassification().GetClass());
+
+ classes[cls.GetClass()]++;
+
+ if (cls.IsWithheld()) withheld++;
+ if (cls.IsKeyPoint()) keypoint++;
+ if (cls.IsSynthetic()) synthetic++;
+
+ min.SetClassification(liblas::Classification(minc));
+ max.SetClassification(liblas::Classification(maxc));
+
+ liblas::Color const& color = p.GetColor();
+
+ liblas::Color::value_type red;
+ liblas::Color::value_type green;
+ liblas::Color::value_type blue;
+
+ red = std::min(color.GetRed(), min.GetColor().GetRed());
+ green = std::min(color.GetGreen(), min.GetColor().GetGreen());
+ blue = std::min(color.GetBlue(), min.GetColor().GetBlue());
+
+ min.SetColor(liblas::Color(red, green, blue));
+
+ red = std::max(color.GetRed(), max.GetColor().GetRed());
+ green = std::max(color.GetGreen(), max.GetColor().GetGreen());
+ blue = std::max(color.GetBlue(), max.GetColor().GetBlue());
+
+ max.SetColor(liblas::Color(red, green, blue));
+
+ points_by_return[p.GetReturnNumber()]++;
+ returns_of_given_pulse[p.GetNumberOfReturns()]++;
+
+ read = reader.ReadNextPoint();
+ }
+
+ pt.put("bounds.minx", min.GetX());
+ pt.put("bounds.miny", min.GetY());
+ pt.put("bounds.minz", min.GetZ());
+ pt.put("bounds.maxx", max.GetX());
+ pt.put("bounds.maxy", max.GetY());
+ pt.put("bounds.maxz", max.GetZ());
+
+ pt.put("time.min", min.GetTime());
+ pt.put("time.max", max.GetTime());
+
+ pt.put("intensity.min", min.GetIntensity());
+ pt.put("intensity.max", max.GetIntensity());
+
+ pt.put("returnnumber.min", min.GetReturnNumber());
+ pt.put("returnnumber.max", max.GetReturnNumber());
+
+ pt.put("numberofreturns.min", min.GetNumberOfReturns());
+ pt.put("numberofreturns.max", max.GetNumberOfReturns());
+
+ pt.put("scandirection.min", min.GetScanDirection());
+ pt.put("scandirection.max", max.GetScanDirection());
+
+ pt.put("scanangle.min", min.GetScanAngleRank());
+ pt.put("scanangle.max", max.GetScanAngleRank());
+
+ pt.put("flightlineedge.min", min.GetFlightLineEdge());
+ pt.put("flightlineedge.max", max.GetFlightLineEdge());
+
+ pt.put("userdata.min", min.GetUserData());
+ pt.put("userdata.max", max.GetUserData());
+
+ pt.put("pointsourceid.min", min.GetPointSourceID());
+ pt.put("pointsourceid.max", max.GetPointSourceID());
+
+ ptree colors;
+ liblas::Color const& c = min.GetColor();
+ colors.put("min.red", c.GetRed());
+ colors.put("min.green", c.GetGreen());
+ colors.put("min.blue", c.GetBlue());
+ liblas::Color const& d = max.GetColor();
+ colors.put("max.red", d.GetRed());
+ if (d.GetGreen() == 57) std::cout << "hey it's 57!" << std::endl;
+ colors.put("max.green", d.GetGreen());
+ colors.put("max.blue", d.GetBlue());
+ pt.add_child("color", colors);
More information about the Liblas-commits
mailing list