diff --git a/src/transmissionReconstruction/detection/detection.cpp b/src/transmissionReconstruction/detection/detection.cpp index b429efa..22069ff 100644 --- a/src/transmissionReconstruction/detection/detection.cpp +++ b/src/transmissionReconstruction/detection/detection.cpp @@ -10,6 +10,7 @@ #include "Function3D.h" #include "Matrix.h" +#include "config/config.h" #include "calculateBankDetectAndHilbertTransformation.hpp" using namespace Aurora; @@ -235,7 +236,6 @@ namespace Recon { return result; } - //TODO:未测 DetectResult detectTofAndAtt( const Aurora::Matrix &AscanBlock, const Aurora::Matrix &AscanRefBlock, const Aurora::Matrix &distBlock, const Aurora::Matrix &distRefBlock, @@ -260,7 +260,6 @@ namespace Recon { return result; } - //TODO:未测 DetectResult detectTofAndAttMex( const Aurora::Matrix &AscanBlock, const Aurora::Matrix &AscanRefBlock, const Aurora::Matrix &distBlock, const Aurora::Matrix &distRefBlock, @@ -334,8 +333,8 @@ namespace Recon { delete [] resEnvelopeRef; } auto resDetect =Matrix::New(resDetectD,1,N); - auto resEnvelope =Matrix::New(resEnvelopeD,N,M); - auto resEnvelopeRef =Matrix::New(resEnvelopeRefD,N,M); + auto resEnvelope =Matrix::New(resEnvelopeD,M,N); + auto resEnvelopeRef =Matrix::New(resEnvelopeRefD,M,N); //floor(size(AscanBlock, 1)*inits.resampleFactor / 2 - 1), int end_1 = std::floor(_AscanBlock.getDimSize(0)*resampleFactor/2-1); //-ceil(size(AscanBlock, 1)*inits.resampleFactor / 2) @@ -349,7 +348,7 @@ namespace Recon { auto resDetectLags = zeros(_AscanBlock.getDimSize(1),1); for (size_t i = 0; i < _AscanBlock.getDimSize(1); i++) { - resDetectLags[i] = lags2[(int)resDetect[i]+1]; + resDetectLags[i] = lags2[(int)resDetect[i]]; } delete [] lags2; resDetectLags =resDetectLags/resampleFactor; @@ -378,32 +377,32 @@ namespace Recon { return result; } - DetectResult transmissionDetection(const Aurora::Matrix &AscanBlock, const Aurora::Matrix &AscanRefBlock, - const Aurora::Matrix &distBlock, const Aurora::Matrix &distRefBlock, - const Aurora::Matrix &sosWaterBlock, - const Aurora::Matrix &sosWaterRefBlock,int version, int resampleFactor,int nthreads, double expectedSOSWater, - int useTimeWindowing, int aScanReconstructionFrequency,int detectionWindowATT, - double offsetElectronic, int detectionWindowSOS, double minSpeedOfSound, - double maxSpeedOfSound, bool gaussWindow){ - switch (version) { + DetectResult transmissionDetection(const Aurora::Matrix &AscanBlock, + const Aurora::Matrix &AscanRefBlock, + const Aurora::Matrix &distBlock, + const Aurora::Matrix &distRefBlock, + const Aurora::Matrix &sosWaterBlock, + const Aurora::Matrix &sosWaterRefBlock, + double expectedSOSWater) { + switch (Recon::transParams::version) { case 1: { return detectTofAndAttMex( AscanBlock, AscanRefBlock, distBlock, distRefBlock, - sosWaterBlock, sosWaterRefBlock, resampleFactor, nthreads, - expectedSOSWater, useTimeWindowing, - aScanReconstructionFrequency, detectionWindowATT, - offsetElectronic, detectionWindowSOS, minSpeedOfSound, - maxSpeedOfSound, gaussWindow); + sosWaterBlock, sosWaterRefBlock, Recon::transParams::resampleFactor, Recon::transParams::nThreads, + expectedSOSWater, Recon::transParams::useTimeWindowing, + Recon::transParams::aScanReconstructionFrequency, Recon::transParams::detectionWindowATT, + Recon::transParams::offsetElectronic, Recon::transParams::detectionWindowSOS, Recon::transParams::minSpeedOfSound, + Recon::transParams::maxSpeedOfSound, Recon::transParams::gaussWindow); } case 2: default: return detectTofAndAtt( AscanBlock, AscanRefBlock, distBlock, distRefBlock, - sosWaterBlock, sosWaterRefBlock, resampleFactor, nthreads, - expectedSOSWater, useTimeWindowing, - aScanReconstructionFrequency, detectionWindowATT, - offsetElectronic, detectionWindowSOS, minSpeedOfSound, - maxSpeedOfSound, gaussWindow); + sosWaterBlock, sosWaterRefBlock, Recon::transParams::resampleFactor, Recon::transParams::nThreads, + expectedSOSWater, Recon::transParams::useTimeWindowing, + Recon::transParams::aScanReconstructionFrequency, Recon::transParams::detectionWindowATT, + Recon::transParams::offsetElectronic, Recon::transParams::detectionWindowSOS, Recon::transParams::minSpeedOfSound, + Recon::transParams::maxSpeedOfSound, Recon::transParams::gaussWindow); } } } diff --git a/src/transmissionReconstruction/detection/detection.h b/src/transmissionReconstruction/detection/detection.h index 38120f0..3813f74 100644 --- a/src/transmissionReconstruction/detection/detection.h +++ b/src/transmissionReconstruction/detection/detection.h @@ -77,11 +77,7 @@ DetectResult transmissionDetection( const Aurora::Matrix &AscanBlock, const Aurora::Matrix &AscanRefBlock, const Aurora::Matrix &distBlock, const Aurora::Matrix &distRefBlock, - const Aurora::Matrix &sosWaterBlock, const Aurora::Matrix &sosWaterRefBlock, - int version, int resampleFactor, int nthreads, double expectedSOSWater, - int useTimeWindowing, int aScanReconstructionFrequency, - int detectionWindowATT, double offsetElectronic, int detectionWindowSOS, - double minSpeedOfSound, double maxSpeedOfSound, bool gaussWindow); + const Aurora::Matrix &sosWaterBlock, const Aurora::Matrix &sosWaterRefBlock, double expectedSOSWater); } // namespace Recon diff --git a/test/Detection_Test.cpp b/test/Detection_Test.cpp index 64f66ca..6c5d0e8 100644 --- a/test/Detection_Test.cpp +++ b/test/Detection_Test.cpp @@ -60,11 +60,56 @@ TEST_F(Detection_Test, detectTofAndAttMex) { Recon::transParams::minSpeedOfSound, Recon::transParams::maxSpeedOfSound, Recon::transParams::gaussWindow); - MatlabReader m2("/home/krad/TestData/tofResult.mat"); - - auto tof = m2.read("tof"); + MatlabReader m2("/home/krad/TestData/sosResult.mat"); auto sosvalue = m2.read("sosValue"); - EXPECT_EQ(tof.getDataSize(), result.tof.getDataSize()); + ASSERT_EQ(sosvalue.getDataSize(), result.tof.getDataSize()); + ASSERT_EQ(sosvalue.getDataSize(), result.sosValue.getDataSize()); + ASSERT_EQ(sosvalue.getDataSize(), result.att.getDataSize()); + #pragma omp parallel for + for (size_t i = 0; i < result.tof.getDataSize(); i++) + { + EXPECT_DOUBLE_AE(0,result.tof[i])<<",index:"<