Created
August 24, 2018 19:41
-
-
Save hobu/d99daf8f1e655ffbd395d512601c71cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| m_executor = std::shared_ptr<pdal::PipelineExecutor>(new pdal::PipelineExecutor(json)); | |
| pdal::PipelineManager& manager = m_executor->getManager(); | |
| std::stringstream strm(json); | |
| manager.readPipeline(strm); | |
| pdal::Stage *r = manager.getStage(); | |
| if (!r) | |
| throw pdal::pdal_error("pipeline had no stages!"); | |
| std::cout << "stage name: " << r->getName() << std::endl; | |
| int counter = 1; | |
| for (auto array: arrays) | |
| { | |
| // Create numpy reader for each array | |
| pdal::Options options; | |
| std::stringstream tag; | |
| tag << "readers_numpy" << counter; | |
| pdal::StageCreationOptions opts { "", "readers.numpy", nullptr, options, tag.str()}; | |
| pdal::Stage& reader = manager.makeReader(opts); | |
| pdal::NumpyReader* np_reader = dynamic_cast<pdal::NumpyReader*>(&reader); | |
| if (!np_reader) | |
| throw pdal::pdal_error("couldn't cast reader!"); | |
| PyObject* parray = (PyObject*)array->getPythonArray(); | |
| if (!parray) | |
| throw pdal::pdal_error("array was none!"); | |
| np_reader->setArray(parray); | |
| r->setInput(reader); | |
| std::cout << "stage name: " << r->getName() << std::endl; | |
| counter++; | |
| } | |
| strm.str(""); | |
| pdal::PipelineWriter::writePipeline(r, strm); | |
| std::cout << strm.str() << std::endl; | |
| manager.validateStageOptions(); | |
| const std::vector<pdal::Stage *> stages = manager.stages(); | |
| std::cout << "num stages:" << stages.size() << std::endl; | |
| const std::vector<pdal::Stage *> roots = manager.roots(); | |
| std::cout << "roots:" << roots.size() << std::endl; | |
| const std::vector<pdal::Stage *> leaves = manager.leaves(); | |
| std::cout << "leaves:" << leaves.size() << std::endl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.