mitk::Mapper::Pointer mitk::DiffusionCoreObjectFactory::CreateMapper(mitk::DataNode* node, MapperSlotId id) { mitk::Mapper::Pointer newMapper=NULL; if ( id == mitk::BaseRenderer::Standard2D ) { std::string classname("QBallImage"); if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0) { newMapper = mitk::CompositeMapper::New(); newMapper->SetDataNode(node); node->SetMapper(3, ((CompositeMapper*)newMapper.GetPointer())->GetImageMapper()); } classname = "TensorImage"; if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0) { newMapper = mitk::CompositeMapper::New(); newMapper->SetDataNode(node); node->SetMapper(3, ((CompositeMapper*)newMapper.GetPointer())->GetImageMapper()); } classname = "DiffusionImage"; if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0) { newMapper = mitk::DiffusionImageMapper<short>::New(); newMapper->SetDataNode(node); } } else if ( id == mitk::BaseRenderer::Standard3D ) { std::string classname("QBallImage"); if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0) { newMapper = mitk::GPUVolumeMapper3D::New(); newMapper->SetDataNode(node); } classname = "TensorImage"; if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0) { newMapper = mitk::GPUVolumeMapper3D::New(); newMapper->SetDataNode(node); } classname = "DiffusionImage"; if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0) { newMapper = mitk::GPUVolumeMapper3D::New(); newMapper->SetDataNode(node); } } return newMapper; }
void mitk::SegmentationObjectFactory::SetDefaultProperties(mitk::DataNode* node) { if(node==NULL) return; mitk::DataNode::Pointer nodePointer = node; std::string classname("ContourModel"); if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0) { mitk::ContourModelGLMapper2D::SetDefaultProperties(node); mitk::ContourModelMapper3D::SetDefaultProperties(node); } // mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(node->GetData()); // if(image.IsNotNull() && image->IsInitialized()) // { // mitk::GPUVolumeMapper3D::SetDefaultProperties(node); // } // // if (dynamic_cast<mitk::UnstructuredGrid*>(node->GetData())) // { // mitk::UnstructuredGridVtkMapper3D::SetDefaultProperties(node); // } }
size_t TestFixture::runTests(const char cmd[]) { std::string classname(cmd ? cmd : ""); std::string testname(""); if (classname.find("::") != std::string::npos) { testname = classname.substr(classname.find("::") + 2); classname.erase(classname.find("::")); } countTests = 0; errmsg.str(""); const std::list<TestFixture *> &tests = TestRegistry::theInstance().tests(); for (std::list<TestFixture *>::const_iterator it = tests.begin(); it != tests.end(); ++it) { if (classname.empty() || (*it)->classname == classname) { (*it)->run(testname); } } std::cout << "\n\nTesting Complete\nNumber of tests: " << countTests << "\n"; std::cerr << errmsg.str(); return fails_counter; }
int Ufmt(Fmt *f) { int i; Dev *d; Usbdev *ud; char buf[1024]; char *s, *e; s = buf; e = buf+sizeof(buf); d = va_arg(f->args, Dev*); if(d == nil) return fmtprint(f, "<nildev>\n"); s = seprint(s, e, "%s", d->dir); ud = d->usb; if(ud == nil) return fmtprint(f, "%s %ld refs\n", buf, d->Ref.ref); s = seprint(s, e, " csp %s.%uld.%uld", classname(Class(ud->csp)), Subclass(ud->csp), Proto(ud->csp)); s = seprint(s, e, " vid %#ux did %#ux", ud->vid, ud->did); s = seprint(s, e, " refs %ld\n", d->Ref.ref); s = seprint(s, e, "\t%s %s %s\n", ud->vendor, ud->product, ud->serial); for(i = 0; i < Nconf; i++){ if(ud->conf[i] == nil) break; else s = seprintconf(s, e, ud, i); } return fmtprint(f, "%s", buf); }
void ParameterWidget::setSavedFilters(int defaultId) { QString query; XSqlQuery qry; if(this->parent()) { const QMetaObject *metaobject = this->parent()->metaObject(); QString classname(metaobject->className()); query = " SELECT 0 AS filter_id, :none AS filter_name, 1 AS seq " " UNION " " SELECT filter_id, filter_name, 2 AS seq " " FROM filter " " WHERE filter_username=current_user " " AND filter_screen=:screen " " ORDER BY seq, filter_name "; qry.prepare(query); qry.bindValue(":screen", classname); qry.bindValue(":none", tr("None")); qry.exec(); if (defaultId) _filterList->populate(qry, defaultId); else _filterList->populate(qry, 0); } }
std::size_t TestFixture::runTests(const options& args) { std::string classname(args.which_test()); std::string testname(""); if (classname.find("::") != std::string::npos) { testname = classname.substr(classname.find("::") + 2); classname.erase(classname.find("::")); } countTests = 0; errmsg.str(""); const std::list<TestFixture *> &tests = TestRegistry::theInstance().tests(); for (std::list<TestFixture *>::const_iterator it = tests.begin(); it != tests.end(); ++it) { if (classname.empty() || (*it)->classname == classname) { (*it)->processOptions(args); (*it)->run(testname); } } std::cout << "\n\nTesting Complete\nNumber of tests: " << countTests << std::endl; std::cout << "Number of todos: " << todos_counter; if (succeeded_todos_counter > 0) std::cout << " (" << succeeded_todos_counter << " succeeded)"; std::cout << std::endl; // calling flush here, to do all output before the error messages (in case the output is buffered) std::cout.flush(); std::cerr << "Tests failed: " << fails_counter << std::endl << std::endl; std::cerr << errmsg.str(); std::cerr.flush(); return fails_counter; }
VALUE rb_class_path(VALUE klass) { VALUE path = classname(klass); st_data_t n = (st_data_t)path; if (!NIL_P(path)) return path; if (RCLASS_IV_TBL(klass) && st_lookup(RCLASS_IV_TBL(klass), (st_data_t)tmp_classpath, &n)) { return (VALUE)n; } else { const char *s = "Class"; if (TYPE(klass) == T_MODULE) { if (rb_obj_class(klass) == rb_cModule) { s = "Module"; } else { s = rb_class2name(RBASIC(klass)->klass); } } path = rb_sprintf("#<%s:%p>", s, (void*)klass); OBJ_FREEZE(path); rb_ivar_set(klass, tmp_classpath, path); return path; } }
VALUE rb_class_path(VALUE klass) { VALUE path = classname(klass); if (!NIL_P(path)) { return path; } if ((path = rb_attr_get(klass, id_tmp_classpath)) != Qnil) { return path; } else { const char *s = "Class"; if (TYPE(klass) == T_MODULE) { if (rb_obj_class(klass) == rb_cModule) { s = "Module"; } else { s = rb_class2name(RBASIC(klass)->klass); } } path = rb_sprintf("#<%s:%p>", s, (void*)klass); OBJ_FREEZE(path); rb_ivar_set(klass, id_tmp_classpath, path); return path; } }
mitk::Mapper::Pointer mitk::SegmentationObjectFactory::CreateMapper(mitk::DataNode* node, MapperSlotId id) { mitk::Mapper::Pointer newMapper=NULL; mitk::BaseData *data = node->GetData(); if ( id == mitk::BaseRenderer::Standard2D ) { if((dynamic_cast<Contour*>(data)!=NULL)) { newMapper = mitk::ContourMapper2D::New(); newMapper->SetDataNode(node); } else if((dynamic_cast<ContourSet*>(data)!=NULL)) { newMapper = mitk::ContourSetMapper2D::New(); newMapper->SetDataNode(node); } std::string classname("ContourModel"); if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0) { newMapper = mitk::ContourModelGLMapper2D::New(); newMapper->SetDataNode(node); } } else if ( id == mitk::BaseRenderer::Standard3D ) { if((dynamic_cast<Contour*>(data)!=NULL)) { newMapper = mitk::ContourVtkMapper3D::New(); newMapper->SetDataNode(node); } else if((dynamic_cast<ContourSet*>(data)!=NULL)) { newMapper = mitk::ContourSetVtkMapper3D::New(); newMapper->SetDataNode(node); } std::string classname("ContourModel"); if(node->GetData() && classname.compare(node->GetData()->GetNameOfClass())==0) { newMapper = mitk::ContourModelMapper3D::New(); newMapper->SetDataNode(node); } } return newMapper; }
void MethodCallBase::unsupported() { rb_raise(rb_eArgError, "Cannot handle '%s' as argument of %s::%s", type().name(), classname(), _smoke->methodNames[method().name]); }
void MethodReturnValueBase::unsupported() { rb_raise(rb_eArgError, "Cannot handle '%s' as return-type of %s::%s", type().name(), classname(), _smoke->methodNames[method().name]); }
VALUE rb_mod_name(VALUE mod) { VALUE path = classname(mod); if (!NIL_P(path)) return rb_str_dup(path); return path; }
void ParameterWidget::applyDefaultFilterSet() { XSqlQuery qry; QString filter_name; int filter_id; QString pname; //hides parameterwidget when it's embedded within another widget with a parent if (this->parent() && this->parent()->parent()) { clearFilters(); this->hide(); return; } if(window()) pname = window()->objectName() + "/"; _settingsName2 = pname + this->objectName(); if(_x_preferences) { _settingsName2 += "/filter_default"; filter_id = _x_preferences->value(_settingsName2).toInt(); } QString query = "SELECT filter_name " "FROM filter " "WHERE filter_id=:id "; if (this->parent()) { QString classname(parent()->objectName()); if (classname.isEmpty()) classname = parent()->metaObject()->className(); qry.prepare(query); qry.bindValue(":id", filter_id); qry.exec(); if (qry.first()) { filter_name = qry.value("filter_name").toString(); setSavedFiltersIndex(filter_name); applySaved(0, filter_id); } else { addParam(); applySaved(0, 0); } } }
void ElectronMuonCandidateMaker::initialize(){ CandidateMaker::initialize(); if ( !config.exists( nodePath + ".MuonCandidateCuts" ) ){ ERROR( classname(), "Cannot find **required** MuonCandidateCuts" ); chain = nullptr; return; } muonCuts.init( config, nodePath + ".MuonCandidateCuts" ); INFO( classname(), "" ); INFO( classname(), "############### Muon Cuts ###################" ); muonCuts.report(); INFO( classname(), "" ); electronCuts.init( config, nodePath + ".ElectronCandidateCuts" ); electronCuts.setDefault( "pt", 0.1, 10000 ); electronCuts.setDefault( "nHitsDedx", 10, 10000 ); electronCuts.setDefault( "nHitsRatio", 0.52, 100 ); electronCuts.setDefault( "eta", -0.8, 0.8 ); electronCuts.setDefault( "nSigmaPion", -1.5, 1.5 ); electronCuts.setDefault( "matchFlagEmc", 1, 100 ); INFO( classname(), "" ); INFO( classname(), "############### Electron Cuts ###################" ); electronCuts.report(); INFO( classname(), "" ); gErrorIgnoreLevel = kBreak; }
Object Registry::NewFromClassName(const char *classname_str) { Label classname(classname_str); const ClassBase *klass = GetClass(classname); if (klass == 0) KAI_THROW_1(UnknownClass<>, String(classname_str)); return NewFromClass(klass); }
void FeedDownMaker::initialize(){ TreeAnalyzer::initialize(); DEBUG( classname(), "" ); if ( ds && ds->getTreeName() == "StMiniMcTree" ){ INFO( classname(), "Using DataStore" ) } else { ERROR( classname(), "No Data Source. Specify one at <DataSourcce ... > </DataSource>" ) } // map of GEANT PID -> histogram name plcName[ 8 ] = "Pi_p"; plcName[ 9 ] = "Pi_n"; plcName[ 11 ] = "K_p"; plcName[ 12 ] = "K_n"; plcName[ 14 ] = "P_p"; plcName[ 15 ] = "P_n"; // Tracks cuts cut_nHitsFit = unique_ptr<XmlRange>(new XmlRange( &config , "TrackCuts.nHitsFit" , 0 , std::numeric_limits<int>::max() ) ); cut_dca = unique_ptr<XmlRange>(new XmlRange( &config , "TrackCuts.dca" , 0 , std::numeric_limits<int>::max() ) ); cut_nHitsFitOverPossible = unique_ptr<XmlRange>(new XmlRange( &config , "TrackCuts.nHitsFitOverPossible" , 0 , std::numeric_limits<int>::max() ) ); cut_nHitsDedx = unique_ptr<XmlRange>(new XmlRange( &config , "TrackCuts.nHitsDedx" , 0 , std::numeric_limits<int>::max() ) ); cut_pt = unique_ptr<XmlRange>(new XmlRange( &config , "TrackCuts.pt" , 0 , std::numeric_limits<int>::max() ) ); cut_ptGlobalOverPrimary = unique_ptr<XmlRange>(new XmlRange( &config , "TrackCuts.ptGlobalOverPrimary" , 0.7 , 1.42 ) ); cut_rapidity = unique_ptr<XmlRange>(new XmlRange( &config , "TrackCuts.rapidity" , -0.25 , 0.25 ) ); formulas = { "[0]*exp( -[1] * x ) + [2] * exp( -[3] * x )", "[0]*exp( -[1] * x ) + [2] * exp( -[3] * x )", "[0]*exp( -[1] * x ) + [2] * exp( -[3] * x )", "[0]*exp( -[1] * x ) + [2] * exp( -[3] * x )", "[0]*exp( -[1] * x ) + [2] * exp( -[3] * x * x )", "(1-[0]*exp( -[1] * x ) ) * [2] * exp( -[3] * x )" }; rmb = unique_ptr<HistoBins>( new HistoBins( config, nodePath + ".RefMultBins" ) ); // Setup the centrality bins INFO( classname(), "Loading Centrality Map" ); centralityBinMap = config.getIntMap( nodePath + ".CentralityMap" ); centralityBins = config.getIntVector( nodePath + ".CentralityBins" ); INFO( classname(), "c[ 0 ] = " << centralityBinMap[ 0 ] ); }
VALUE rb_mod_name(VALUE mod, SEL sel) { VALUE path = classname(mod); if (!NIL_P(path)) { return rb_str_dup(path); } return path; }
bool logcontent_filter::save(component_creator* /*cc*/, serializer* s) const { serializer* mys = s->add_child(classname()); mys->set_property(L"matcher", m_matcher.c_str()); mys->set_property(L"ignorecase", formatstr(L"%d", m_ignore_case? 1: 0)); mys->set_property(L"useregex", formatstr(L"%d", m_use_regex? 1: 0)); return true; }
bool logtid_filter::save(component_creator *, serializer *s) const { #ifdef SAVE_UNSTABLE_FILTER serializer* mys = s->add_child(classname()); mys->set_property(L"tid", (const wchar_t*)tp::cz(L"%u", m_tid)); return true; #else return false; #endif }
template<> SEXP wrap<RcppDatetime>(const RcppDatetime& date) { Rcpp::NumericVector value(1); Rcpp::CharacterVector classname(2); value[0] = date.getFractionalTimestamp(); Rcpp::RObject robj((SEXP)value); classname[0] = Rcpp::datetimeClass[0]; classname[1] = Rcpp::datetimeClass[1]; robj.attr("class") = classname; return value; }
void BinaryInFileBuf::load(){ if(!this->_closed){ size_t sz = fread(_buf,1,BUF_SZ,this->_pIn); if(sz < BUF_SZ || feof(_pIn)) this->_done = true; if(ferror(_pIn)) throw std::runtime_error(classname() + "invalid file state when reading file"); this->_end = sz; this->_cur = 0; } }
const Entity::RotationInfo Entity::rotationInfo() const { RotationType type = RTNone; PropertyKey property; // determine the type of rotation to apply to this entity const String* classn = classname(); if (classn != NULL) { if (Utility::startsWith(*classn, "light")) { if (propertyForKey(MangleKey) != NULL) { // spotlight without a target, update mangle type = RTEulerAngles; property = MangleKey; } else if (propertyForKey(TargetKey) == NULL) { // not a spotlight, but might have a rotatable model, so change angle or angles if (propertyForKey(AnglesKey) != NULL) { type = RTEulerAngles; property = AnglesKey; } else { type = RTZAngle; property = AngleKey; } } else { // spotlight with target, don't modify } } else { bool brushEntity = !m_brushes.empty() || (m_definition != NULL && m_definition->type() == EntityDefinition::BrushEntity); if (brushEntity) { if (propertyForKey(AnglesKey) != NULL) { type = RTEulerAngles; property = AnglesKey; } else if (propertyForKey(AngleKey) != NULL) { type = RTZAngleWithUpDown; property = AngleKey; } } else { // point entity // if the origin of the definition's bounding box is not in its center, don't apply the rotation const Vec3f offset = origin() - center(); if (offset.x() == 0.0f && offset.y() == 0.0f) { if (propertyForKey(AnglesKey) != NULL) { type = RTEulerAngles; property = AnglesKey; } else { type = RTZAngle; property = AngleKey; } } } } } return RotationInfo(type, property); }
void UrQMDDcaMapMaker::preEventLoop(){ DEBUG( classname(), "" ); TreeAnalyzer::preEventLoop(); string sCharge = config.getXString( nodePath + ".input:charge", "p" ); string plc = config.getXString( nodePath + ".input:plc", "Pi" ); book->cd(); // for ( int iC : centralityBins ){ // INFO( classname(), "urqmd_dca_vs_pt_" + plc + "_" + ts( iC ) + "_" + sCharge ); // book->clone( "dca_vs_pt", "urqmd_dca_vs_pt_" + plc + "_" + ts( iC ) + "_" + sCharge ); // } for ( string plc : { "Pi", "K", "P" } ){ for ( string charge : { "p", "n" } ){ INFO( classname(), "Making : " << "urqmd_dca_vs_pt_" + plc + "_" + charge ); book->clone( "dca_vs_pt", "urqmd_dca_vs_pt_" + plc + "_" + charge ); } } }
BinaryInFileBuf::BinaryInFileBuf(FILE* in) { this->init(); this->_pIn = in; if(!in){ this->nultify(); cerr<<classname()<<"invalid file handler!"<<endl; cerr.flush(); } else this->load(); }
bool logclass_filter::save(component_creator* /*cc*/, serializer* s) const { wchar_t buf[32]; serializer* mys = s->add_child(classname()); swprintf_s(buf, L"%u", m_class_low); mys->set_property(L"class_low", buf); swprintf_s(buf, L"%u", m_class_high); mys->set_property(L"class_high", buf); return true; }
static void run( Competitor& client ) { const std::string root = "./resources/"; const std::string problemClassFile = root + "classFolder.txt"; const std::vector< std::string > lines = read_text_file( problemClassFile ); if( lines.empty() ) throw std::runtime_error( "bad format for classFolder.txt" ); const std::string problemClassName = lines.front(); const std::string problemFolder( root + problemClassName ); ProblemClass problemClass( problemFolder, client.getTrainingCategory() ); long long actualTestingTime = -1, actualTrainingTime = -1; switch( client.getTrainingCategory() ) { case TrainingCategory::NONE : { actualTestingTime = testClient( client, problemClass.getTestingInstances() ); std::clog << "actualTestingTime:" << actualTestingTime << std::endl; } break; case TrainingCategory::SHORT : case TrainingCategory::LONG : { actualTrainingTime = trainClient( client, problemClass.getTrainingInstances() ); std::clog <<"actualTrainingTime:" << actualTrainingTime << std::endl; actualTestingTime = testClient( client, problemClass.getTestingInstances() ); std::clog <<"actualTestingTime:" << actualTestingTime << std::endl; } break; default : throw std::logic_error( "Bad training category in CBBOC2015.run()" ); } /////////////////////////// const std::time_t now = std::time(NULL); char buffer[ 1024 ]; std::strftime( buffer, sizeof(buffer), "%Y-%m-%d-%H-%M-%S", // "%T", std::localtime(&now)); const std::string timestamp( buffer ); const std::string className = classname( client ); OutputResults results( className, timestamp, problemClassName, problemClass, actualTrainingTime, actualTestingTime ); std::string outputPath = problemFolder + "/results/"; outputPath += "CBBOC2015results-" + className + "-" + problemClassName + "-" + timestamp + ".json"; std::ofstream out( outputPath ); out << results.toJSonString() << std::endl; /////////////////////////// std::cout << results.toJSonString() << std::endl; }
Reporter::Reporter( XmlConfig &config, string np, string prefix ){ DEBUG( classname(), "( config, np=" << np << ", prefix=" << prefix << ")" ) this->config = config; this->nodePath = config.basePath( np ); this->filename = prefix + config.getString( nodePath + ".output:url" ); int w = config.getInt( nodePath + ".output:width", 400 ); int h = config.getInt( nodePath + ".output:height", 400 ); canvas = new TCanvas( ("Reporter" + ts( instances ) ).c_str() , "canvas", w, h); canvas->Print( ( filename + "[" ).c_str() ); DEBUG( classname(), " Opening " << filename ) instances++; isOpen = true; DEBUG( classname(), " Instance #" << instances ) }
void HistoAnalyzer::initReporter( string _jobPostfix ){ INFO( classname(), "Creating Reporter" ); string pRepOut = config.join( nodePath, "Reporter", "output:url" ); string outputURL = config[ pRepOut ]; // Default reporter // dont make for parallel! if ( ".root" == _jobPostfix && config.exists( pRepOut ) ) { reporter = shared_ptr<Reporter>( new Reporter( config, config.join( nodePath, "Reporter" ), "" ) ); // TODO: is reporter's path handeling broken? INFO( classname(), "Creating report @" << outputURL ); } else { INFO( classname(), "No Reporter created, jobPostfix == " << _jobPostfix ); reporter = nullptr; } }
bool ElectronMuonCandidateMaker::keepTrack( int iTrack ){ DEBUG( classname(), fmt::format( "(iTrack={0})", iTrack ) ); isElectron = CandidateFilter::isElectron( pico, iTrack, electronCuts ); isMuon = CandidateFilter::isMuon( pico, iTrack, muonCuts ); if ( isElectron ) nElectrons ++; if ( isMuon ) nMuons ++; return ( isElectron || isMuon ); return true; }
static AST classhead() { Token *t = &tok; AST a=0; AST a1=0, a2=0; if (t->sym == tCLASS) { gettoken(); a1 = classname(); if (a1) { insert_SYM(get_text(a1), 0, tGLOBAL, 0); /* dummy */ } a = make_AST(nCLASSHEAD, a1, 0, 0, 0); } else { parse_error("expected class"); } return a; }