Skip to content

Commit

Permalink
changed depth to min and max density searches
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemann16 committed Sep 28, 2018
1 parent 39f4181 commit 6dfaccd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
20 changes: 16 additions & 4 deletions plugins/i3s/io/EsriReader.cpp
Expand Up @@ -61,12 +61,18 @@ void EsriReader::addArgs(ProgramArgs& args)
args.add("bounds", "Bounds of the point cloud", m_args.bounds);
args.add("threads", "Number of threads to be used." , m_args.threads);
args.add("dimensions", "Dimensions to be used in pulls", m_args.dimensions);
args.add("depth", "Point density of nodes selected", m_args.depth, -1.00);
args.add("min_density", "Minimum point density",
m_args.min_density, -1.0);
args.add("max_density", "Maximum point density",
m_args.max_density, -1.0);

}

void EsriReader::initialize(PointTableRef table)
{
//create proper density if min was set but max wasn't
if(m_args.min_density >= 0 && m_args.max_density < 0)
m_args.max_density = std::numeric_limits<double>::max();

//create dimensions map for future lookup
if (!m_args.dimensions.empty())
Expand Down Expand Up @@ -277,6 +283,12 @@ void EsriReader::traverseTree(Json::Value page, int index,
int firstChild = page["nodes"][index]["firstChild"].asInt();
int cCount = page["nodes"][index]["childCount"].asInt();

//find density information
double area = page["nodes"][index]["lodThreshold"].asDouble();
int pCount = page["nodes"][index]["vertexCount"].asInt();
double density = (double)pCount / area;


//update maximum node to stop reading files at the right time
if ((firstChild + cCount - 1) > m_maxNode)
{
Expand All @@ -296,15 +308,15 @@ void EsriReader::traverseTree(Json::Value page, int index,
nodes.push_back(name);
return;
}
else if (depth == m_args.depth)
else if (density < m_args.max_density && density > m_args.min_density)
{
nodes.push_back(name);
return;
}
else
{
//if we've already reached the last node stop, other wise increment
//depth and begin looking at child nodes
//if we've already reached the last node stop process, other wise
//increment depth and begin looking at child nodes
if (name == m_maxNode)
return;
++depth;
Expand Down
3 changes: 2 additions & 1 deletion plugins/i3s/io/EsriReader.hpp
Expand Up @@ -108,7 +108,8 @@ class PDAL_DLL EsriReader : public Reader
Bounds bounds;
uint16_t threads = 8;
std::vector<std::string> dimensions;
double depth;
double min_density;
double max_density;
};

EsriArgs m_args;
Expand Down
13 changes: 8 additions & 5 deletions plugins/i3s/test/i3sReaderTest.cpp
Expand Up @@ -41,14 +41,15 @@ TEST(i3sReaderTest, options_test)
}


TEST(i3sReaderTest, depth_test)
TEST(i3sReaderTest, density_test)
{
StageFactory f;

Options i3s_options;
i3s_options.add("filename", "i3s://https://tiles.arcgis.com/tiles/8cv2FuXuWSfF0nbL/arcgis/rest/services/AUTZEN_LiDAR/SceneServer");
i3s_options.add("threads", 64);
i3s_options.add("depth", 1);
i3s_options.add("min_density", 0);
i3s_options.add("max_density", 0.5);

I3SReader reader;
reader.setOptions(i3s_options);
Expand All @@ -60,7 +61,7 @@ TEST(i3sReaderTest, depth_test)
PointViewPtr view = *viewSet.begin();

//59994 is the number of points in the first depth of the autzen data
EXPECT_EQ(view->size(), 59994u);
EXPECT_EQ(view->size(), 14998u);
}


Expand All @@ -74,7 +75,8 @@ TEST(i3sReaderTest, bounds_test)
i3s_options.add("filename", "i3s://https://tiles.arcgis.com/tiles/8cv2FuXuWSfF0nbL/arcgis/rest/services/AUTZEN_LiDAR/SceneServer");
i3s_options.add("threads", 64);
i3s_options.add("bounds", "([-123.077,-123.063],[44.053, 44.060], [130, 175])");
i3s_options.add("depth", 3);
i3s_options.add("min_density", 1);
i3s_options.add("max_density", 1.5);



Expand All @@ -95,7 +97,8 @@ TEST(i3sReaderTest, bounds_test)
Options options2;
options2.add("filename", "i3s://https://tiles.arcgis.com/tiles/8cv2FuXuWSfF0nbL/arcgis/rest/services/AUTZEN_LiDAR/SceneServer");
options2.add("threads", 64);
options2.add("depth", 3);
options2.add("min_density", 1);
options2.add("max_density", 1.5);


I3SReader reader2;
Expand Down

0 comments on commit 6dfaccd

Please sign in to comment.