コード例 #1
0
ファイル: filters.cpp プロジェクト: 7islands/openpiv-c--qt
/*----------Global--------------------*/
void globalRange(PivData *pivData, FilterOptions filterOptions)
{
    double u,v;

    int width = pivData->width();
    int height = pivData->height();

    double umin = filterOptions.umin();
    double umax = filterOptions.umax();
    double vmin = filterOptions.vmin();
    double vmax = filterOptions.vmax();

    /*  Rejecting any point in the PivData where the displacement
        exceeds any of the user-defined global min/max values
    */
    int i, j;
    for (i = 0; i < height; i++)
    {
        for (j = 0; j < width; j++)
        {
            if (pivData->isValid(i,j))
            {
                u = pivData->data(i,j).u;
                v = pivData->data(i,j).v;
                if (u > umax || u < umin || v > vmax || v < vmin )
                {
                    pivData->setFilter(i,j,true);
                }
            }
        }
    }
}
コード例 #2
0
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()));
}