Exemplo n.º 1
0
    bool recentProfile( adcontrols::MassSpectrum& ms
                        , const std::array< std::shared_ptr< const acqrscontrols::ap240::waveform >, max_protocol >& v
                        , tdcdoc::mass_assignee_t assignee ) const {

        if ( !v.empty() && v[ 0 ] ) {

            waveform::translate( ms, v[ 0 ], assignee );

            for ( uint32_t proto = 1; proto < protocolCount_; ++proto ) {
                auto sp = std::make_shared< adcontrols::MassSpectrum >();
                if ( auto& w = v[ proto ] )
                    waveform::translate( *sp, w, assignee );
                ms << std::move(sp);
            }
            return true;
        }
        return false;
    }
Exemplo n.º 2
0
    bool recentHistogram( adcontrols::MassSpectrum& ms
                          , const std::array< std::shared_ptr< adcontrols::TimeDigitalHistogram >, max_protocol >& v
                          , tdcdoc::mass_assignee_t assignee ) const {

        if ( !v.empty() && v[ 0 ] ) {

            adcontrols::TimeDigitalHistogram::translate( ms, *v[ 0 ], assignee );

            for ( uint32_t proto = 1; proto < protocolCount_; ++proto ) {

                auto sp = std::make_shared< adcontrols::MassSpectrum >();

                if ( auto& hgrm = v[ proto ] )
                    adcontrols::TimeDigitalHistogram::translate( *sp, *hgrm, assignee );

                ms << std::move(sp);
            }
        }
        return true;
    }
Exemplo n.º 3
0
    void nmsCpu(T* targetPtr, int* kernelPtr, const T* const sourcePtr, const T threshold,
                const std::array<int, 4>& targetSize, const std::array<int, 4>& sourceSize,
                const Point<T>& offset)
    {
        try
        {
            // Security checks
            if (sourceSize.empty())
                error("sourceSize cannot be empty.", __LINE__, __FUNCTION__, __FILE__);
            if (targetSize.empty())
                error("targetSize cannot be empty.", __LINE__, __FUNCTION__, __FILE__);
            if (threshold < 0 || threshold > 1.0)
                error("threshold value invalid.", __LINE__, __FUNCTION__, __FILE__);

            // Params
            const auto channels = targetSize[1]; // 57
            const auto sourceHeight = sourceSize[2]; // 368
            const auto sourceWidth = sourceSize[3]; // 496
            const auto targetPeaks = targetSize[2]; // 97
            const auto targetPeakVec = targetSize[3]; // 3
            const auto sourceChannelOffset = sourceWidth * sourceHeight;
            const auto targetChannelOffset = targetPeaks * targetPeakVec;

            // Per channel operation
            for (auto c = 0 ; c < channels ; c++)
            {
                auto* currKernelPtr = &kernelPtr[c*sourceChannelOffset];
                const T* currSourcePtr = &sourcePtr[c*sourceChannelOffset];

                for (auto y = 0; y < sourceHeight; y++)
                    for (auto x = 0; x < sourceWidth; x++)
                        nmsRegisterKernelCPU(currKernelPtr, currSourcePtr, sourceWidth, sourceHeight, threshold, x, y);

                auto currentPeakCount = 1;
                auto* currTargetPtr = &targetPtr[c*targetChannelOffset];
                for (auto y = 0; y < sourceHeight; y++)
                {
                    for (auto x = 0; x < sourceWidth; x++)
                    {
                        const auto index = y*sourceWidth + x;
                        // Find high intensity points
                        if (currentPeakCount < targetPeaks)
                        {
                            if (currKernelPtr[index] == 1)
                            {
                                // Accurate Peak Position
                                nmsAccuratePeakPosition(&currTargetPtr[currentPeakCount*3], currSourcePtr, x, y,
                                                        sourceWidth, sourceHeight, offset);
                                currentPeakCount++;
                            }
                        }

                    }
                }
                currTargetPtr[0] = currentPeakCount-1;
            }
        }
        catch (const std::exception& e)
        {
            error(e.what(), __LINE__, __FUNCTION__, __FILE__);
        }
    }