本文整理汇总了C++中MetaData::setRow方法的典型用法代码示例。如果您正苦于以下问题:C++ MetaData::setRow方法的具体用法?C++ MetaData::setRow怎么用?C++ MetaData::setRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaData
的用法示例。
在下文中一共展示了MetaData::setRow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: produce_all_images
/* Produce all images ------------------------------------------------------ */
void Micrograph::produce_all_images(int label, double minCost,
const FileName &fn_rootIn, const FileName &fn_image, double ang,
double tilt, double psi, bool rmStack)
{
MetaData SF;
Image<double> I;
Micrograph *M;
// Set Source image
if (fn_image == "")
M = this;
else
{
M = new Micrograph;
M->open_micrograph(fn_image/*, swapbyte*/);
M->set_window_size(X_window_size, Y_window_size);
M->set_transmitance_flag(compute_transmitance);
M->set_inverse_flag(compute_inverse);
}
// Set scale for particles
int MXdim, MYdim, thisXdim, thisYdim;
M->size(MXdim, MYdim);
this->size(thisXdim, thisYdim);
double scaleX = (double) MXdim / thisXdim;
double scaleY = (double) MYdim / thisYdim;
// Compute max and minimum if compute_transmitance
// or compute_inverse flags are ON
double Dmax=0., Dmin=0.;
if (compute_transmitance || compute_inverse)
{
(*this).computeDoubleMinMax(Dmin, Dmax);
if (compute_transmitance)
{
if (Dmin > 1)
Dmin = log10(Dmin);
if (Dmax > 1)
Dmax = log10(Dmax);
}
}
// Scissor all particles
if (ang != 0)
std::cout << "Angle from Y axis to tilt axis " << ang << std::endl
<< " applying appropriate rotation\n";
int nmax = ParticleNo();
FileName fn_aux;
FileName _ext = fn_rootIn.getFileFormat();
FileName fn_out;
FileName fn_root = fn_rootIn.removeFileFormat().removeLastExtension();
if (fn_rootIn.hasStackExtension())
fn_out=fn_root.addExtension(_ext);
else
fn_out=fn_rootIn.addExtension("stk");
if (rmStack)
fn_out.deleteFile();
size_t ii = 0;
size_t id;
for (int n = 0; n < nmax; n++)
if (coords[n].valid && coords[n].cost > minCost && coords[n].label == label)
{
fn_aux.compose(++ii, fn_out);
id = SF.addObject();
// If the ctfRow was set, copy the info to images metadata
if (ctfRow.containsLabel(MDL_CTF_DEFOCUSU))
SF.setRow(ctfRow, id);
SF.setValue(MDL_IMAGE, fn_aux, id);
SF.setValue(MDL_MICROGRAPH, M->fn_micrograph, id);
SF.setValue(MDL_XCOOR, coords[n].X, id);
SF.setValue(MDL_YCOOR, coords[n].Y, id);
bool t = M->scissor(coords[n], I(), Dmin, Dmax, scaleX, scaleY);
if (!t)
{
std::cout << "Particle " << fn_aux
<< " is very near the border, "
<< "corresponding image is set to blank\n";
SF.setValue(MDL_ENABLED, -1, id);
}
else
SF.setValue(MDL_ENABLED, 1, id);
// if (ang!=0) I().rotate(-ang);
I.write(fn_out, ii, true, WRITE_APPEND);
}
SF.write(fn_out.withoutExtension() + ".xmd");
// Free source image??
if (fn_image != "")
{
M->close_micrograph();
delete M;
}
}
示例2: runThread
void runThread(ThreadArgument &thArg)
{
int thread_id = thArg.thread_id;
ProgXrayImport * ptrProg= (ProgXrayImport *)thArg.workClass;
MetaData localMD;
Image<double> Iaux;
FileName fnImgIn, fnImgOut;
size_t first = 0, last = 0;
MultidimArray<char> mask;
while (ptrProg->td->getTasks(first, last))
{
for (size_t i=first; i<=last; i++)
{
ptrProg->inMD.getValue(MDL_IMAGE, fnImgIn, ptrProg->objIds[i]);
MDRow rowGeo;
ptrProg->readGeoInfo(fnImgIn, rowGeo);
// ptrProg->readAndCrop(fnImgIn, Iaux, ptrProg->cropSizeX, ptrProg->cropSizeY);
Iaux.read(fnImgIn);
Iaux().selfWindow(ptrProg->cropSizeYi,ptrProg->cropSizeXi,
(int)(YSIZE(Iaux())-ptrProg->cropSizeYe-1),(int)(XSIZE(Iaux())-ptrProg->cropSizeXe-1));
Iaux().resetOrigin();
if (XSIZE(ptrProg->IavgDark())!=0)
{
Iaux()-=ptrProg->IavgDark();
forcePositive(Iaux());
}
double currentBeam = 1;
double expTime = 1;
double slitWidth = 1;
if ( ptrProg->dSource == ptrProg->MISTRAL )
{
size_t idx = fnImgIn.getPrefixNumber();
currentBeam = dMi(ptrProg->cBeamArray, idx-1);
expTime = dMi(ptrProg->expTimeArray, idx-1);
slitWidth = dMi(ptrProg->slitWidthArray, idx-1);
}
else
ptrProg->readCorrectionInfo(fnImgIn, currentBeam, expTime, slitWidth);
Iaux() *= 1.0/(currentBeam*expTime*slitWidth);
if (XSIZE(ptrProg->IavgFlat())!=0)
Iaux()/=ptrProg->IavgFlat();
// Assign median filter to zero valued pixels to avoid -inf when applying log10
Iaux().equal(0,mask);
mask.resizeNoCopy(Iaux());
if (XSIZE(ptrProg->bpMask()) != 0)
mask += ptrProg->bpMask();
boundMedianFilter(Iaux(), mask);
if (ptrProg->logFix)
{
Iaux().selfLog();
if (ptrProg->selfAttFix)
Iaux() *= -1.;
}
fnImgOut.compose(i+1, ptrProg->fnOut);
size_t objId = localMD.addObject();
localMD.setValue(MDL_IMAGE,fnImgOut,objId);
localMD.setRow(rowGeo, objId); //
// localMD.setValue(MDL_ANGLE_TILT,Iaux.tilt(),objId);
Iaux.write(fnImgOut);
if (thread_id==0)
progress_bar(i);
}
}
//Lock for update the total counter
ptrProg->mutex.lock();
ptrProg->outMD.unionAll(localMD);
ptrProg->mutex.unlock();
}
示例3: run
//.........这里部分代码省略.........
row.setValue(MDL_ZSCORE_HISTOGRAM,zscoreHist);
if (addToInput)
{
SF.setValue(MDL_ZSCORE,zscore,isort_1);
SF.setValue(MDL_ZSCORE_SHAPE1,zscoreShape1,isort_1);
SF.setValue(MDL_ZSCORE_SHAPE2,zscoreShape2,isort_1);
SF.setValue(MDL_ZSCORE_SNR1,zscoreSNR1,isort_1);
SF.setValue(MDL_ZSCORE_SNR2,zscoreSNR2,isort_1);
SF.setValue(MDL_ZSCORE_HISTOGRAM,zscoreHist,isort_1);
}
SFout.addRow(row);
}
//Sorting taking into account a given percentage
if (per > 0)
{
MultidimArray<int> sortedShape1,sortedShape2,sortedSNR1,sortedSNR2,sortedHist,
sortedShapeSF1,sortedShapeSF2,sortedSNR1SF,sortedSNR2SF,sortedHistSF;
sortedZscoreShape1.indexSort(sortedShape1);
sortedZscoreShape2.indexSort(sortedShape2);
sortedZscoreSNR1.indexSort(sortedSNR1);
sortedZscoreSNR2.indexSort(sortedSNR2);
sortedZscoreHist.indexSort(sortedHist);
size_t numPartReject = (size_t)std::floor((per/100)*SF.size());
for (size_t numPar = SF.size()-1; numPar > (SF.size()-numPartReject); --numPar)
{
int isort_1 = DIRECT_A1D_ELEM(sortedShape1,numPar);
SFout.getRow(row, isort_1);
row.setValue(MDL_ENABLED,-1);
SFout.setRow(row,isort_1);
isort_1 = DIRECT_A1D_ELEM(sortedShape2,numPar);
SFout.getRow(row, isort_1);
row.setValue(MDL_ENABLED,-1);
SFout.setRow(row,isort_1);
isort_1 = DIRECT_A1D_ELEM(sortedSNR1,numPar);
SFout.getRow(row, isort_1);
row.setValue(MDL_ENABLED,-1);
SFout.setRow(row,isort_1);
isort_1 = DIRECT_A1D_ELEM(sortedSNR2,numPar);
SFout.getRow(row, isort_1);
row.setValue(MDL_ENABLED,-1);
SFout.setRow(row,isort_1);
isort_1 = DIRECT_A1D_ELEM(sortedHist,numPar);
SFout.getRow(row, isort_1);
row.setValue(MDL_ENABLED,-1);
SFout.setRow(row,isort_1);
if (addToInput)
{
ZscoreShape1.indexSort(sortedShapeSF1);
ZscoreShape2.indexSort(sortedShapeSF2);
ZscoreSNR1.indexSort(sortedSNR1SF);
ZscoreSNR2.indexSort(sortedSNR2SF);
ZscoreHist.indexSort(sortedHistSF);
isort_1 = DIRECT_A1D_ELEM(sortedShapeSF1,numPar);
SF.getRow(row, isort_1);
row.setValue(MDL_ENABLED,-1);