Example #1
0
/********************************************//**
\brief Discrete Wavelet Transform including Daubechies and Biorthogonal
\param array : input array (1D)
\param filter : name of the filter to use (from TransformationType enum)
\param dir : direction (1:forward, -1:backward)
\param transformedArray : resulting transformed array
\param stop : flag indicating if we need to stop the process or not
\param origLength : original Length useful when dir is -1 to cut result
\return boolean true if the execution is finished,
        false if the process has been stopped during the execution
***********************************************/
bool FWT::getDWT(const QVector<float>& array,
                 const TransformationType filter,
                 const int dir,
                 QVector<float>& transformedArray,
                 bool* stop,
                 const int origLength)
{
    std::vector<float> result;
    if(filter == DB4_TRANSFORMATION || filter == DB6_TRANSFORMATION || filter == DB8_TRANSFORMATION)
    {
        if(dir == 1) return fastWaveletTransf(array.toStdVector(), filter, result, stop);
        else return iFastWaveletTransf(array.toStdVector(), filter, origLength, result, stop);
    }
    else if(filter == BIOR_5_3_TRANSFORMATION || filter == BIOR_9_7_TRANSFORMATION)
    {
        return perform_wavelet_transform(array.toStdVector(), filter, dir, origLength, result, stop);
    }

    transformedArray.fromStdVector(result);
    return true;
}