void NEURONSEGlugin::domenu(const QString &menu_name, V3DPluginCallback &callback, QWidget *parent) { if (menu_name == tr("Swc segment")) { swc_to_segments(callback, parent,1); } else if (menu_name == tr("Help")) { v3d_msg("(version 0.11)Neuronseg Plugin 1.0 developed by Jinzhu Yang. (Peng Lab, Janelia Research Farm Campus, HHMI), save swc files according to different segments of swc file"); return; } }
//ConsensusBuilder::ConsensusBuilder(DIR *directory){ ConsensusBuilder::ConsensusBuilder(string &directory){ ready_to_run = false; logger->set_write_level(true); Composite::set_logger(logger); struct dirent *ep; logger->debug("opening directory"); DIR * dir = opendir(directory.c_str()); if (dir){ logger->debug("directory exists, going through"); unsigned char isFile =0x8; while ((ep = readdir(dir)) != NULL){ logger->debug("File char 0 %c",ep->d_name[0]); if (ep->d_type == DT_REG && ep->d_name[0] != '.'){ logger->debug("Processing file"); string filename = string(ep->d_name); // Check file extension pair<string,string> name_ext = split_final(filename); string name = name_ext.first, extension = name_ext.second; if (name.length() > 0 && (extension.compare("swc") == 0 || extension.compare("SWC") == 0)){ printf("%s\n",ep->d_name); logger->debug2("extension %s",extension.c_str()); string filepath = directory; // filepath.append("/"); filepath.append(filename); //logger->debug2("Adding reconstruction from file %s to list", filepath.c_str()); // Read neuron points vector<MyMarker *> neuronPts = readSWC_file(directory+string("/")+filename); if (neuronPts.size() > 0){ logger->debug2("%d neuron points",neuronPts.size()); NeuronSegment * neuron; vector<NeuronSegment*> segments; // Convert points into segments swc_to_segments(neuronPts, segments); neuron = segments[segments.size()-1]; // #CHECK: Get root, which should be last segments // Create reconstruction Reconstruction * reconstruction = new Reconstruction(name, neuron); cb_reconstructions.insert(std::pair<string, Reconstruction *>(name, reconstruction)); } } } logger->debug("End of loop"); } logger->debug("Done loop"); (void) closedir (dir); }else{ logger->error("Null directory provided"); } if (cb_reconstructions.size() > 1){ ready_to_run = true; }else{ logger->error("Not enough reconstructions"); // #TODO: warning message saying that there are only n swc files in the directory, not enough to run the ConsensusBuilder } };