本文整理汇总了C++中nexus::File::makeData方法的典型用法代码示例。如果您正苦于以下问题:C++ File::makeData方法的具体用法?C++ File::makeData怎么用?C++ File::makeData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nexus::File
的用法示例。
在下文中一共展示了File::makeData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeLogValues
void SaveNXTomo::writeLogValues(const DataObjects::Workspace2D_sptr workspace,
::NeXus::File &nxFile, int thisFileInd) {
// Add Log information (minus special values - Rotation, ImageKey, Intensity)
// Unable to add multidimensional string data, storing strings as
// multidimensional data set of uint8 values
try {
nxFile.openPath("/entry1/log_info");
} catch (...) {
throw std::runtime_error("Unable to create a valid NXTomo file");
}
// Loop through all log values, create it if it doesn't exist. Then append
// value
std::vector<Property *> logVals = workspace->run().getLogData();
for (auto it = logVals.begin(); it != logVals.end(); ++it) {
auto prop = *it;
if (prop->name() != "ImageKey" && prop->name() != "Rotation" &&
prop->name() != "Intensity" && prop->name() != "Axis1" &&
prop->name() != "Axis2") {
try {
nxFile.openData(prop->name());
} catch (::NeXus::Exception &) {
// Create the data entry if it doesn't exist yet, and open.
std::vector<int64_t> infDim;
infDim.push_back(NX_UNLIMITED);
infDim.push_back(NX_UNLIMITED);
nxFile.makeData(prop->name(), ::NeXus::UINT8, infDim, true);
}
size_t strSize = prop->value().length();
char *val = new char[80]();
// If log value is from FITS file as it should be,
// it won't be greater than this. Otherwise Shorten it
if (strSize > 80)
strSize = 80;
strncpy(val, prop->value().c_str(), strSize);
std::vector<int64_t> start, size;
start.push_back(thisFileInd);
start.push_back(0);
size.push_back(1);
size.push_back(strSize);
// single item
nxFile.putSlab(val, start, size);
nxFile.closeData();
}
}
}