当前位置: 首页>>代码示例>>C++>>正文


C++ Tag::getFeature方法代码示例

本文整理汇总了C++中Tag::getFeature方法的典型用法代码示例。如果您正苦于以下问题:C++ Tag::getFeature方法的具体用法?C++ Tag::getFeature怎么用?C++ Tag::getFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tag的用法示例。


在下文中一共展示了Tag::getFeature方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testRead

void BaseTestReadOnly::testRead() {
    File file = File::open("test_read_only.h5", FileMode::ReadOnly);

    Section section = file.getSection(section_id);
    Block block = file.getBlock(block_id);
    DataArray data_array = block.getDataArray(data_array_id);
    Dimension dim = data_array.getDimension(dim_index);
    SampledDimension dim_sampled = data_array.getDimension(dim_sampled_index).asSampledDimension();
    RangeDimension dim_range = data_array.getDimension(dim_range_index).asRangeDimension();
    SetDimension dim_set = data_array.getDimension(dim_set_index).asSetDimension();
    Tag tag = block.getTag(tag_id);
    MultiTag mtag = block.getMultiTag(mtag_id);
    Feature feature = tag.getFeature(feature_id);
    Property property = section.getProperty(property_id);

    // TODO use assertions here
    s << block.id() << block.name();
    s << data_array.id() << data_array.name();
    s << tag.id() << tag.name();
    s << mtag.id() << mtag.name();
    s << feature.id();
    s << property.id() << property.name();
    s << dim.index();
    s << dim_sampled.index();
    s << dim_range.index();
    s << dim_set.index();
    
    file.close();
}
开发者ID:Prabhnith,项目名称:nix,代码行数:29,代码来源:BaseTestReadOnly.cpp

示例2: retrieveFeatureData

DataView retrieveFeatureData(const Tag &tag, size_t feature_index) {
    if (tag.featureCount() == 0) {
        throw nix::OutOfBounds("There are no features associated with this tag!", 0);
    }
    if (feature_index > tag.featureCount()) {
        throw nix::OutOfBounds("Feature index out of bounds.", 0);
    }
    Feature feat = tag.getFeature(feature_index);
    DataArray data = feat.data();
    if (data == nix::none) {
        throw nix::UninitializedEntity();
        //return NDArray(nix::DataType::Float,{0});
    }
    if (feat.linkType() == nix::LinkType::Tagged) {
        NDSize offset, count;
        getOffsetAndCount(tag, data, offset, count);
        if (!positionAndExtentInData(data, offset, count)) {
            throw nix::OutOfBounds("Requested data slice out of the extent of the Feature!", 0);
        }
        DataView io = DataView(data, count, offset);
        return io;
    }
    // for untagged and indexed return the full data
    NDSize offset(data.dataExtent().size(), 0);
    DataView io = DataView(data, data.dataExtent(), offset);
    return io;
}
开发者ID:neurodebian,项目名称:nix,代码行数:27,代码来源:dataAccess.cpp


注:本文中的Tag::getFeature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。