Beispiel #1
0
void TIndexReader::addDimensions(PointLayoutPtr layout)
{
    using namespace pdal::Dimension::Type;
    layout->registerDim(pdal::Dimension::Id::X);
    layout->registerDim(pdal::Dimension::Id::Y);
    layout->registerDim(pdal::Dimension::Id::Z);
}
Beispiel #2
0
// Build the list of dimensions for the output schema.
// Placing this here allows validation of dimensions before execution begins.
void DbWriter::prepared(PointTableRef table)
{
    using namespace Dimension;

    PointLayoutPtr layout = table.layout();

    if (m_outputDims.empty())
    {
        for (auto& dimType : layout->dimTypes())
            m_dbDims.push_back(XMLDim(dimType, layout->dimName(dimType.m_id)));
        return;
    }

    DimTypeList dims;
    for (std::string& s : m_outputDims)
    {
        DimType dt = layout->findDimType(s);
        if (dt.m_id == Id::Unknown)
        {
            std::ostringstream oss;
            oss << "Invalid dimension '" << s << "' specified for "
                "'output_dims' option.";
            throw pdal_error(oss.str());
        }
        m_dbDims.push_back(XMLDim(dt, layout->dimName(dt.m_id)));
    }
}
Beispiel #3
0
void LasWriter::prepared(PointTableRef table)
{
    FlexWriter::validateFilename(table);

    PointLayoutPtr layout = table.layout();

    // If we've asked for all dimensions, add to extraDims all dimensions
    // in the layout that aren't already destined for LAS output.
    if (m_extraDims.size() == 1 && m_extraDims[0].m_name == "all")
    {
        m_extraDims.clear();
        Dimension::IdList ids = m_lasHeader.usedDims();
        DimTypeList dimTypes = layout->dimTypes();
        for (auto& dt : dimTypes)
        {
            if (!Utils::contains(ids, dt.m_id))
                m_extraDims.push_back(
                    ExtraDim(layout->dimName(dt.m_id), dt.m_type));
        }
    }

    m_extraByteLen = 0;
    for (auto& dim : m_extraDims)
    {
        dim.m_dimType.m_id = table.layout()->findDim(dim.m_name);
        if (dim.m_dimType.m_id == Dimension::Id::Unknown)
        {
            std::ostringstream oss;
            oss << "Dimension '" << dim.m_name << "' specified in "
                "'extra_dim' option not found.";
            throw pdal_error(oss.str());
        }
        m_extraByteLen += Dimension::size(dim.m_dimType.m_type);
    }
}
Beispiel #4
0
// Try to map dimension names to existing PDAL dimension names by
// checking them with certain characters removed.
Dimension::Id NumpyReader::registerDim(PointLayoutPtr layout,
    const std::string& name, Dimension::Type pdalType)
{
    Dimension::Id id;

    auto registerName = [&layout, &pdalType, &id](std::string name, char elim)
    {
        if (elim != '\0')
            Utils::remove(name, elim);
        Dimension::Id tempId = Dimension::id(name);
        if (tempId != Dimension::Id::Unknown)
        {
            id = tempId;
            layout->registerDim(id, pdalType);
            return true;
        }
        return false;
    };

    // Try registering the name in various ways.  If that doesn't work,
    // just punt and use the name as is.
    if (!registerName(name, '\0') && !registerName(name, '-') &&
        !registerName(name, ' ') && !registerName(name, '_'))
        id = layout->registerOrAssignDim(name, pdalType);
    return id;
}
Beispiel #5
0
TEST(KDIndex, neighbordims)
{
    PointTable table;
    PointLayoutPtr layout = table.layout();
    PointView view(table);

    layout->registerDim(Dimension::Id::X);
    layout->registerDim(Dimension::Id::Z);

    view.setField(Dimension::Id::X, 0, 0);
    view.setField(Dimension::Id::Z, 0, 0);
    
    view.setField(Dimension::Id::X, 1, 1);
    view.setField(Dimension::Id::Z, 1, 1);
    
    EXPECT_THROW(KD2Index index(view), pdal_error);

    PointTable table2;
    PointLayoutPtr layout2 = table.layout();
    PointView view2(table2);

    layout->registerDim(Dimension::Id::X);
    layout->registerDim(Dimension::Id::Y);

    view.setField(Dimension::Id::X, 0, 0);
    view.setField(Dimension::Id::Y, 0, 0);
    
    view.setField(Dimension::Id::X, 1, 1);
    view.setField(Dimension::Id::Y, 1, 1);
    
    EXPECT_THROW(KD3Index index(view2), pdal_error);
}
Beispiel #6
0
XMLSchema::XMLSchema(const PointLayoutPtr& layout, MetadataNode m,
    Orientation orientation) : m_orientation(orientation), m_metadata(m)
{
    DimTypeList dimTypes = layout->dimTypes();
    for (DimType& d : dimTypes)
        m_dims.push_back(XMLDim(d, layout->dimName(d.m_id)));
}
Beispiel #7
0
void LOFFilter::addDimensions(PointLayoutPtr layout)
{
    using namespace Dimension;
    m_kdist = layout->registerOrAssignDim("KDistance", Type::Double);
    m_lrd = layout->registerOrAssignDim("LocalReachabilityDistance", Type::Double);
    m_lof = layout->registerOrAssignDim("LocalOutlierFactor", Type::Double);
}
Beispiel #8
0
TEST(KDIndex, neighbors2D)
{
    PointTable table;
    PointLayoutPtr layout = table.layout();
    PointView view(table);

    layout->registerDim(Dimension::Id::X);
    layout->registerDim(Dimension::Id::Y);

    view.setField(Dimension::Id::X, 0, 0);
    view.setField(Dimension::Id::Y, 0, 0);
    
    view.setField(Dimension::Id::X, 1, 1);
    view.setField(Dimension::Id::Y, 1, 1);
    
    view.setField(Dimension::Id::X, 2, 3);
    view.setField(Dimension::Id::Y, 2, 3);
    
    view.setField(Dimension::Id::X, 3, 6);
    view.setField(Dimension::Id::Y, 3, 6);
    
    view.setField(Dimension::Id::X, 4, 10);
    view.setField(Dimension::Id::Y, 4, 10);
    
    KD2Index index(view);
    index.build();

    EXPECT_EQ(index.neighbor(0, 0), 0u);
    EXPECT_EQ(index.neighbor(1.1, 1.1), 1u);
    EXPECT_EQ(index.neighbor(3.3, 3.3), 2u);
    EXPECT_EQ(index.neighbor(6.1, 6.1), 3u);
    EXPECT_EQ(index.neighbor(15, 15), 4u);

    std::vector<PointId> ids;
    ids = index.neighbors(0, 0, 5);
    EXPECT_EQ(ids.size(), 5u);
    EXPECT_EQ(ids[0], 0u);
    EXPECT_EQ(ids[1], 1u);
    EXPECT_EQ(ids[2], 2u);
    EXPECT_EQ(ids[3], 3u);
    EXPECT_EQ(ids[4], 4u);

    ids = index.neighbors(0, 0, 25);
    EXPECT_EQ(ids.size(), 5u);
    EXPECT_EQ(ids[0], 0u);
    EXPECT_EQ(ids[1], 1u);
    EXPECT_EQ(ids[2], 2u);
    EXPECT_EQ(ids[3], 3u);
    EXPECT_EQ(ids[4], 4u);

    ids = index.neighbors(3.1, 3.1, 5);
    EXPECT_EQ(ids.size(), 5u);
    EXPECT_EQ(ids[0], 2u);
    EXPECT_EQ(ids[1], 1u);
    EXPECT_EQ(ids[2], 3u);
    EXPECT_EQ(ids[3], 0u);
    EXPECT_EQ(ids[4], 4u);
}
Beispiel #9
0
void FauxReader::addDimensions(PointLayoutPtr layout)
{
    layout->registerDims(getDefaultDimensions());
    if (m_numReturns > 0)
    {
        layout->registerDim(Dimension::Id::ReturnNumber);
        layout->registerDim(Dimension::Id::NumberOfReturns);
    }
}
Beispiel #10
0
void FerryFilter::ready(PointTableRef table)
{
    const PointLayoutPtr layout(table.layout());
    for (const auto& dim_par : m_name_map)
    {
        Dimension::Id f = layout->findDim(dim_par.first);
        Dimension::Id t = layout->findDim(dim_par.second);
        m_dimensions_map.insert(std::make_pair(f,t));
    }
}
Beispiel #11
0
void GDALReader::addDimensions(PointLayoutPtr layout)
{
    layout->registerDim(pdal::Dimension::Id::X);
    layout->registerDim(pdal::Dimension::Id::Y);
    for (int i = 0; i < m_raster->m_band_count; ++i)
    {
        std::ostringstream oss;
        oss << "band-" << (i + 1);
        layout->registerOrAssignDim(oss.str(), Dimension::Type::Double);
    }
}
Beispiel #12
0
void RangeFilter::prepared(PointTableRef table)
{
    const PointLayoutPtr layout(table.layout());

    for (auto& r : m_range_list)
    {
        r.m_id = layout->findDim(r.m_name);
        if (r.m_id == Dimension::Id::Unknown)
            throwError("Invalid dimension name in 'limits' option: '" +
                r.m_name + "'.");
    }
    std::sort(m_range_list.begin(), m_range_list.end());
}
Beispiel #13
0
void FerryFilter::addDimensions(PointLayoutPtr layout)
{
    for (auto& info : m_dims)
    {
        const Dimension::Id fromId = layout->findDim(info.m_fromName);
        // Dimensions being created with the "=>Dim" syntax won't
        // be in the layout, so we have to assign a default type.
        Dimension::Type fromType = layout->dimType(fromId);
        if (fromType == Dimension::Type::None)
            fromType = Dimension::Type::Double;

        info.m_toId = layout->registerOrAssignDim(info.m_toName, fromType);
    }
}
Beispiel #14
0
TEST(KDIndex, radius3D)
{
    PointTable table;
    PointLayoutPtr layout = table.layout();
    PointView view(table);

    layout->registerDim(Dimension::Id::X);
    layout->registerDim(Dimension::Id::Y);
    layout->registerDim(Dimension::Id::Z);

    view.setField(Dimension::Id::X, 0, 0);
    view.setField(Dimension::Id::Y, 0, 0);
    view.setField(Dimension::Id::Z, 0, 0);
    
    view.setField(Dimension::Id::X, 1, 1);
    view.setField(Dimension::Id::Y, 1, 1);
    view.setField(Dimension::Id::Z, 1, 1);
    
    view.setField(Dimension::Id::X, 2, 3);
    view.setField(Dimension::Id::Y, 2, 3);
    view.setField(Dimension::Id::Z, 2, 3);
    
    view.setField(Dimension::Id::X, 3, 6);
    view.setField(Dimension::Id::Y, 3, 6);
    view.setField(Dimension::Id::Z, 3, 6);
    
    view.setField(Dimension::Id::X, 4, 10);
    view.setField(Dimension::Id::Y, 4, 10);
    view.setField(Dimension::Id::Z, 4, 10);
    
    KD3Index index(view);
    index.build();

    std::vector<PointId> ids;
    ids = index.radius(0, 0, 0, 5.2);
    
    EXPECT_EQ(ids.size(), 3u);
    EXPECT_EQ(ids[0], 0u);
    EXPECT_EQ(ids[1], 1u);
    EXPECT_EQ(ids[2], 2u);

    ids = index.radius(3.1, 3.1, 3.1, 12.2);
    EXPECT_EQ(ids.size(), 5u);
    EXPECT_EQ(ids[0], 2u);
    EXPECT_EQ(ids[1], 1u);
    EXPECT_EQ(ids[2], 3u);
    EXPECT_EQ(ids[3], 0u);
    EXPECT_EQ(ids[4], 4u);
}
Beispiel #15
0
void TextWriter::writeCSVHeader(PointTableRef table)
{
    const PointLayoutPtr layout(table.layout());
    for (auto di = m_dims.begin(); di != m_dims.end(); ++di)
    {
        if (di != m_dims.begin())
            *m_stream << m_delimiter;

        if (m_quoteHeader)
            *m_stream << "\"" << layout->dimName(*di) << "\"";
        else
            *m_stream << layout->dimName(*di);
    }
    *m_stream << m_newline;
}
Beispiel #16
0
void PlyReader::addDimensions(PointLayoutPtr layout)
{
    for (auto it : m_vertexDimensions)
    {
        layout->registerDim(it.second);
    }
}
void MrsidReader::addDimensions(PointLayoutPtr layout)
{
    using namespace Dimension;

    if (!m_PS)
        throw pdal_error("MrSID object not initialized!");
    const LizardTech::PointInfo& pointinfo = m_PS->getPointInfo();

    // add a map for PDAL names that aren't the same as LT ones (GPSTime vs Time)
    std::map<std::string, std::string> dimensionTranslations;
    dimensionTranslations.insert(std::pair<std::string, std::string>("Time", "GPSTime"));
    dimensionTranslations.insert(std::pair<std::string, std::string>("NumReturns", "NumberOfReturns"));
    dimensionTranslations.insert(std::pair<std::string, std::string>("ReturnNum", "ReturnNumber"));
    dimensionTranslations.insert(std::pair<std::string, std::string>("ScanDir", "ScanDirectionFlag"));
    dimensionTranslations.insert(std::pair<std::string, std::string>("EdgeFlightLine", "EdgeOfFlightLine"));
    dimensionTranslations.insert(std::pair<std::string, std::string>("ScanAngle", "ScanAngleRank"));
    dimensionTranslations.insert(std::pair<std::string, std::string>("ClassId", "Classification"));
    dimensionTranslations.insert(std::pair<std::string, std::string>("SourceId", "PointSourceId"));

    for (unsigned int i=0; i<pointinfo.getNumChannels(); i++)
    {
        const LizardTech::ChannelInfo &channel = pointinfo.getChannel(i);
        const char* name = channel.getName();
        auto translated = dimensionTranslations.find(name);
        if (translated != dimensionTranslations.end())
            name = translated->second.c_str();

        LizardTech::DataType t = channel.getDataType();
        Dimension::Type::Enum pdal_type = getPDALType(t);
        layout->registerOrAssignDim(name, pdal_type);
    }
    m_layout = layout;

}
Beispiel #18
0
void FerryFilter::addDimensions(PointLayoutPtr layout)
{
    for (const auto& dim_par : m_name_map)
    {
        layout->registerOrAssignDim(dim_par.second, Dimension::Type::Double);
    }
}
Beispiel #19
0
void NormalFilter::addDimensions(PointLayoutPtr layout)
{
    using namespace Dimension;

    layout->registerDims(
        {Id::NormalX, Id::NormalY, Id::NormalZ, Id::Curvature});
}
Beispiel #20
0
void OptechReader::addDimensions(PointLayoutPtr layout)
{
    for (auto it : getDefaultDimensions())
    {
        layout->registerDim(it);
    }
}
Beispiel #21
0
inline MetadataNode toMetadata(PointTableRef table)
{
    const PointLayoutPtr layout(table.layout());
    MetadataNode root;

    for (const auto& id : layout->dims())
    {
        MetadataNode dim("dimensions");
        dim.add("name", layout->dimName(id));
        Dimension::Type::Enum t = layout->dimType(id);
        dim.add("type", Dimension::toName(Dimension::base(t)));
        dim.add("size", layout->dimSize(id));
        root.addList(dim);
    }

    return root;
}
void TextReader::addDimensions(PointLayoutPtr layout)
{
    for (auto name : m_dimNames)
    {
        Dimension::Id::Enum id = layout->registerOrAssignDim(name,
            Dimension::Type::Double);
        m_dims.push_back(id);
    }
}
Beispiel #23
0
void TileDBReader::addDimensions(PointLayoutPtr layout)
{
    // Dimensions are X/Y and maybe Z
    std::vector<tiledb::Dimension> dims =
        m_array->schema().domain().dimensions();

    Dimension::Id id;
    for (size_t i = 0; i < dims.size(); ++i)
    {
        tiledb::Dimension& dim = dims[i];

        DimInfo di;

        di.m_name = dim.name();
        di.m_offset = i;
        di.m_span = dims.size();
        di.m_dimCategory = DimCategory::Dimension;
        di.m_tileType = dim.type();
        di.m_type = getPdalType(di.m_tileType);
        di.m_id = layout->registerOrAssignDim(dim.name(), di.m_type);

        m_dims.push_back(di);
    }

    auto attrs = m_array->schema().attributes();
    for (const auto& a : attrs)
    {
        DimInfo di;

        di.m_name = a.first;
        di.m_offset = 0;
        di.m_span = 1;
        di.m_dimCategory = DimCategory::Attribute;
        di.m_tileType = a.second.type();
        di.m_type = getPdalType(di.m_tileType);
        di.m_id = layout->registerOrAssignDim(a.first, di.m_type);

        m_dims.push_back(di);
    }

    //ABELL
    // Should we check that X Y and Z exist and remap the primary/secondary
    // dimensions to X Y and Z if necessary?
}
Beispiel #24
0
TEST(TextReaderTest, insertHeader)
{
    TextReader reader;
    Options options;
    options.add("header", "A,B,C,G");
    options.add("filename", Support::datapath("text/crlf_test.txt"));
    reader.setOptions(options);

    PointTable table;
    reader.prepare(table);
    PointViewSet pointViewSet = reader.execute(table);
    PointViewPtr pointViewPtr = *pointViewSet.begin();

    EXPECT_EQ(pointViewPtr->size(), 11U);
    PointLayoutPtr layout = table.layout();
    EXPECT_TRUE(layout->findDim("A") != Dimension::Id::Unknown);
    EXPECT_TRUE(layout->findDim("B") != Dimension::Id::Unknown);
    EXPECT_TRUE(layout->findDim("C") != Dimension::Id::Unknown);
    EXPECT_TRUE(layout->findDim("G") != Dimension::Id::Unknown);
}
void DbReader::loadSchema(PointLayoutPtr layout, const XMLSchema& schema)
{
    m_layout = layout;
    m_dims = schema.xmlDims();

    // Override XYZ to doubles and use those going forward
    // we will apply any scaling set before handing it off
    // to PDAL.
    layout->registerDim(Dimension::Id::X);
    layout->registerDim(Dimension::Id::Y);
    layout->registerDim(Dimension::Id::Z);

    m_orientation = schema.orientation();
    m_packedPointSize = 0;
    for (auto di = m_dims.begin(); di != m_dims.end(); ++di)
    {
        di->m_dimType.m_id =
            layout->registerOrAssignDim(di->m_name, di->m_dimType.m_type);
        m_packedPointSize += Dimension::size(di->m_dimType.m_type);
    }
}
Beispiel #26
0
void BpfWriter::loadBpfDimensions(PointLayoutPtr layout)
{
    // Verify that we have X, Y and Z and that they're the first three
    // dimensions.
    Dimension::IdList dims = layout->dims();
    std::sort(dims.begin(), dims.end());
    if (dims.size() < 3 || dims[0] != Dimension::Id::X ||
        dims[1] != Dimension::Id::Y || dims[2] != Dimension::Id::Z)
    {
        throw pdal_error("Missing one of dimensions X, Y or Z.  "
            "Can't write BPF.");
    }

    for (auto id : dims)
    {
        BpfDimension dim;
        dim.m_id = id;
        dim.m_label = layout->dimName(id);
        m_dims.push_back(dim);
    }
}
Beispiel #27
0
void BpfWriter::loadBpfDimensions(PointLayoutPtr layout)
{
    Dimension::IdList dims;

    if (m_outputDims.size())
    {
        for (std::string& s : m_outputDims)
        {
            Dimension::Id::Enum id = layout->findDim(s);
            if (id == Dimension::Id::Unknown)
            {
                std::ostringstream oss;
                oss << "Invalid dimension '" << s << "' specified for "
                    "'output_dims' option.";
                throw pdal_error(oss.str());
            }
            dims.push_back(id);
        }
    }
    else
        dims = layout->dims();

    // Verify that we have X, Y and Z and that they're the first three
    // dimensions.
    std::sort(dims.begin(), dims.end());
    if (dims.size() < 3 || dims[0] != Dimension::Id::X ||
            dims[1] != Dimension::Id::Y || dims[2] != Dimension::Id::Z)
    {
        throw pdal_error("Missing one of dimensions X, Y or Z.  "
                         "Can't write BPF.");
    }

    for (auto id : dims)
    {
        BpfDimension dim;
        dim.m_id = id;
        dim.m_label = layout->dimName(id);
        m_dims.push_back(dim);
    }
}
Beispiel #28
0
void LasWriter::prepared(PointTableRef table)
{
    FlexWriter::validateFilename(table);

    PointLayoutPtr layout = table.layout();

    // Make sure the dataformatID is set so that we can get the proper
    // dimensions being written as part of the standard LAS record.
    fillHeader();

    // If we've asked for all dimensions, add to extraDims all dimensions
    // in the layout that aren't already destined for LAS output.
    if (m_extraDims.size() == 1 && m_extraDims[0].m_name == "all")
    {
        m_extraDims.clear();
        Dimension::IdList ids = m_lasHeader.usedDims();
        DimTypeList dimTypes = layout->dimTypes();
        for (auto& dt : dimTypes)
        {
            if (!Utils::contains(ids, dt.m_id))
                m_extraDims.push_back(
                    ExtraDim(layout->dimName(dt.m_id), dt.m_type));
        }
    }

    m_extraByteLen = 0;
    for (auto& dim : m_extraDims)
    {
        dim.m_dimType.m_id = table.layout()->findDim(dim.m_name);
        if (dim.m_dimType.m_id == Dimension::Id::Unknown)
            throwError("Dimension '" + dim.m_name + "' specified in "
                "'extra_dim' option not found.");
        m_extraByteLen += Dimension::size(dim.m_dimType.m_type);
        log()->get(LogLevel::Info) << getName() << ": Writing dimension " <<
            dim.m_name <<
            "(" << Dimension::interpretationName(dim.m_dimType.m_type) <<
            ") " << " to LAS extra bytes." << std::endl;
    }
}
Beispiel #29
0
TEST(GDALReaderTest, simple)
{
    Options ro;
    ro.add("filename", Support::datapath("png/autzen-height.png"));

    GDALReader gr;
    gr.setOptions(ro);

    PointTable t;
    gr.prepare(t);
    PointViewSet s = gr.execute(t);
    PointViewPtr v = *s.begin();
    PointLayoutPtr l = t.layout();
    Dimension::Id::Enum id1 = l->findDim("band-1");
    Dimension::Id::Enum id2 = l->findDim("band-2");
    Dimension::Id::Enum id3 = l->findDim("band-3");
    EXPECT_EQ(v->size(), (size_t)(735 * 973));

    auto verify = [v, id1, id2, id3]
        (PointId idx, double xx, double xy, double xr, double xg, double xb)
    {
        double r, g, b, x, y;
        x = v->getFieldAs<double>(Dimension::Id::X, idx);
        y = v->getFieldAs<double>(Dimension::Id::Y, idx);
        r = v->getFieldAs<double>(id1, idx);
        g = v->getFieldAs<double>(id2, idx);
        b = v->getFieldAs<double>(id3, idx);
        EXPECT_DOUBLE_EQ(x, xx);
        EXPECT_DOUBLE_EQ(y, xy);
        EXPECT_DOUBLE_EQ(r, xr);
        EXPECT_DOUBLE_EQ(g, xg);
        EXPECT_DOUBLE_EQ(b, xb);
    };

    verify(0, .5, .5, 0, 0, 0);
    verify(120000, 195.5, 163.5, 255, 213, 0);
    verify(290000, 410.5, 394.5, 0, 255, 206);
    verify(715154, 734.5, 972.5, 0, 0, 0);
}
Beispiel #30
0
int DeltaKernel::execute()
{
    PointTable srcTable;
    PointTable candTable;
    DimIndexMap dims;

    PointViewPtr srcView = loadSet(m_sourceFile, srcTable);
    PointViewPtr candView = loadSet(m_candidateFile, candTable);

    PointLayoutPtr srcLayout = srcTable.layout();
    PointLayoutPtr candLayout = candTable.layout();

    Dimension::IdList ids = srcLayout->dims();
    for (Dimension::Id dim : ids)
    {
        std::string name = srcLayout->dimName(dim);
        if (!m_allDims)
            if (name != "X" && name != "Y" && name != "Z")
                continue;
        DimIndex d;
        d.m_name = name;
        d.m_srcId = dim;
        dims[name] = d;
    }
    ids = candLayout->dims();
    for (Dimension::Id dim : ids)
    {
        std::string name = candLayout->dimName(dim);
        auto di = dims.find(name);
        if (di == dims.end())
            continue;
        DimIndex& d = di->second;
        d.m_candId = dim;
    }

    // Remove dimensions that aren't in both the source and candidate lists.
    for (auto di = dims.begin(); di != dims.end();)
    {
        DimIndex& d = di->second;
        if (d.m_candId == Dimension::Id::Unknown)
            dims.erase(di++);
        else
            ++di;
    }

    // Index the candidate data.
    KD3Index index(*candView);
    index.build();

    MetadataNode root;

    if (m_detail)
        root = dumpDetail(srcView, candView, index, dims);
    else
        root = dump(srcView, candView, index, dims);
    Utils::toJSON(root, std::cout);

    return 0;
}