本文整理汇总了C++中FileName::getFiles方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::getFiles方法的具体用法?C++ FileName::getFiles怎么用?C++ FileName::getFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::getFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDarkfield
void ProgXrayImport::getDarkfield(const FileName &fnDir, Image<double> &IavgDark)
{
IavgDark.clear();
std::vector<FileName> listDir;
fnDir.getFiles(listDir);
for (size_t i=0; i<listDir.size(); i++)
if (listDir[i]=="darkfields")
{
std::cout << formatString("Getting darkfield from %s/darkfields",fnDir.c_str()) << " ..." << std::endl;
darkFix = true;
std::vector<FileName> listDirDark;
FileName(fnDir+"/darkfields").getFiles(listDirDark);
int N = 0;
for (size_t j=0; j<listDirDark.size(); j++)
{
if (!listDirDark[j].hasImageExtension())
continue;
Image<double> Iaux;
readAndCrop(fnDir+"/darkfields/"+listDirDark[j],Iaux, cropSizeX, cropSizeY);
if (N==0)
IavgDark()=Iaux();
else
IavgDark()+=Iaux();
N++;
}
if (N==0)
REPORT_ERROR(ERR_IO_NOTEXIST,"darkfields directory is empty");
IavgDark()*=1.0/N;
break;
}
}
示例2: getFlatfield
void ProgXrayImport::getFlatfield(const FileName &fnFFinput,
Image<double> &Iavg)
{
// Process the flatfield images
MultidimArray<double> &mdaIavg = Iavg();
Matrix1D<double> expTimeArray, cBeamArray, slitWidthArray; // Local vectors
DataSource ldSource = dSource;
// Checking if fnFFinput is a single file to obtain the flatfield avg from
if (extFlat && isImage(fnFFinput))
{
fMD.read(fnFFinput);
ldSource = NONE;
}
else
{
switch (ldSource)
{
case MISTRAL:
if (!H5File.checkDataset(fnFFinput.getBlockName().c_str()))
break;
{
fMD.read(fnFFinput);
H5File.getDataset("NXtomo/instrument/bright_field/ExpTimes", expTimeArray, false);
H5File.getDataset("NXtomo/instrument/bright_field/current", cBeamArray, false);
// If expTime is empty or only one single value in nexus file then we fill with 1
if (expTimeArray.size() < 2)
{
reportWarning("Input file does not contains flatfields' exposition time information.");
expTimeArray.initConstant(fMD.size(), 1.);
}
// If current is empty or only one single value in nexus file then we fill with 1
if (cBeamArray.size() < 2)
{
reportWarning("Input file does not contains flatfields' current beam information.");
cBeamArray.initConstant(fMD.size(), 1.);
}
}
// Since Alba does not provide slit width, we set to ones
slitWidthArray.initConstant(fMD.size(), 1.);
break;
case BESSY:
{
size_t objId;
for (size_t i = fIni; i <= fEnd; ++i)
{
objId = fMD.addObject();
fMD.setValue(MDL_IMAGE, fnFFinput + formatString("/img%d.spe", i), objId);
}
break;
}
case GENERIC:
{
// Get Darkfield
std::cout << "Getting darkfield from "+fnFFinput << " ..." << std::endl;
getDarkfield(fnFFinput, IavgDark);
if (darkFix)
IavgDark.write(fnRoot+"_"+fnFFinput.removeDirectories()+"_darkfield.xmp");
std::vector<FileName> listDir;
fnFFinput.getFiles(listDir);
size_t objId;
for (size_t i = 0; i < listDir.size(); ++i)
{
if (!listDir[i].hasImageExtension())
continue;
objId = fMD.addObject();
fMD.setValue(MDL_IMAGE, fnFFinput+"/"+listDir[i], objId);
}
}
break;
}
}
if ( fMD.size() == 0 )
{
reportWarning("XrayImport::getFlatfield: No images to process");
return;
}
ImageInfo imFFInfo;
getImageInfo(fMD, imFFInfo);
if ( (imFFInfo.adim.xdim != imgInfo.adim.xdim) || (imFFInfo.adim.ydim != imgInfo.adim.ydim) )
{
reportWarning(formatString("XrayImport:: Flatfield images size %dx%d different from Tomogram images size %dx%d",
imFFInfo.adim.xdim,imFFInfo.adim.ydim,imgInfo.adim.xdim,imgInfo.adim.ydim));
std::cout << "Setting crop values to fit the smallest dimensions." <<std::endl;
//.........这里部分代码省略.........