本文整理汇总了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();
}
示例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;
}