void ConnSettings::saveConnect() { name = ConnName->text(); settings.beginGroup("Connects"); QStringList groups = settings.childGroups(); settings.endGroup(); setResult(QDialog::Accepted); if ( name.isEmpty() ) QMessageBox::information( this, QString("Info"), QString("Connection Name is empty.")); else if ( groups.contains(name) && !newbe && name==previousName ) { saveParameters(); close(); } else if ( groups.contains(name) && newbe ) { QMessageBox::information( this, QString("Info"), QString("Same Connection Name is exist.")); } else if ( groups.contains(name) && !newbe && name!=previousName ) { QMessageBox::information( this, QString("Info"), QString("Same Connection Name is exist.")); } else if ( !groups.contains(name) && newbe ) { saveParameters(); close(); } else if ( !groups.contains(name) && !newbe ) { settings.beginGroup("Connects"); settings.remove(previousName); settings.endGroup(); //qDebug()<<previousName<<"included deleted"; saveParameters(); close(); }; }
bool KoDocumentInfo::saveOasisAboutInfo(KoXmlWriter &xmlWriter) { saveParameters(); foreach(const QString & tag, m_aboutTags) { if (!aboutInfo(tag).isEmpty() || tag == "title") { if (tag == "keyword") { foreach(const QString & tmp, aboutInfo("keyword").split(';')) { xmlWriter.startElement("meta:keyword"); xmlWriter.addTextNode(tmp); xmlWriter.endElement(); } } else if (tag == "title" || tag == "description" || tag == "subject" || tag == "date") { QByteArray elementName(QString("dc:" + tag).toLatin1()); xmlWriter.startElement(elementName); xmlWriter.addTextNode(aboutInfo(tag)); xmlWriter.endElement(); } else { QByteArray elementName(QString("meta:" + tag).toLatin1()); xmlWriter.startElement(elementName); xmlWriter.addTextNode(aboutInfo(tag)); xmlWriter.endElement(); } }
Layer::Layer(std::string name) : Parametrizable(name) { addParameter("STIME",m_STIME); addParameter("DT",m_DT); addParameter("TAU",m_TAU); addParameter("TH",m_TH); addParameter("AMP",m_AMP); addParameter("N",m_N); addParameter("BL",m_BL); try { loadParameters(); } catch(parameter_file_exception &e) { m_STIME = 1000; m_DT = 0.001; m_TAU = 0.005; m_TH = 0.0; m_AMP = 1.0; m_N = 3; m_BL = 0.0; saveParameters(); } reset(); m_data = zeros<mat>(m_N,m_STIME); }
bool KoDocumentInfo::saveOasis(KoStore* store) { saveParameters(); KoStoreDevice dev(store); KoXmlWriter* xmlWriter = KoOdfWriteStore::createOasisXmlWriter(&dev, "office:document-meta"); xmlWriter->startElement("office:meta"); xmlWriter->startElement("meta:generator"); xmlWriter->addTextNode(QString("KOffice/%1") .arg(KOFFICE_VERSION_STRING)); xmlWriter->endElement(); if (!saveOasisAboutInfo(*xmlWriter)) return false; if (!saveOasisAuthorInfo(*xmlWriter)) return false; xmlWriter->endElement(); xmlWriter->endElement(); // root element xmlWriter->endDocument(); delete xmlWriter; return true; }
//! Constructor without image FastHessian::FastHessian(std::vector<sim::alg::SurfLandmark> &ipts, const int octaves, const int intervals, const int init_sample, const float thresh) : i_width(0), i_height(0), ipts(ipts) { // Save parameter set saveParameters(octaves, intervals, init_sample, thresh); }
//! Constructor with image FastHessian::FastHessian(IplImage *img, std::vector<sim::alg::SurfLandmark> &ipts, const int octaves, const int intervals, const int init_sample, const float thresh) : i_width(0), i_height(0), ipts(ipts) { // Save parameter set saveParameters(octaves, intervals, init_sample, thresh); // Set the current image setIntImage(img); }
bool KoDocumentInfoAbout::saveOasis( KoXmlWriter &xmlWriter ) { saveParameters(); if ( !m_title.isEmpty() ) { xmlWriter.startElement( "dc:title" ); xmlWriter.addTextNode( m_title ); xmlWriter.endElement(); } if ( !m_abstract.isEmpty() ) { xmlWriter.startElement( "dc:description" ); xmlWriter.addTextNode( m_abstract ); xmlWriter.endElement(); } if ( !m_keywords.isEmpty() ) { xmlWriter.startElement( "meta:keyword" ); xmlWriter.addTextNode( m_keywords ); xmlWriter.endElement(); } if ( !m_subject.isEmpty() ) { xmlWriter.startElement( "dc:subject" ); xmlWriter.addTextNode( m_subject ); xmlWriter.endElement(); } if ( !m_initialCreator.isEmpty() ) { xmlWriter.startElement( "meta:initial-creator" ); xmlWriter.addTextNode( m_initialCreator ); xmlWriter.endElement(); } xmlWriter.startElement( "meta:editing-cycles" ); xmlWriter.addTextNode( QString::number( m_editingCycles ) ); xmlWriter.endElement(); if ( m_creationDate.isValid() ) { xmlWriter.startElement( "meta:creation-date" ); xmlWriter.addTextNode( m_creationDate.toString( Qt::ISODate ) ); xmlWriter.endElement(); } if ( m_modificationDate.isValid() ) { xmlWriter.startElement( "dc:date" ); xmlWriter.addTextNode( m_modificationDate.toString( Qt::ISODate ) ); xmlWriter.endElement(); } return true; }
MultiAgentEnvironment::~MultiAgentEnvironment() { saveParameters(); if (m_Layout) { clearParameters(); delete m_LayoutStatistics; delete m_GroupBoxGeneralParameters; m_PcMAE.free(); delete m_GroupBoxSpecificParameters; delete m_GroupBoxDisturbanceParameters; delete m_Layout; } }
QDomDocument KoDocumentInfo::save() { saveParameters(); QDomDocument doc = KoDocument::createDomDocument("document-info" /*DTD name*/, "document-info" /*tag name*/, "1.1"); QDomElement s = saveAboutInfo(doc); if (!s.isNull()) doc.documentElement().appendChild(s); s = saveAuthorInfo(doc); if (!s.isNull()) doc.documentElement().appendChild(s); if (doc.documentElement().isNull()) return QDomDocument(); return doc; }
int main(int argc, char *argv[]){ //std::string scenarioname = "yosemite"; std::string scenarioname = "whale"; std::unordered_map<std::string, parameter> parameters; makeParameters(parameters); // load images cv::Mat image1 = cv::imread("images/RubberWhale/frame10.png", CV_LOAD_IMAGE_GRAYSCALE); cv::Mat image2 = cv::imread("images/RubberWhale/frame11.png", CV_LOAD_IMAGE_GRAYSCALE); cv::Mat i1; cv::Mat i2; image1.convertTo(i1, CV_64F); image2.convertTo(i2, CV_64F); // load truth GroundTruth truth("images/RubberWhale/flow10.flo"); // create scenario file cv::FileStorage s(scenarioname+".xml", cv::FileStorage::WRITE); s << "scenarioname" << scenarioname; s << "image1" << i1; s << "image2" << i2; s << "groundtruth" << truth.truthfield; s << "truthmask" << truth.mask; s << "interactive" << true; saveParameters(s, parameters); s.release(); }
// KOffice-1.3 format QDomElement KoDocumentInfoAbout::save( QDomDocument& doc ) { saveParameters(); QDomElement e = doc.createElement( "about" ); QDomElement t = doc.createElement( "abstract" ); e.appendChild( t ); t.appendChild( doc.createCDATASection( m_abstract ) ); t = doc.createElement( "title" ); e.appendChild( t ); t.appendChild( doc.createTextNode( m_title ) ); t = doc.createElement( "keyword" ); e.appendChild( t ); t.appendChild( doc.createTextNode( m_keywords ) ); t = doc.createElement( "subject" ); e.appendChild( t ); t.appendChild( doc.createTextNode( m_subject ) ); t = doc.createElement( "initial-creator" ); e.appendChild( t ); t.appendChild( doc.createTextNode( m_initialCreator ) ); t = doc.createElement( "editing-cycles" ); e.appendChild( t ); t.appendChild( doc.createTextNode( QString::number( m_editingCycles ) ) ); t = doc.createElement( "creation-date" ); e.appendChild( t ); t.appendChild( doc.createTextNode( m_creationDate.toString( Qt::ISODate ) ) ); t = doc.createElement( "date" ); e.appendChild( t ); t.appendChild( doc.createTextNode( m_modificationDate.toString( Qt::ISODate ) ) ); return e; }
void Reservoir::init() { addParameter("DT",m_DT); addParameter("TAU",m_TAU); addParameter("STIME",m_STIME); addParameter("N",m_N); addParameter("ALPHA",m_ALPHA); addParameter("BETA",m_BETA); addParameter("GAMMA",m_GAMMA); addParameter("TH",m_TH); addParameter("AMP",m_AMP); addParameter("TRUNK",m_sTRUNK); addParameter("NOISE",m_sNOISE); addParameter("NOISE_STD",m_NOISE_STD); addParameter("G",m_G); addParameter("EPSILON",m_EPSILON); addParameter("SPARSENESS",m_SPARSENESS); addParameter("WEIGHT_MEAN",m_WEIGHT_MEAN); addParameter("LOAD_WEIGHTS",m_LOAD); try { loadParameters(); } catch(parameter_file_exception &e) { m_DT = 0.001; m_TAU = 0.004; m_STIME = 400; m_N = 150; m_ALPHA = 0.5; m_BETA = 0.5; m_GAMMA = 0.0; m_TH = 0.0; m_AMP = 1.0; m_sNOISE = "FALSE"; m_NOISE_STD = 0.1; m_G = 1.0; m_EPSILON = 0.0001; m_SPARSENESS = 1.0; m_WEIGHT_MEAN = 0.0; m_sTRUNK = "FALSE"; m_LOAD = "FALSE"; saveParameters(); } m_TRUNK = (m_sTRUNK=="TRUE"); m_NOISE = (m_sNOISE=="TRUE"); m_u = zeros<vec>(m_N); m_v = m_u; m_output = m_u; // use md5 hash to get the name of the weights file stringstream ss; ss << m_filename << m_SEED << m_DT << m_TAU << m_STIME << m_N << m_ALPHA<< m_BETA << m_GAMMA << m_TH<< m_AMP<< m_sNOISE << m_NOISE_STD<< m_G << m_EPSILON<< m_SPARSENESS << m_WEIGHT_MEAN; string fweights = m_filename + "_" + md5(ss.str()); // load/save weights from/to file if(m_LOAD=="TRUE") { if(ifstream(fweights.c_str()).good() ) { m_w.load(fweights); } else { normalize_to_echo(); m_w.save(fweights); m_w.load(fweights); } } // initialize weights else { normalize_to_echo(); } // initialize data storage array m_data = zeros<mat>(m_N,m_STIME); }
void ParametersPage::on_editJuliaY_valueChanged() { saveParameters(); }
void startStopCallback(const std_msgs::Int16 startstopSignal) { // Start processing if(startstopSignal.data == 1) { detector.shouldProcess = true; if(firsttime) { firsttime = false; bool canCreateDir = false; if(!detector.usePreviousMemory) { canCreateDir = createDirectories(""); }else { canCreateDir = createDirectories(QString::fromStdString(detector.previousMemoryPath)); } if(canCreateDir) { qDebug()<<"Directories have been created successfully!!"; std_msgs::String sstr; sstr.data = mainDirectoryPath.toStdString(); std::cout<<"Ssstr data: "<<sstr.data<<std::endl; saveParameters(mainDirectoryPath); filePathPublisher.publish(sstr); } else { qDebug()<<"Error!! Necessary directories could not be created!! Detector will not work!!"; detector.shouldProcess = false; // return -1; } } } // Stop the node else if(startstopSignal.data == -1) { sendLastPlaceandShutdown = true; // ros::shutdown(); } // Pause the node else if(startstopSignal.data == 0) { detector.shouldProcess = false; } }