本文整理汇总了C++中WorkspaceGroup_sptr::setTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ WorkspaceGroup_sptr::setTitle方法的具体用法?C++ WorkspaceGroup_sptr::setTitle怎么用?C++ WorkspaceGroup_sptr::setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorkspaceGroup_sptr
的用法示例。
在下文中一共展示了WorkspaceGroup_sptr::setTitle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doLoadFiles
/**
* Create FITS file information for each file selected. Loads headers
* and data from the files and creates and fills the output
* workspace(s).
*
* @param paths File names as given in the algorithm input property
*
* @param outWSName name of the output (group) workspace to create
*
* @param loadAsRectImg Load files with 1 spectrum per row and 1 bin
* per column, so a color fill plot displays the image
*
* @param binSize size to rebin (1 == no re-bin == default)
*
* @param noiseThresh threshold for noise filtering
*
* @throw std::runtime_error when load fails (for example a memory
* allocation issue, wrong rebin requested, etc.)
*/
void LoadFITS::doLoadFiles(const std::vector<std::string> &paths,
const std::string &outWSName, bool loadAsRectImg,
int binSize, double noiseThresh) {
std::vector<FITSInfo> headers;
headers.resize(paths.size());
loadHeader(paths[0], headers[0]);
// No extension is set -> it's the standard format which we can parse.
if (headers[0].numberOfAxis > 0)
m_pixelCount += headers[0].axisPixelLengths[0];
// Presumably 2 axis, but futureproofing.
for (int i = 1; i < headers[0].numberOfAxis; ++i) {
m_pixelCount *= headers[0].axisPixelLengths[i];
}
// Check consistency of binSize asap
for (int i = 0; i < headers[0].numberOfAxis; ++i) {
if (0 != (headers[0].axisPixelLengths[i] % binSize)) {
throw std::runtime_error(
"Cannot rebin this image in blocks of " + std::to_string(binSize) +
" x " + std::to_string(binSize) +
" pixels as requested because the size of dimension " +
std::to_string(i + 1) + " (" +
std::to_string(headers[0].axisPixelLengths[i]) +
") is not a multiple of the bin size.");
}
}
MantidImage imageY(headers[0].axisPixelLengths[1],
std::vector<double>(headers[0].axisPixelLengths[0]));
MantidImage imageE(headers[0].axisPixelLengths[1],
std::vector<double>(headers[0].axisPixelLengths[0]));
size_t bytes = (headers[0].bitsPerPixel / 8) * m_pixelCount;
std::vector<char> buffer;
try {
buffer.resize(bytes);
} catch (std::exception &) {
throw std::runtime_error(
"Could not allocate enough memory to run when trying to allocate " +
std::to_string(bytes) + " bytes.");
}
// Create a group for these new workspaces, if the group already exists, add
// to it.
size_t fileNumberInGroup = 0;
WorkspaceGroup_sptr wsGroup;
if (!AnalysisDataService::Instance().doesExist(outWSName)) {
wsGroup = boost::make_shared<WorkspaceGroup>();
wsGroup->setTitle(outWSName);
} else {
// Get the name of the latest file in group to start numbering from
if (AnalysisDataService::Instance().doesExist(outWSName))
wsGroup =
AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>(outWSName);
std::string latestName = wsGroup->getNames().back();
// Set next file number
fileNumberInGroup = fetchNumber(latestName) + 1;
}
size_t totalWS = headers.size();
// Create a progress reporting object
API::Progress progress(this, 0, 1, totalWS + 1);
progress.report(0, "Loading file(s) into workspace(s)");
// Create first workspace (with instrument definition). This is also used as
// a template for creating others
Workspace2D_sptr imgWS;
imgWS = makeWorkspace(headers[0], fileNumberInGroup, buffer, imageY, imageE,
imgWS, loadAsRectImg, binSize, noiseThresh);
progress.report(1, "First file loaded.");
wsGroup->addWorkspace(imgWS);
if (isInstrOtherThanIMAT(headers[0])) {
// For now we assume IMAT except when specific headers are found by
// isInstrOtherThanIMAT()
//.........这里部分代码省略.........