MCPcopy Create free account
hub / github.com/PRBonn/semantic_suma / openFile

Method openFile

src/visualizer/VisualizerWindow.cpp:352–520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350}
351
352void VisualizerWindow::openFile(const QString& filename) {
353 play(false); // stop playback.
354
355 if (!filename.isNull()) {
356 QString title = "Semantic SuMa";
357 title.append(" - ");
358 QStringList parts = filename.split("/");
359 title.append(QString::fromStdString(FileUtil::dirName(filename.toStdString())));
360 setWindowTitle(title);
361
362 std::shared_ptr<Model> model;
363 ui_.wCanvas->setRobotModel(model);
364
365 std::string extension = "INVALID";
366
367 QFileInfo file_info(filename);
368 if (file_info.isDir()) {
369 QDir directory(filename);
370 QStringList files = directory.entryList(QDir::NoFilter, QDir::Name);
371
372 std::map<std::string, int32_t> suffix_count;
373 for (int32_t i = 0; i < files.size(); ++i) {
374 QFileInfo info(directory.filePath(files[i]));
375 if (!info.isFile()) continue;
376
377 std::string ext = info.suffix().toStdString();
378 if (suffix_count.find(ext) == suffix_count.end()) suffix_count[ext] = 0;
379 suffix_count[ext] += 1;
380 }
381
382 if (suffix_count.size() > 0) {
383 int32_t maxCount = suffix_count.begin()->second;
384 extension = std::string(".") + suffix_count.begin()->first;
385
386 for (auto& entry : suffix_count) {
387 if (entry.second > maxCount) {
388 extension = std::string(".") + entry.first;
389 maxCount = entry.second;
390 }
391 }
392
393 std::cout << "Heuristically found '" << extension << "' as extension." << std::endl;
394 }
395 } else if (file_info.isFile()) {
396 extension = std::string(".") + file_info.suffix().toStdString();
397 }
398
399 if (extension == ".bin") {
400 delete reader_;
401 KITTIReader* reader_tmp = new KITTIReader(filename.toStdString(), params_, 50);
402
403 ui_.wCanvas->setColorMap(reader_tmp->getColorMap()); // get color map from rangenet
404 fusion_->setColorMap(reader_tmp->getColorMap());
405
406 reader_ = reader_tmp;
407
408 scanFrequency = 10.0f; // in Hz.
409 timer_.setInterval(10); // 1./10. second = 100 msecs.

Callers 1

mainFunction · 0.80

Calls 15

dirNameFunction · 0.85
loadPosesFunction · 0.85
setRobotModelMethod · 0.80
push_backMethod · 0.80
setGroundtruthMethod · 0.80
setMaximumMethod · 0.80
setScanCountMethod · 0.80
sizeMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
setColorMapMethod · 0.45
getColorMapMethod · 0.45

Tested by

no test coverage detected