예제 #1
0
    float Evaluate(const VoxImage<VoxelT> &buffer, int index)
    {
        const Vector<VoxelT> &vbuf = buffer.ConstData();
        const Vector<VoxelT> &vker = this->m_KernelData.ConstData();
        int img_size = vbuf.size();
        int ker_size = vker.size();
        int pos;



        Vector<FPair> mfh(ker_size);
        for (int i = 0; i < ker_size; ++i)
            mfh[i].first = vker[i].Value; // kernel value in first
        for (int ik = 0; ik < ker_size; ik++) {
            pos = index + vker[ik].Count - vker[this->m_KernelData.GetCenterData()].Count;
            pos = (pos + img_size) % img_size;
            mfh[ik].second = vbuf[pos].Value; // image value in second
        }
        std::sort(mfh.begin(), mfh.end(), KernelSortAscending());

        float conv = 0, ksum = 0;
        float gamma_smooth;
        //        for (int ik = 0; ik < mAtrim; ik++)
        //            ksum += mfh[ik].first;
        for (int ik = mAtrim; ik < ker_size - mBtrim; ik++) {
            gamma_smooth = compute_gauss( fabs(vbuf[index].Value - mfh[ik].second) * 1.E6 );
            conv += mfh[ik].first * mfh[ik].second * gamma_smooth;
            ksum += mfh[ik].first * gamma_smooth;
        }
        //        for (int ik = ker_size - mBtrim; ik < ker_size; ik++)
        //            ksum += mfh[ik].first;

        return conv / ksum;
    }
예제 #2
0
 float Evaluate(const VoxImage<VoxelT> &buffer, int index)
 {
     const Vector<VoxelT> &vbuf = buffer.ConstData();
     const Vector<VoxelT> &vker = this->m_KernelData.ConstData();
     int vox_size = vbuf.size();
     int ker_size = vker.size();
     int pos;
     float conv = 0, ksum = 0;
     for (int ik = 0; ik < ker_size; ++ik) {
         pos = index + vker[ik].Count - vker[this->m_KernelData.GetCenterData()].Count;
         pos = (pos + vox_size) % vox_size;
         conv += vbuf[pos].Value * vker[ik].Value;
         ksum += vker[ik].Value;
     }
     return conv / ksum;
 }
예제 #3
0
 float Evaluate(const VoxImage<VoxelT> &buffer, int index)
 {
     const Vector<VoxelT> &vbuf = buffer.ConstData();
     const Vector<VoxelT> &vker = this->m_KernelData.ConstData();
     int vox_size = vbuf.size();
     int ker_size = vker.size();
     int pos;
     float conv = 0, ksum = 0;
     float gamma_smooth;
     for (int ik = 0; ik < ker_size; ++ik) {
         //            if (ik==this->m_KernelData.GetCenterData()) continue;
         pos = index + vker[ik].Count - vker[this->m_KernelData.GetCenterData()].Count;
         pos = (pos + vox_size) % vox_size;
         gamma_smooth = compute_gauss( fabs(vbuf[index].Value - vbuf[pos].Value) * 1.E6 );
         conv += vbuf[pos].Value * vker[ik].Value * gamma_smooth;
         ksum += vker[ik].Value * gamma_smooth;
     }
     return conv / ksum;
 }