本文整理汇总了C++中FileName::data方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::data方法的具体用法?C++ FileName::data怎么用?C++ FileName::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::data方法的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: read
// Reading from a file
void MlModel::read(FileName fn_in)
{
// Clear current model
clear();
// Open input file
std::ifstream in(fn_in.data(), std::ios_base::in);
if (in.fail())
{
REPORT_ERROR((std::string) "MlModel::readStar: File " + fn_in + " cannot be read.");
}
MetaDataTable MDclass, MDgroup, MDlog, MDsigma;
// Read general stuff
MDlog.readStar(in, "model_general");
if (!MDlog.getValue(EMDL_MLMODEL_DIMENSIONALITY, ref_dim) ||
!MDlog.getValue(EMDL_MLMODEL_ORIGINAL_SIZE, ori_size) ||
!MDlog.getValue(EMDL_MLMODEL_CURRENT_RESOLUTION, current_resolution) ||
!MDlog.getValue(EMDL_MLMODEL_CURRENT_SIZE, current_size) ||
!MDlog.getValue(EMDL_MLMODEL_PADDING_FACTOR, padding_factor) ||
!MDlog.getValue(EMDL_MLMODEL_INTERPOLATOR, interpolator) ||
!MDlog.getValue(EMDL_MLMODEL_MINIMUM_RADIUS_NN_INTERPOLATION, r_min_nn) ||
!MDlog.getValue(EMDL_MLMODEL_PIXEL_SIZE, pixel_size) ||
!MDlog.getValue(EMDL_MLMODEL_NR_CLASSES, nr_classes) ||
!MDlog.getValue(EMDL_MLMODEL_NR_GROUPS, nr_groups) ||
!MDlog.getValue(EMDL_MLMODEL_TAU2_FUDGE_FACTOR, tau2_fudge_factor) ||
!MDlog.getValue(EMDL_MLMODEL_NORM_CORRECTION_AVG, avg_norm_correction) ||
!MDlog.getValue(EMDL_MLMODEL_SIGMA_OFFSET, sigma2_offset) ||
!MDlog.getValue(EMDL_MLMODEL_PRIOR_MODE, orientational_prior_mode) ||
!MDlog.getValue(EMDL_MLMODEL_SIGMA_ROT, sigma2_rot) ||
!MDlog.getValue(EMDL_MLMODEL_SIGMA_TILT, sigma2_tilt) ||
!MDlog.getValue(EMDL_MLMODEL_SIGMA_PSI, sigma2_psi) ||
!MDlog.getValue(EMDL_MLMODEL_LL, LL) ||
!MDlog.getValue(EMDL_MLMODEL_AVE_PMAX, ave_Pmax))
{
REPORT_ERROR("MlModel::readStar: incorrect model_general table");
}
// Take inverse again of current resolution:
current_resolution = 1. / current_resolution;
sigma2_offset *= sigma2_offset;
sigma2_rot *= sigma2_rot;
sigma2_tilt *= sigma2_tilt;
sigma2_psi *= sigma2_psi;
// Resize vectors
initialise();
// Read classes
FileName fn_tmp;
Image<double> img;
MDclass.readStar(in, "model_classes");
int iclass = 0;
FOR_ALL_OBJECTS_IN_METADATA_TABLE(MDclass)
{
if (!MDclass.getValue(EMDL_MLMODEL_REF_IMAGE, fn_tmp) ||
!MDclass.getValue(EMDL_MLMODEL_PDF_CLASS, pdf_class[iclass]) ||
!MDclass.getValue(EMDL_MLMODEL_ACCURACY_ROT, acc_rot[iclass]) ||
!MDclass.getValue(EMDL_MLMODEL_ACCURACY_TRANS, acc_trans[iclass]))
{
REPORT_ERROR("MlModel::readStar: incorrect model_classes table");
}
if (ref_dim == 2)
{
if (!MDclass.getValue(EMDL_MLMODEL_PRIOR_OFFX_CLASS, XX(prior_offset_class[iclass])) ||
!MDclass.getValue(EMDL_MLMODEL_PRIOR_OFFY_CLASS, YY(prior_offset_class[iclass])))
{
REPORT_ERROR("MlModel::readStar: incorrect model_classes table: no offset priors for 2D classes");
}
}
// Read in actual reference image
img.read(fn_tmp);
Iref[iclass] = img();
iclass++;
}
// Read group stuff
MDgroup.readStar(in, "model_groups");
long int igroup;
FOR_ALL_OBJECTS_IN_METADATA_TABLE(MDgroup)
{
if (!MDgroup.getValue(EMDL_MLMODEL_GROUP_NO, igroup))
{
REPORT_ERROR("MlModel::readStar: incorrect model_groups table");
}
//Start counting of groups at 1, not at 0....
if (!MDgroup.getValue(EMDL_MLMODEL_GROUP_SCALE_CORRECTION, scale_correction[igroup - 1]) ||
!MDgroup.getValue(EMDL_MLMODEL_GROUP_NR_PARTICLES, nr_particles_group[igroup - 1]) ||
!MDgroup.getValue(EMDL_MLMODEL_GROUP_NAME, group_names[igroup - 1]))
{
REPORT_ERROR("MlModel::readStar: incorrect model_groups table");
}
}
//.........这里部分代码省略.........