MCPcopy Create free account
hub / github.com/PDAL/PDAL / createZIpro

Method createZIpro

filters/SMRFilter.cpp:563–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561}
562
563std::vector<double> SMRFilter::createZIpro(PointViewPtr view,
564 std::vector<double> const& ZImin,
565 std::vector<int> const& Low,
566 std::vector<int> const& isNetCell,
567 std::vector<int> const& Obj)
568{
569 // "The end result of the iteration process described above is a binary grid
570 // where each cell is classified as being either bare earth (BE) or object
571 // (OBJ). The algorithm then applies this mask to the starting minimum
572 // surface to eliminate nonground cells."
573 std::vector<double> ZIproV = ZImin;
574 for (size_t i = 0; i < Obj.size(); ++i)
575 {
576 if (Obj[i] == 1 || Low[i] == 1 || isNetCell[i] == 1)
577 ZIproV[i] = std::numeric_limits<double>::quiet_NaN();
578 }
579
580 // "These cells are then inpainted according to the same process described
581 // previously, producing a provisional DEM (ZIpro)."
582 //ABELL - We can eliminate this copy if we're OK with not writing
583 // both the filled and non-filled array to output.
584 std::vector<double> ZIpro_fillV = ZIproV;
585 knnfill(view, ZIpro_fillV);
586
587 if (!m_args->m_dir.empty())
588 {
589 std::string fname =
590 FileUtils::toAbsolutePath("zipro.tif", m_args->m_dir);
591 MatrixXd ZIpro = Map<MatrixXd>(ZIproV.data(), m_rows, m_cols);
592 math::writeMatrix(ZIpro, fname, "GTiff", m_args->m_cell, m_bounds, m_srs);
593
594 fname = FileUtils::toAbsolutePath("zipro_fill.tif", m_args->m_dir);
595 MatrixXd ZIpro_fill = Map<MatrixXd>(ZIpro_fillV.data(), m_rows, m_cols);
596 math::writeMatrix(ZIpro_fill, fname, "GTiff", m_args->m_cell, m_bounds, m_srs);
597 }
598
599 return ZIpro_fillV;
600}
601
602// Fill voids with the average of eight nearest neighbors.
603void SMRFilter::knnfill(PointViewPtr view, std::vector<double>& cz)

Callers

nothing calls this directly

Calls 5

toAbsolutePathFunction · 0.85
writeMatrixFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected