int DeltaKernel::execute() { PointTable srcTable; PointTable candTable; DimIndexMap dims; PointViewPtr srcView = loadSet(m_sourceFile, srcTable); PointViewPtr candView = loadSet(m_candidateFile, candTable); PointLayoutPtr srcLayout = srcTable.layout(); PointLayoutPtr candLayout = candTable.layout(); Dimension::IdList ids = srcLayout->dims(); for (Dimension::Id dim : ids) { std::string name = srcLayout->dimName(dim); if (!m_allDims) if (name != "X" && name != "Y" && name != "Z") continue; DimIndex d; d.m_name = name; d.m_srcId = dim; dims[name] = d; } ids = candLayout->dims(); for (Dimension::Id dim : ids) { std::string name = candLayout->dimName(dim); auto di = dims.find(name); if (di == dims.end()) continue; DimIndex& d = di->second; d.m_candId = dim; } // Remove dimensions that aren't in both the source and candidate lists. for (auto di = dims.begin(); di != dims.end();) { DimIndex& d = di->second; if (d.m_candId == Dimension::Id::Unknown) dims.erase(di++); else ++di; } // Index the candidate data. KD3Index index(*candView); index.build(); MetadataNode root; if (m_detail) root = dumpDetail(srcView, candView, index, dims); else root = dump(srcView, candView, index, dims); Utils::toJSON(root, std::cout); return 0; }
void PlayersListModel::setNickname(const QString &nickname) { m_nickname = nickname; loadSet(m_friendsSet, "friends"); loadSet(m_ignoredSet, "ignore"); for(int i = rowCount() - 1; i >= 0; --i) checkFriendIgnore(index(i)); }
int HausdorffKernel::execute() { PointTable srcTable; PointViewPtr srcView = loadSet(m_sourceFile, srcTable); PointTable candTable; PointViewPtr candView = loadSet(m_candidateFile, candTable); double hausdorff = Utils::computeHausdorff(srcView, candView); MetadataNode root; root.add("filenames", m_sourceFile); root.add("filenames", m_candidateFile); root.add("hausdorff", hausdorff); root.add("pdal_version", pdal::GetFullVersionString()); Utils::toJSON(root, std::cout); return 0; }
/** * @brief Called when set table selection changes * @see SetsWidget::loadSets */ void SetsWidget::onSetSelected() { qDebug() << "Entered"; int row = ui->sets->currentRow(); qDebug() << "row=" << row << "rowCount=" << ui->sets->rowCount(); if (row < 0 || row >= ui->sets->rowCount()) { clear(); return; } QString setName = ui->sets->item(ui->sets->currentRow(), 0)->text(); loadSet(setName); }
static MCSetT * MCGetSet(MCCatT *cat, int setId) { MCSetT *set; int32_t lo, hi, cur, dir; if (cat == NULL || setId <= 0) return (NULL); LOOKUP(cat, set, setId, cat->numSets, sets); if (set->invalid && loadSet(cat, set) <= 0) return (NULL); return (set); }
//-------------------------------------------------------------- void testApp::setup(){ // clip = new paperclip(); ofSetFrameRate(30); // ofShader shader; // shader.load("shaders/transparento"); rooom.loadFont("rooom.ttf", 50, true, true); rooom.setLineHeight(18.0f); rooom.setLetterSpacing(1.037); ///CARGAR directorio imagenes ofDirectory dir; int nFiles = dir.listDir("images"); copias.assign(20, paperclip()); if(nFiles) { //CADA DIRECTORIO for(int i=0; i<dir.numFiles(); i++) { // add the image to the vector string filePath = dir.getPath(i); ofFile file = dir.getFile(i); if(file.isDirectory()){ ofDirectory dirTemp; int nFiles = dirTemp.listDir(filePath); //dirTemp.listDir(filePath); //LOCALIZA EN ARRAY DE IMAGENES LAS POSICIONES DE CADA FOLDER animationRefs.push_back(ofVec3f(imagePaths.size(), imagePaths.size()+nFiles-1, nFiles)); animationsLoaded.push_back(bool()); animationsLoaded.back()=false; for(int d=0; d<dirTemp.numFiles(); d++) { string filePatht = dirTemp.getPath(d); //CARGA LAS IMAGENES images.push_back(ofImage()); images.back().loadImage(filePatht); //METE EN ARRAY LOS PATHS imagePaths.push_back(filePatht); // infoarray+=ofToString(filePatht)+" "+ofToString(i)+" "+ofToString(d)+" "+"\n"; } }else{ //images.push_back(ofImage()); //images.back().loadImage(filePath); } } } //setupCopia(1,1,"shaders/transparento"); // setupCopia(0,0, "shaders/slito"); //addCopia(15); loadShaders(); loadSet(0); copias[0].setup(images[0], "shaders/transparento"); copias[1].setup(images[1], "shaders/blinko"); //SOUND srand((unsigned int)time((time_t *)NULL)); // 0 output channels, // 2 input channels // 44100 samples per second // BUFFER_SIZE samples per buffer // 4 num buffers (latency) //soundStream.setup(0,2,this, 44100,BUFFER_SIZE, 4); soundStream.setup(this, 0, 2, 44100, BUFFER_SIZE, 4); left = new float[BUFFER_SIZE]; right = new float[BUFFER_SIZE]; for (int i = 0; i < NUM_WINDOWS; i++) { for (int j = 0; j < BUFFER_SIZE/2; j++) { freq[i][j] = 0; } } soundStream.start(); ofSetColor(0x666666); }
//-------------------------------------------------------------- void testApp::keyPressed(int key){ if( key=='d' ){ copias[select].setShader("shaders/"+shaderFiles[nShader]); cout << select; }; if( key=='s' ){ copias[select].setShader("shaders/transpativo"); cout << select; }; if( key=='l' ){ loadSet(set); }; if( key=='c' ){ int temp=animationRefs[set].x+ofRandom(animationRefs[set].y-animationRefs[set].x); setupCopia(select, temp , "shaders/transparento"); //copias[select].setPos(ofGetMouseX() ,ofGetMouseX(),3,1); cout << copias.size(); }; if( key=='v' ){ copias[select].scaleX=ofRandom(5.0); }; if( key=='f' ){ set=max(set-1, 0); cout << set; nImage=0; }; if( key=='h' ){ cout << animationRefs.size() ; set=min(set+1, int(animationRefs.size()-1)); if (!animationsLoaded[set]) { loadSet(set); } //cout << min(set, ); nImage=0; //nImage++; }; if( key=='1' ){ select++; cout << select; }; if( key=='0' ){ select--; cout << select; // cout << max(copias.size(), select); // }; if( key=='b' ){ copias[select].glitch=true; // cout << max(copias.size(), select); // }; if( key=='n' ){ copias[select].glitch=false; // cout << max(copias.size(), select); // }; if( key=='z' ){ nShader=int(nShader+1)%int(shaderFiles.size()-1); // nShader++; // cout << max(copias.size(), select); // }; if( key=='x' ){ nShader=max(int(nShader-1), 0); // cout << max(copias.size(), select); // }; if( key=='p' ){ ofSaveFrame(); // cout << max(copias.size(), select); // }; if( key=='g' ){ //int temp=animationRefs[set].x+ofRandom(animationRefs[set].y-animationRefs[set].x); advanceOne(select); }; }
bool Loader::load() { QString fn = m_fileName.path(); if ( fn.endsWith( ".nii.gz" ) || fn.endsWith( ".nii" ) || fn.endsWith( ".hdr" ) || fn.endsWith( ".ima" ) || fn.endsWith( ".img" ) ) { return loadNifti(); } if ( m_fileName.path().endsWith( ".fib" ) ) { return loadVTK(); } if ( m_fileName.path().endsWith( ".tck" ) ) { return loadMRtrix(); } if ( m_fileName.path().endsWith( ".vtk" ) ) { return loadVTK(); } if ( m_fileName.path().endsWith( ".json" ) ) { return loadJSON(); } if ( m_fileName.path().endsWith( ".asc" ) ) { //TODO: Deal with offsets: Check if orig is always the same size? return loadASC( QVector3D( 128, 128, 128 ) ); } if ( m_fileName.path().endsWith( ".set" ) ) { return loadSet(); } if ( m_fileName.path().endsWith( ".glyphset" ) ) { return loadGlyphset(); } if ( m_fileName.path().endsWith( ".cons" ) || m_fileName.path().endsWith( ".cxls" ) ) { return loadCons(); } if ( m_fileName.path().endsWith( ".meg" ) ) { return loadMEG(); } if ( m_fileName.path().endsWith( ".htree" ) ) { return loadTree(); } if ( m_fileName.path().endsWith( ".rgb" ) ) { return loadRGB(); } if ( m_fileName.path().endsWith( ".1D" ) ) { return load1D(); } if ( m_fileName.path().endsWith( ".png" ) || m_fileName.path().endsWith( ".jpg" ) ) { return loadPNG(); } return false; }