本文整理汇总了C++中FileName::getPrefixNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::getPrefixNumber方法的具体用法?C++ FileName::getPrefixNumber怎么用?C++ FileName::getPrefixNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::getPrefixNumber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readGeoInfo
void ProgXrayImport::readGeoInfo(const FileName &fn, MDRow &rowGeo) const
{
double tiltAngle;
switch (dSource)
{
case MISTRAL:
tiltAngle = dMi(anglesArray, fn.getPrefixNumber()-1);
break;
case BESSY:
case GENERIC:
{
FileName fnBase = fn.withoutExtension();
std::ifstream fhPosition;
fhPosition.open((fnBase+"-positions.txt").c_str());
if (!fhPosition)
REPORT_ERROR(ERR_IO_NOTEXIST,fnBase+"-positions.txt");
int itemsFound=0;
std::string line;
std::vector<std::string> tokens;
while (!fhPosition.eof())
{
getline(fhPosition,line);
splitString(line," ",tokens);
if (tokens[0]=="xm:sample:rx")
{
tiltAngle=textToFloat(tokens[1]);
itemsFound++;
}
if (itemsFound==1)
break;
}
fhPosition.close();
if (itemsFound!=1)
REPORT_ERROR(ERR_VALUE_EMPTY,(std::string)"Cannot find tilt angle in "+
fnBase+"-positions.txt");
}
break;
}
rowGeo.setValue(MDL_ANGLE_TILT, tiltAngle);
}
示例2: getFlatfield
//.........这里部分代码省略.........
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;
// This shift in the crop sizes is exclusive of Mistral data
cropSizeXi = (imgInfo.adim.xdim - std::min(imgInfo.adim.xdim-cropSizeX*2, imFFInfo.adim.xdim))/2 + 1;
cropSizeYi = (imgInfo.adim.ydim - std::min(imgInfo.adim.ydim-cropSizeY*2, imFFInfo.adim.ydim))/2 + 1;
cropSizeXe = cropSizeXi - 2;
cropSizeYe = cropSizeYi - 2;
}
int cropX = (imFFInfo.adim.xdim - (imgInfo.adim.xdim-cropSizeXi-cropSizeXe))/2;// - 1;
int cropY = (imFFInfo.adim.ydim - (imgInfo.adim.ydim-cropSizeYi-cropSizeYe))/2;// - 1;
int N = 0;
Image<double> Iaux;
FileName fnImg;
FOR_ALL_OBJECTS_IN_METADATA(fMD)
{
fMD.getValue(MDL_IMAGE, fnImg, __iter.objId);
readAndCrop(fnImg, Iaux, cropX, cropY);
if ( darkFix )
{
Iaux() -= IavgDark();
forcePositive(Iaux());
}
double currentBeam = 1;
double expTime = 1;
double slitWidth = 1;
switch (ldSource)
{
case MISTRAL:
{
size_t idx = fnImg.getPrefixNumber();
currentBeam = dMi(cBeamArray, idx-1);
expTime = dMi(expTimeArray, idx-1);
slitWidth = dMi(slitWidthArray, idx-1);
}
break;
case BESSY:
case GENERIC:
readCorrectionInfo(fnImg, currentBeam, expTime, slitWidth);
break;
default:
break;
}
Iaux() *= 1.0/(currentBeam*expTime*slitWidth);
if ( N == 0 )
mdaIavg = Iaux();
else
mdaIavg += Iaux();
N++;
}
darkFix = false; // We reset just in case there is no dark field for tomo images
mdaIavg*=1.0/N;
/* Create a mask with zero valued pixels to apply boundaries median filter
* to avoid dividing by zero when normalizing */
MultidimArray<char> &mdaMask = MULTIDIM_ARRAY(bpMask);
if ( !fnBPMask.empty() && !mdaIavg.sameShape(mdaMask) )
REPORT_ERROR(ERR_MULTIDIM_SIZE, "XrayImport: Mask size does not match flat fields size.");
if (BPFactor > 0)
{
double avg, std;
mdaIavg.computeAvgStdev(avg, std);
mdaMask.resize(mdaIavg, false);
double th = avg - std*BPFactor;
FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY(mdaMask)
dAi(mdaMask, n) = dAi(mdaIavg, n) < th;
}
else if (fnBPMask.empty())
mdaIavg.equal(0,mdaMask);
MultidimArray<char> mask = mdaMask;
boundMedianFilter(mdaIavg,mask);
}