Beispiel #1
0
void Analysis::filterData(PivData *pivData, FilterOptions filterOptions)
{
    // Checking each filtering option and calling external filter functions (included from filters.h)
    if (filterOptions.snr()) snr(pivData,filterOptions);
    if (filterOptions.imageIntensity()) imageIntensity(pivData,filterOptions);
    if (filterOptions.globalRange()) globalRange(pivData,filterOptions);
    if (filterOptions.globalStd()) globalStd(pivData,filterOptions);
    if (filterOptions.local()) localDetect(pivData,filterOptions);
    if (filterOptions.interpolate()) meanInterpolate(pivData, filterOptions);
    if (filterOptions.smoothing()) gaussianBlur(pivData, filterOptions);
}
void MainWindow::setFilterTab()
{
    FilterOptions filterOptions = settings->filterOptions();

    // Global
    minUedit->setText(QString("%1").arg(filterOptions.umin()));
    maxUedit->setText(QString("%1").arg(filterOptions.umax()));
    minVedit->setText(QString("%1").arg(filterOptions.vmin()));
    maxVedit->setText(QString("%1").arg(filterOptions.vmax()));

    minUedit->setEnabled(filterOptions.globalRange());
    maxUedit->setEnabled(filterOptions.globalRange());
    minVedit->setEnabled(filterOptions.globalRange());
    maxVedit->setEnabled(filterOptions.globalRange());

    nStdDevSpin->setValue(filterOptions.nStd());
    nStdDevSpin->setEnabled(filterOptions.globalStd());

    // Local
    localMethodCombo->setEnabled(filterOptions.local());
    localMethodCombo->setCurrentIndex(filterOptions.localMethod());
    localNxNCombo->setEnabled(filterOptions.local());
    localNxNCombo->setCurrentIndex((filterOptions.localNxN()-1)/2-1);
    localUedit->setEnabled(filterOptions.local());
    localVedit->setEnabled(filterOptions.local());
    localUedit->setText(QString("%1").arg(filterOptions.uTol()));
    localVedit->setText(QString("%1").arg(filterOptions.vTol()));

    // Interpolate
    interpolateMethodCombo->setEnabled(filterOptions.interpolate());
    interpolateMethodCombo->setCurrentIndex(filterOptions.intMethod());
    interpolateNxNCombo->setEnabled(filterOptions.interpolate());
    interpolateNxNCombo->setCurrentIndex((filterOptions.intNxN()-1)/2-1);

    // Smoothing
    smoothNxNCombo->setEnabled(filterOptions.smoothing());
    smoothNxNCombo->setCurrentIndex((filterOptions.smoothNxN()-1)/2-1);
    smoothRadiusEdit->setEnabled(filterOptions.smoothing());
    smoothRadiusEdit->setText(QString("%1").arg(filterOptions.smoothRadius()));
}
void MainWindow::setFilterValues()
{
    //std::cout << "in setFilterValues\n";
    FilterOptions filterOptions;
    filterOptions = settings->filterOptions();

    // Global
    double temp;

    if (filterOptions.globalRange())
    {
        double umin = minUedit->text().toDouble();
        double umax = maxUedit->text().toDouble();
        if (umin > umax)
        {
            temp = umin;
            umin = umax;
            umax = temp;
        }
        double vmin = minVedit->text().toDouble();
        double vmax = maxVedit->text().toDouble();
        if (vmin > vmax)
        {
            temp = vmin;
            vmin = vmax;
            vmax = temp;
        }
        filterOptions.setRange(umin,umax,vmin,vmax);
    }

    if (filterOptions.globalStd()) filterOptions.setNStd(nStdDevSpin->value());

    // Local
    double u, v;
    if (filterOptions.local())
    {
        filterOptions.setLocalMethod(localMethodCombo->currentIndex());
        filterOptions.setLocalNxN((localNxNCombo->currentIndex()+1)*2+1);
        u = localUedit->text().toDouble();
        v = localVedit->text().toDouble();
        filterOptions.setLocalTolerance(u, v);
    }

    // Interpolate
    if (filterOptions.interpolate())
    {
        filterOptions.setIntMethod(interpolateMethodCombo->currentIndex());
        filterOptions.setLocalNxN((interpolateNxNCombo->currentIndex()+1)*2+1);
    }

    // Smoothing
    if (filterOptions.smoothing())
    {
        filterOptions.setSmoothRadius(smoothRadiusEdit->text().toDouble());
        filterOptions.setSmoothNxN((smoothNxNCombo->currentIndex()+1)*2+1);
    }

    // Write and delay changes
    settings->setFilterOptions(filterOptions);
    QTimer::singleShot(10000, this, SLOT(setFilterTab()));
}