// private method called by constructirs void RetinaImpl::_init(const cv::Size inputSz, const bool colorMode, int colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght) { // basic error check if (inputSz.height*inputSz.width <= 0) throw cv::Exception(-1, "Bad retina size setup : size height and with must be superior to zero", "RetinaImpl::setup", "Retina.cpp", 0); unsigned int nbPixels=inputSz.height*inputSz.width; // resize buffers if size does not match _inputBuffer.resize(nbPixels*3); // buffer supports gray images but also 3 channels color buffers... (larger is better...) // allocate the retina model if (_retinaFilter) delete _retinaFilter; _retinaFilter = new RetinaFilter(inputSz.height, inputSz.width, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght); _retinaParameters.OPLandIplParvo.colorMode = colorMode; // prepare the default parameter XML file with default setup setup(_retinaParameters); // init retina _retinaFilter->clearAllBuffers(); // report current configuration printf("%s\n", printSetup().c_str()); }
void RetinaImpl::setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure) { try { // read parameters file if it exists or apply default setup if asked for if (!fs.isOpened()) { printf("Retina::setup: provided parameters file could not be open... skeeping configuration\n"); return; // implicit else case : retinaParameterFile could be open (it exists at least) } // OPL and Parvo init first... update at the same time the parameters structure and the retina core cv::FileNode rootFn = fs.root(), currFn=rootFn["OPLandIPLparvo"]; currFn["colorMode"]>>_retinaParameters.OPLandIplParvo.colorMode; currFn["normaliseOutput"]>>_retinaParameters.OPLandIplParvo.normaliseOutput; currFn["photoreceptorsLocalAdaptationSensitivity"]>>_retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity; currFn["photoreceptorsTemporalConstant"]>>_retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant; currFn["photoreceptorsSpatialConstant"]>>_retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant; currFn["horizontalCellsGain"]>>_retinaParameters.OPLandIplParvo.horizontalCellsGain; currFn["hcellsTemporalConstant"]>>_retinaParameters.OPLandIplParvo.hcellsTemporalConstant; currFn["hcellsSpatialConstant"]>>_retinaParameters.OPLandIplParvo.hcellsSpatialConstant; currFn["ganglionCellsSensitivity"]>>_retinaParameters.OPLandIplParvo.ganglionCellsSensitivity; setupOPLandIPLParvoChannel(_retinaParameters.OPLandIplParvo.colorMode, _retinaParameters.OPLandIplParvo.normaliseOutput, _retinaParameters.OPLandIplParvo.photoreceptorsLocalAdaptationSensitivity, _retinaParameters.OPLandIplParvo.photoreceptorsTemporalConstant, _retinaParameters.OPLandIplParvo.photoreceptorsSpatialConstant, _retinaParameters.OPLandIplParvo.horizontalCellsGain, _retinaParameters.OPLandIplParvo.hcellsTemporalConstant, _retinaParameters.OPLandIplParvo.hcellsSpatialConstant, _retinaParameters.OPLandIplParvo.ganglionCellsSensitivity); // init retina IPL magno setup... update at the same time the parameters structure and the retina core currFn=rootFn["IPLmagno"]; currFn["normaliseOutput"]>>_retinaParameters.IplMagno.normaliseOutput; currFn["parasolCells_beta"]>>_retinaParameters.IplMagno.parasolCells_beta; currFn["parasolCells_tau"]>>_retinaParameters.IplMagno.parasolCells_tau; currFn["parasolCells_k"]>>_retinaParameters.IplMagno.parasolCells_k; currFn["amacrinCellsTemporalCutFrequency"]>>_retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency; currFn["V0CompressionParameter"]>>_retinaParameters.IplMagno.V0CompressionParameter; currFn["localAdaptintegration_tau"]>>_retinaParameters.IplMagno.localAdaptintegration_tau; currFn["localAdaptintegration_k"]>>_retinaParameters.IplMagno.localAdaptintegration_k; setupIPLMagnoChannel(_retinaParameters.IplMagno.normaliseOutput, _retinaParameters.IplMagno.parasolCells_beta, _retinaParameters.IplMagno.parasolCells_tau, _retinaParameters.IplMagno.parasolCells_k, _retinaParameters.IplMagno.amacrinCellsTemporalCutFrequency,_retinaParameters.IplMagno.V0CompressionParameter, _retinaParameters.IplMagno.localAdaptintegration_tau, _retinaParameters.IplMagno.localAdaptintegration_k); } catch(Exception &e) { printf("RetinaImpl::setup: resetting retina with default parameters\n"); if (applyDefaultSetupOnFailure) { setupOPLandIPLParvoChannel(); setupIPLMagnoChannel(); } printf("Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>%s\n", e.what()); printf("=> keeping current parameters\n"); } // report current configuration printf("%s\n", printSetup().c_str()); }
QString MultiModelPrinter::print(QTextDocument * document) { if (document) document->clear(); QString str = "<table border='1' cellspacing='0' cellpadding='3' width='100%' style='font-family: monospace;'>"; str += printSetup(); if (firmware->getCapability(FlightModes)) str += printFlightModes(); str += printInputs(); str += printMixers(); str += printLimits(); str += printCurves(document); if (firmware->getCapability(Gvars) && !firmware->getCapability(GvarsFlightModes)) str += printGvars(); str += printLogicalSwitches(); str += printCustomFunctions(); str += printTelemetry(); str += "</table>"; return str; }
// private method called by constructirs void Retina::_init(const std::string parametersSaveFile, const cv::Size inputSize, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod, const bool useRetinaLogSampling, const double reductionFactor, const double samplingStrenght) { _parametersSaveFileName = parametersSaveFile; // basic error check if (inputSize.height*inputSize.width <= 0) throw cv::Exception(-1, "Bad retina size setup : size height and with must be superior to zero", "Retina::setup", "Retina.h", 0); unsigned int nbPixels=inputSize.height*inputSize.width; // resize buffers if size does not match _inputBuffer.resize(nbPixels*3); // buffer supports gray images but also 3 channels color buffers... (larger is better...) // allocate the retina model delete _retinaFilter; _retinaFilter = new RetinaFilter(inputSize.height, inputSize.width, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght); // prepare the parameter XML tree _parametersSaveFile.open(parametersSaveFile, cv::FileStorage::WRITE ); _parametersSaveFile<<"InputSize"<<"{"; _parametersSaveFile<<"height"<<inputSize.height; _parametersSaveFile<<"width"<<inputSize.width; _parametersSaveFile<<"}"; // clear all retina buffers // apply default setup setupOPLandIPLParvoChannel(); setupIPLMagnoChannel(); // write current parameters to params file _parametersSaveFile.release(); // init retina _retinaFilter->clearAllBuffers(); // report current configuration std::cout<<printSetup()<<std::endl; }
printDialog::printDialog(QWidget *parent, EEGeneral *gg, SKYModelData *gm) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), ui(new Ui::printDialog) { ui->setupUi(this); g_model = gm; g_eeGeneral = gg; te = ui->textEdit; setWindowTitle(tr("Setup for: ") + getModelName()); ui->textEdit->clear(); printTitle(); printSetup(); printExpo(); printMixes(); printLimits(); printCurves(); printSwitches(); printSafetySwitches(); te->scrollToAnchor("1"); }
bool QPrinter::setup(QWidget *) { if (!psession && PMCreateSession(&psession) != noErr) return FALSE; return (printSetup() && pageSetup()); }
/******************************************************************************* * Function name: INT server_setup(VOID) * Returns: 0 on success * -1 if unable to find create socket * -2 if bind error * -3 if listen error * Description: Assumes client if one argument is incuded on startup, else * server. Initiates the server/client setup respectively. *******************************************************************************/ int server_setup() { /* Declearations */ struct sockaddr_in serv_addr, client_addr; printSetup(); /* Print server data */ /* Create socket */ int request_sd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if(request_sd < 0) { /* Unable to create socket */ perror("Unable to create socket"); return -1; } /* Initiate address structure */ int yes = 1; /* avoid "address already in use" error */ if(setsockopt(request_sd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1){ perror("Error setting socket option"); close(request_sd); return -2; } bzero(&serv_addr, sizeof(struct sockaddr_in)); serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); serv_addr.sin_port = htons(PORT_NR); /* bind address to socket */ int status = bind(request_sd, (struct sockaddr *) &serv_addr, sizeof(struct sockaddr_in)); if(status < 0) { /* Unable to bind socket */ perror("Unable to bind socket"); close(request_sd); return -2; } /* Set passive mode - listen */ status = listen(request_sd, SOMAXCONN); if(status) { /* Unable to start listen */ perror("Unable to start listen"); close(request_sd); return -3; } printf("waiting for connection\n"); int clientaddrlen = sizeof(struct sockaddr_in); int client_sd = accept(request_sd, (struct sockaddr *) &client_addr, &clientaddrlen); close(request_sd); /* No longer needed */ if(client_sd < 0) { perror("Error creating new socket"); return client_sd; } chat(client_sd); /* Start chat program */ close(client_sd); /* Cleanup */ printf("Chat ended\n"); return 0; }
void Retina::setup(std::string retinaParameterFile, const bool applyDefaultSetupOnFailure) { // open specified parameters file std::cout<<"Retina::setup: setting up retina from parameter file : "<<retinaParameterFile<<std::endl; // very UGLY cases processing... to be updated... try { // rewriting a new parameter file... if (_parametersSaveFile.isOpened()) _parametersSaveFile.release(); _parametersSaveFile.open(_parametersSaveFileName, cv::FileStorage::WRITE); // opening retinaParameterFile in read mode cv::FileStorage fs(retinaParameterFile, cv::FileStorage::READ); // read parameters file if it exists or apply default setup if asked for if (!fs.isOpened()) { std::cout<<"Retina::setup: provided parameters file could not be open... skeeping configuration"<<std::endl; return; // implicit else case : retinaParameterFile could be open (it exists at least) } // preparing parameter setup bool colorMode, normaliseOutput; double photoreceptorsLocalAdaptationSensitivity, photoreceptorsTemporalConstant, photoreceptorsSpatialConstant, horizontalCellsGain, hcellsTemporalConstant, hcellsSpatialConstant, ganglionCellsSensitivity; // OPL and Parvo init first cv::FileNode rootFn = fs.root(), currFn=rootFn["OPLandIPLparvo"]; currFn["colorMode"]>>colorMode; currFn["normaliseOutput"]>>normaliseOutput; currFn["photoreceptorsLocalAdaptationSensitivity"]>>photoreceptorsLocalAdaptationSensitivity; currFn["photoreceptorsTemporalConstant"]>>photoreceptorsTemporalConstant; currFn["photoreceptorsSpatialConstant"]>>photoreceptorsSpatialConstant; currFn["horizontalCellsGain"]>>horizontalCellsGain; currFn["hcellsTemporalConstant"]>>hcellsTemporalConstant; currFn["hcellsSpatialConstant"]>>hcellsSpatialConstant; currFn["ganglionCellsSensitivity"]>>ganglionCellsSensitivity; setupOPLandIPLParvoChannel(colorMode, normaliseOutput, photoreceptorsLocalAdaptationSensitivity, photoreceptorsTemporalConstant, photoreceptorsSpatialConstant, horizontalCellsGain, hcellsTemporalConstant, hcellsSpatialConstant, ganglionCellsSensitivity); // init retina IPL magno setup currFn=rootFn["IPLmagno"]; currFn["normaliseOutput"]>>normaliseOutput; double parasolCells_beta, parasolCells_tau, parasolCells_k, amacrinCellsTemporalCutFrequency, V0CompressionParameter, localAdaptintegration_tau, localAdaptintegration_k; currFn["parasolCells_beta"]>>parasolCells_beta; currFn["parasolCells_tau"]>>parasolCells_tau; currFn["parasolCells_k"]>>parasolCells_k; currFn["amacrinCellsTemporalCutFrequency"]>>amacrinCellsTemporalCutFrequency; currFn["V0CompressionParameter"]>>V0CompressionParameter; currFn["localAdaptintegration_tau"]>>localAdaptintegration_tau; currFn["localAdaptintegration_k"]>>localAdaptintegration_k; setupIPLMagnoChannel(normaliseOutput, parasolCells_beta, parasolCells_tau, parasolCells_k, amacrinCellsTemporalCutFrequency, V0CompressionParameter, localAdaptintegration_tau, localAdaptintegration_k); }catch(Exception &e) { std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl; if (applyDefaultSetupOnFailure) { setupOPLandIPLParvoChannel(); setupIPLMagnoChannel(); } std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl; std::cout<<"=> keeping current parameters"<<std::endl; } _parametersSaveFile.release(); // close file after setup // report current configuration std::cout<<printSetup()<<std::endl; }
void MainWindow::createMenuFile() { QIcon iconLogo; iconLogo.addPixmap(QPixmap(":/shared/res/qtitan.png")); iconLogo.addPixmap(QPixmap(":/shared/res/qtitanlogo32x32.png")); if (QAction* actionFile = ribbonBar()->addSystemButton(iconLogo, tr("&File"))) { actionFile->setToolTip(tr("Click here to see everything<br />you can do with your<br />document")); if (Qtitan::RibbonSystemPopupBar* popupBar = qobject_cast<Qtitan::RibbonSystemPopupBar*>(actionFile->menu())) { QAction* newFile = popupBar->addAction(QIcon(":/res/new.png"), tr("&New")); newFile->setShortcut(tr("Ctrl+N")); newFile->setStatusTip(tr("Create a new document")); newFile->setToolTip(tr("New")); newFile->setEnabled(false); QAction* openFile = popupBar->addAction(QIcon(":/res/open.png"), tr("&Open...")); openFile->setShortcut(tr("Ctrl+O")); openFile->setToolTip(tr("Open")); openFile->setStatusTip(tr("Open an existing document")); connect(openFile, SIGNAL(triggered()), this, SLOT(open())); QAction* saveFile = popupBar->addAction(QIcon(":/res/save.png"), tr("&Save")); saveFile->setShortcut(tr("Ctrl+S")); saveFile->setToolTip(tr("Save")); saveFile->setStatusTip(tr("Save the active document")); connect(saveFile, SIGNAL(triggered()), this, SLOT(save())); QAction* saveAsFile = popupBar->addAction(tr("Save &As...")); saveAsFile->setToolTip(tr("Save As")); saveAsFile->setStatusTip(tr("Save the active document with a new name")); connect(saveAsFile, SIGNAL(triggered()), this, SLOT(save())); #ifndef QT_NO_PRINTER popupBar->addSeparator(); QAction* printFile = popupBar->addAction(QIcon(":/res/print.png"), tr("&Print")); printFile->setShortcut(tr("Ctrl+P")); printFile->setToolTip(tr("Print")); printFile->setStatusTip(tr("Print the active document")); connect(printFile, SIGNAL(triggered()), this, SLOT(print())); QAction* printPreviewFile = popupBar->addAction(QIcon(":/res/printPreview.png"), tr("Print Pre&view")); printPreviewFile->setToolTip(tr("Print Preview")); printPreviewFile->setStatusTip(tr("Display full pages")); QAction* printSetupFile = popupBar->addAction(tr("P&rint Setup...")); printSetupFile->setToolTip(tr("Print Setup")); printSetupFile->setStatusTip(tr("Change the printer and printing options")); connect(printSetupFile, SIGNAL(triggered()), this, SLOT(printSetup())); popupBar->addSeparator(); #endif // QT_NO_PRINTER QAction* actClose = popupBar->addAction(QIcon(":/res/close.png"), tr("&Close")); actClose->setShortcut(tr("Ctrl+C")); actClose->setStatusTip(tr("Exit")); connect(actClose, SIGNAL(triggered()), this, SLOT(close())); popupBar->addPopupBarAction(actClose); QAction* option = popupBar->addPopupBarAction(tr("Option")); option->setEnabled(false); } } }