/* Runs the butterworth filters for the robot */ void runAllFilters(void) { float y; // Store the estimate // outer leg absolute orientation y = runFilter(&FC_FAST, &FD_OUTER_LEG_ANGLE); y = y - GYRO_ROLL_BIAS; // correct for bias term in the gyro mb_io_set_float(ID_EST_STATE_TH0_IMU, y); STATE_th0_imu = y; // Send robot orientation to the control and estimation code // Outer leg absolute orientation rate y = runFilter(&FC_FAST, &FD_UI_ANG_RATE_X); y = y - GYRO_RATE_BIAS; // correct for gyro bias mb_io_set_float(ID_EST_STATE_DTH0, y); STATE_dth0 = y; // Send robot orientation rate to the control and estimation code // Hip Angular Rate: y = runFilter(&FC_FAST, &FD_MCH_ANG_RATE); mb_io_set_float(ID_E_MCH_ANG_RATE, y); STATE_dqh = y; // Outer Ankle Rate: y = runFilter(&FC_FAST, &FD_MCFO_RIGHT_ANKLE_RATE); mb_io_set_float(ID_E_MCFO_RIGHT_ANKLE_RATE, y); STATE_dq0 = y; // Inner Ankle Rate: y = runFilter(&FC_FAST, &FD_MCFI_ANKLE_RATE); mb_io_set_float(ID_E_MCFI_ANKLE_RATE, y); STATE_dq1 = y; // Outer feet contact filter: y = runFilter(&FC_SLOW, &FD_MCFO_RIGHT_HEEL_SENSE); y = y + runFilter(&FC_SLOW, &FD_MCFO_LEFT_HEEL_SENSE); mb_io_set_float(ID_EST_CONTACT_OUTER, y); STATE_c0 = y > CONTACT_VALUE_THRESHOLD; // Inner feet contact filter y = runFilter(&FC_SLOW, &FD_MCFI_RIGHT_HEEL_SENSE); y = y + runFilter(&FC_SLOW, &FD_MCFI_LEFT_HEEL_SENSE); mb_io_set_float(ID_EST_CONTACT_INNER, y); STATE_c1 = y > CONTACT_VALUE_THRESHOLD; // Steering angle y = runFilter(&FC_VERY_SLOW, &FD_MCSI_STEER_ANGLE); mb_io_set_float(ID_EST_STATE_PSI, y); STATE_psi = y; }
int main(int argc, char *argv[]) { if (argc<3) { fprintf(stderr,"Not enough arguments\n"); return 1; } #if TIME_OPERATIONS StartTimer(0); #endif // TIME_OPERATIONS fprintf(stdout,"Image Processing %s -> %s !\n",argv[1],argv[2]); runFilter(argc,argv); #if TIME_OPERATIONS EndTimer(0); fprintf(stdout,"took %u milliseconds !\n",GetLastTimerMilliseconds(0)); #endif // TIME_OPERATIONS return 0; }
void BorderSelectionOperation::runFromXML(KisViewManager* view, const KisOperationConfiguration& config) { int xradius = config.getInt("x-radius", 1); int yradius = config.getInt("y-radius", 1); KisSelectionFilter* filter = new KisBorderSelectionFilter(xradius, yradius); runFilter(filter, view, config); }
/// Init a ds pipeline. /// \param confFile XML file configuration, NULL if we want to make things by hand /// \param argc argc received by main function that will be forwarded to filter processes /// \param argv argv received by main function that will be forwarded to filter processes /// \return Layout of the pipeline Layout *initDs(char *confFile, int argc, char **argv) { int err; //configura pvm pra enviar dado diretamente(IMPORTANTE!!!!) pvm_setopt(PvmRoute, PvmRouteDirect); //err == 0, OK err = pvm_start_pvmd(0, NULL, 0); switch (err) { case PvmSysErr: printf("Manager.c: error starting PVM, aborting\n"); exit(1); break; } //start random number generator srandom(getpid()); // config DS to use signals // signal(SIGSEGV, &captureSignal); // signal(SIGINT, &captureSignal); // signal(SIGILL, &captureSignal); // signal(SIGHUP, &captureSignal); // signal(SIGTERM, &captureSignal); if (I_AM_THE_MANAGER) { return initManager(confFile, argc, argv); } else { runFilter(argc, argv); exit(0); } }
void ShrinkSelectionOperation::runFromXML(KisViewManager* view, const KisOperationConfiguration& config) { int xradius = config.getInt("x-radius", 1); int yradius = config.getInt("y-radius", 1); bool edgeLock = config.getBool("edgeLock", false); KisSelectionFilter* filter = new KisShrinkSelectionFilter(xradius, yradius, edgeLock); runFilter(filter, view, config); }
Bellerophon::Bellerophon(string name, bool filterSeqs, bool c, int win, int inc, int p, string o) : Chimera() { try { fastafile = name; correction = c; outputDir = o; window = win; increment = inc; processors = p; //read in sequences seqs = readSeqs(fastafile); numSeqs = seqs.size(); if (numSeqs == 0) { m->mothurOut("Error in reading you sequences."); m->mothurOutEndLine(); exit(1); } //do soft filter if (filterSeqs) { createFilter(seqs, 0.5); for (int i = 0; i < seqs.size(); i++) { runFilter(seqs[i]); } } distCalculator = new eachGapDist(); //set default window to 25% of sequence length string seq0 = seqs[0]->getAligned(); if (window == 0) { window = seq0.length() / 4; } else if (window > (seq0.length() / 2)) { m->mothurOut("Your sequence length is = " + toString(seq0.length()) + ". You have selected a window size greater than the length of half your aligned sequence. I will run it with a window size of " + toString((seq0.length() / 2))); m->mothurOutEndLine(); window = (seq0.length() / 2); } if (increment > (seqs[0]->getAlignLength() - (2*window))) { if (increment != 10) { m->mothurOut("You have selected a increment that is too large. I will use the default."); m->mothurOutEndLine(); increment = 10; if (increment > (seqs[0]->getAlignLength() - (2*window))) { increment = 0; } }else{ increment = 0; } } if (increment == 0) { iters = 1; } else { iters = ((seqs[0]->getAlignLength() - (2*window)) / increment); } //initialize pref pref.resize(iters); for (int i = 0; i < iters; i++) { Preference temp; for (int j = 0; j < numSeqs; j++) { pref[i].push_back(temp); } } } catch(exception& e) { m->errorOut(e, "Bellerophon", "Bellerophon"); exit(1); } }
//************************************************************************************************** ossimRefPtr<ossimImageData> ossimScaleFilter::getTile( const ossimIrect& tileRect, ossim_uint32 resLevel) { if((!isSourceEnabled())|| (!theInputConnection)|| ((m_ScaleFactor.x == 1.0)&& (m_ScaleFactor.y == 1.0)&& (m_BlurFactor == 1.0))) { return ossimImageSourceFilter::getTile(tileRect, resLevel); } if(!m_Tile.valid()) { allocate(); } if(!m_Tile) { return ossimImageSourceFilter::getTile(tileRect, resLevel); } m_Tile->makeBlank(); ossimIrect imageRect = tileRect*m_InverseScaleFactor; m_Tile->setImageRectangle(tileRect); m_BlankTile->setImageRectangle(tileRect); double xSupport; double ySupport; getSupport(xSupport, ySupport); ossimIpt deltaPt; deltaPt.x = (ossim_int32)ceil(xSupport); deltaPt.y = (ossim_int32)ceil(ySupport); imageRect = ossimIrect(imageRect.ul().x - (deltaPt.x), imageRect.ul().y - (deltaPt.y), imageRect.lr().x + (deltaPt.x), imageRect.lr().y + (deltaPt.y)); runFilter(imageRect, tileRect); m_Tile->validate(); return m_Tile; }
void PluginKateTextFilter::slotEditFilter() { if (!KAuthorized::authorizeKAction(QStringLiteral("shell_access"))) { KMessageBox::sorry(0,i18n( "You are not allowed to execute arbitrary external applications. If " "you want to be able to do this, contact your system administrator."), i18n("Access Restrictions")); return; } if (!KTextEditor::Editor::instance()->application()->activeMainWindow()) return; KTextEditor::View* kv(KTextEditor::Editor::instance()->application()->activeMainWindow()->activeView()); if (!kv) return; QDialog dialog(KTextEditor::Editor::instance()->application()->activeMainWindow()->window()); Ui::TextFilterWidget ui; ui.setupUi(&dialog); ui.filterBox->setFocus(); dialog.setWindowTitle(i18n("Text Filter")); KConfigGroup config(KSharedConfig::openConfig(), "PluginTextFilter"); QStringList items = config.readEntry("Completion list", QStringList()); copyResult = config.readEntry("Copy result", false); mergeOutput = config.readEntry("Merge output", true); ui.filterBox->setMaxCount(10); ui.filterBox->setHistoryItems(items, true); ui.copyResult->setChecked(copyResult); ui.mergeOutput->setChecked(mergeOutput); if (dialog.exec() == QDialog::Accepted) { copyResult = ui.copyResult->isChecked(); mergeOutput = ui.mergeOutput->isChecked(); const QString filter = ui.filterBox->currentText(); if (!filter.isEmpty()) { ui.filterBox->addToHistory(filter); config.writeEntry("Completion list", ui.filterBox->historyItems()); config.writeEntry("Copy result", copyResult); config.writeEntry("Merge output", mergeOutput); m_last_command = filter; runFilter(kv, filter); } } }
ossimRefPtr<ossimImageData> ossimEdgeFilter::getTile(const ossimIrect& rect, ossim_uint32 resLevel) { if(!isSourceEnabled()) { return ossimImageSourceFilter::getTile(rect, resLevel); } // expand the rect out to cver the 3x3 horizontal and vertical // kernel. // ossimIrect requestRect = rect; adjustRequestRect(requestRect); ossimRefPtr<ossimImageData> inputData = ossimImageSourceFilter::getTile(requestRect, resLevel); if(!inputData.valid() || (!inputData->getBuf())) { return inputData; } if(!theTile.valid()) initialize(); if(!theTile.valid()) return theTile; theTile->setImageRectangleAndBands(rect, inputData->getNumberOfBands()); switch(theTile->getScalarType()) { case OSSIM_UCHAR: { runFilter((ossim_uint8)0, inputData); break; } case OSSIM_FLOAT: case OSSIM_NORMALIZED_FLOAT: { runFilter((ossim_float32)0, inputData); break; } case OSSIM_USHORT16: case OSSIM_USHORT11: { runFilter((ossim_uint16)0, inputData); break; } case OSSIM_SSHORT16: { runFilter((ossim_sint16)0, inputData); break; } case OSSIM_DOUBLE: case OSSIM_NORMALIZED_DOUBLE: { runFilter((ossim_float64)0, inputData); break; } default: { ossimNotify(ossimNotifyLevel_WARN) << "ossimEdgeFilter::getTile WARN: Scalar type = " << theTile->getScalarType() << " Not supported by ossimEdgeFilter" << std::endl; break; } } return theTile; }
void SmoothSelectionOperation::runFromXML(KisViewManager* view, const KisOperationConfiguration& config) { Q_UNUSED(config); KisSelectionFilter* filter = new KisSmoothSelectionFilter(); runFilter(filter, view, config); }
void FeatherSelectionOperation::runFromXML(KisViewManager* view, const KisOperationConfiguration& config) { int radius = config.getInt("radius", 1); KisSelectionFilter* filter = new KisFeatherSelectionFilter(radius); runFilter(filter, view, config); }
void TestTubeSegmentationFramework::testSyntheticVascusynthPreset() { runFilter(QString("Synthetic-Vascusynth")); }
void KisInvertSelectionOperaton::runFromXML(KisView2* view, const KisOperationConfiguration& config) { KisSelectionFilter* filter = new KisInvertSelectionFilter(); runFilter(filter, view, config); }
void TestTubeSegmentationFramework::testLiverVesselsMRPreset() { runFilter(QString("Liver-Vessels-MR")); }
void TestTubeSegmentationFramework::testLungAirwaysCTPreset() { runFilter(QString("Lung-Airways-CT")); }
void TestTubeSegmentationFramework::testNeuroVesselsUSAPreset() { runFilter(QString("Neuro-Vessels-USA")); }
void TestTubeSegmentationFramework::testPhantomAccUSPreset() { runFilter(QString("Phantom-Acc-US")); }
//*************************************************************************************************************** int Ccode::getChimeras(Sequence* query) { try { closest.clear(); refCombo = 0; sumRef.clear(); varRef.clear(); varQuery.clear(); sdRef.clear(); sdQuery.clear(); sumQuery.clear(); sumSquaredRef.clear(); sumSquaredQuery.clear(); averageRef.clear(); averageQuery.clear(); anova.clear(); isChimericConfidence.clear(); isChimericTStudent.clear(); isChimericANOVA.clear(); trim.clear(); spotMap.clear(); windowSizes = window; windows.clear(); querySeq = query; //find closest matches to query closest = findClosest(query, numWanted); if (m->control_pressed) { return 0; } //initialize spotMap for (int i = 0; i < query->getAligned().length(); i++) { spotMap[i] = i; } //mask sequences if the user wants to if (seqMask != "") { decalc->setMask(seqMask); decalc->runMask(query); //mask closest for (int i = 0; i < closest.size(); i++) { decalc->runMask(closest[i].seq); } spotMap = decalc->getMaskMap(); } if (filter) { vector<Sequence*> temp; for (int i = 0; i < closest.size(); i++) { temp.push_back(closest[i].seq); } temp.push_back(query); createFilter(temp, 0.5); for (int i = 0; i < temp.size(); i++) { if (m->control_pressed) { return 0; } runFilter(temp[i]); } //update spotMap map<int, int> newMap; int spot = 0; for (int i = 0; i < filterString.length(); i++) { if (filterString[i] == '1') { //add to newMap newMap[spot] = spotMap[i]; spot++; } } spotMap = newMap; } //trim sequences - this follows ccodes remove_extra_gaps trimSequences(query); if (m->control_pressed) { return 0; } //windows are equivalent to words - ccode paper recommends windows are between 5% and 20% on alignment length(). //Our default will be 10% and we will warn if user tries to use a window above or below these recommendations windows = findWindows(); if (m->control_pressed) { return 0; } //remove sequences that are more than 20% different and less than 0.5% different - may want to allow user to specify this later removeBadReferenceSeqs(closest); if (m->control_pressed) { return 0; } //find the averages for each querys references getAverageRef(closest); //fills sumRef, averageRef, sumSquaredRef and refCombo. getAverageQuery(closest, query); //fills sumQuery, averageQuery, sumSquaredQuery. if (m->control_pressed) { return 0; } //find the averages for each querys references findVarianceRef(); //fills varRef and sdRef also sets minimum error rate to 0.001 to avoid divide by 0. if (m->control_pressed) { return 0; } //find the averages for the query findVarianceQuery(); //fills varQuery and sdQuery also sets minimum error rate to 0.001 to avoid divide by 0. if (m->control_pressed) { return 0; } determineChimeras(); //fills anova, isChimericConfidence, isChimericTStudent and isChimericANOVA. if (m->control_pressed) { return 0; } return 0; } catch(exception& e) { m->errorOut(e, "Ccode", "getChimeras"); exit(1); } }
void TestTubeSegmentationFramework::testDefaultPreset() { runFilter(QString("Default")); }