void ViNoiseBatcher::addDir(QString dirName) { QDir dirFile("/home/visore/Visore Projects/Files/" + dirName); if(!dirFile.exists()) { cout << "Directory does not exist: " << dirFile.absolutePath().toLatin1().data() << endl; return; } QDir dirResult("/home/visore/Visore Projects/Results/" + dirName); if(!dirResult.exists()) dirResult.mkpath(dirResult.absolutePath()); if(SUMMARY) { QString summary = dirResult.absolutePath() + "/summary.txt"; if(!mSummaryFiles.contains(summary)) { printFileHeader(summary); mSummaryFiles.append(summary); } } QDir dir(dirFile.absolutePath()); QStringList files = dir.entryList(QDir::Files); for(int j = 0; j < files.size(); ++j) { mFiles.enqueue(dir.absoluteFilePath(files[j])); QString id = ViId::generate(); mResults.enqueue(dirResult.absolutePath() + "/" + mDetector->name() + "_" + id + "_ALL.txt"); mResults2.enqueue(dirResult.absolutePath() + "/" + mDetector->name() + "_" + id + "_MINIFIED.txt"); } }
void ViStatistician::addDir(QString dirName) { QDir dirFile("/home/visore/Visore Projects/Files/" + dirName); if(!dirFile.exists()) { cout << "Directory does not exist: " << dirFile.absolutePath().toLatin1().data() << endl; return; } QDir dirResult("/home/visore/Visore Projects/Results/" + dirName); if(!dirResult.exists()) dirResult.mkpath(dirResult.absolutePath()); QDir dir(dirFile.absolutePath()); QStringList files = dir.entryList(QDir::Files); for(int j = 0; j < files.size(); ++j) { mFiles.enqueue(dir.absoluteFilePath(files[j])); } QString name = ""; if(mMode == Mean) name = "mean"; else if(mMode == StandardDeviation) name = "standarddeviation"; else if(mMode == Pearson) name = "pearson"; mFile = dirResult.absolutePath() + "/summary" + name + ".txt"; }
std::vector<f32> Polygon::AxialMoments( const std::vector<vec3f> &directions ) const { const u32 dsize = (u32) directions.size(); const u32 order = ( dsize - 1 ) / 2 + 1; std::vector<f32> result( dsize * order, 0.f ); for ( u32 i = 0; i < dsize; ++i ) { std::vector<f32> dirResult( order, 0.f ); const vec3f &d = directions[i]; AxialMoment( d, order - 1, dirResult ); for ( u32 j = 0; j < order; ++j ) { result[i*order + j] = dirResult[j]; } } return result; }
void Global::initialize() { if(Global::Init) return; QCoreApplication* app = QApplication::instance(); QString strConfigFile = QFileInfo(app->applicationFilePath()).baseName() + ".ini"; if(!QFile::exists(strConfigFile)) { qFatal("配置文件不存在:\r\n%s", qPrintable(strConfigFile)); } Global::Awesome = new QtAwesome(); Global::Awesome->initFontAwesome(); Global::settings = new QSettings(strConfigFile, QSettings::IniFormat); settings->setIniCodec("UTF8"); Global::Database = Global::settings->value("MYSQL/databasename", Global::Database).toString(); Global::Hostname = Global::settings->value("MYSQL/hostname", Global::Hostname).toString(); Global::Username = Global::settings->value("MYSQL/username", Global::Username).toString(); Global::Passwd = Global::settings->value("MYSQL/passwd", Global::Passwd).toString(); Global::PathImage = Global::settings->value("IMAGE/pathImage",Global::PathImage).toString(); Global::PathMask = Global::settings->value("IMAGE/pathMask", Global::PathMask).toString(); Global::PathResult = Global::settings->value("IMAGE/pathResult", Global::PathResult).toString(); QDir dirMask(Global::PathMask); QDir dirResult(Global::PathResult); if(!dirMask.exists()) dirMask.mkdir(Global::PathMask); if(!dirResult.exists()) dirResult.mkdir(Global::PathResult); Global::ExtMask = Global::settings->value("IMAGE/extMask", Global::ExtMask).toString(); Global::ExtResult = Global::settings->value("IMAGE/extResult", Global::ExtResult).toString(); Global::Init = true; }