本文整理汇总了C++中FileName::getFileFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::getFileFormat方法的具体用法?C++ FileName::getFileFormat怎么用?C++ FileName::getFileFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::getFileFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
int MetaDataTable::read(const FileName &filename, const std::string &name, std::vector<EMDLabel> *desiredLabels)
{
// Clear current table
clear();
std::ifstream in(filename.data(), std::ios_base::in);
if (in.fail())
REPORT_ERROR( (std::string) "MetaDataTable::read: File " + filename + " does not exists" );
FileName ext = filename.getFileFormat();
if (ext =="star")
{
//REPORT_ERROR("readSTAR not implemented yet...");
return readStar(in, name, desiredLabels);
}
else
{
REPORT_ERROR("MetaDataTable::read ERROR: metadatatable should have .star extension");
}
in.close();
}
示例2: 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;
}
}