Transmission detection fix and refactor.

This commit is contained in:
kradchen
2023-05-25 16:17:36 +08:00
parent e0d7617351
commit f0bff1a803
3 changed files with 74 additions and 34 deletions

View File

@@ -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:"<<i;
EXPECT_DOUBLE_AE(sosvalue[i],result.sosValue[i])<<",index:"<<i;
EXPECT_TRUE(std::isnan(result.att[i]))<<",index:"<<i;
}
}
TEST_F(Detection_Test, detectTofAndAtt) {
MatlabReader m("/home/krad/TestData/getBlockOfTransmissionData.mat");
auto AscanBlock = m.read("AscanBlock");
auto AscanRefBlock = m.read("AscanRefBlock");
auto distBlock = m.read("dists");
auto distBlockRef = m.read("distRefBlock");
auto sosWaterBlock = m.read("waterTempBlock");
auto sosWaterRefBlock = m.read("waterTempRefBlock");
double expectedSOSWater = 1.511948131508464e+03;
auto result = Recon::detectTofAndAtt(
AscanBlock, AscanRefBlock, distBlock, distBlockRef, sosWaterBlock,
sosWaterRefBlock, Recon::transParams::resampleFactor,
Recon::transParams::nThreads, expectedSOSWater,
Recon::transParams::useTimeWindowing,
Recon::transParams::aScanReconstructionFrequency,
Recon::transParams::offsetElectronic,Recon::transParams::detectionWindowATT,
Recon::transParams::detectionWindowSOS,
Recon::transParams::minSpeedOfSound,
Recon::transParams::maxSpeedOfSound, Recon::transParams::gaussWindow);
MatlabReader m2("/home/krad/TestData/sosResult.mat");
auto sosvalue = m2.read("sosValue");
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:"<<i;
EXPECT_DOUBLE_AE(sosvalue[i],result.sosValue[i])<<",index:"<<i;
EXPECT_TRUE(std::isnan(result.att[i]))<<",index:"<<i;
}
}
@@ -172,10 +217,10 @@ TEST_F(Detection_Test, detectTofVectorized) {
auto tof = m2.read("tof");
auto sosvalue = m2.read("sosValue");
EXPECT_EQ(tof.getDataSize(), result.getDataSize());
EXPECT_EQ(tof.getDataSize(), result.tof.getDataSize());
#pragma omp parallel for
for (size_t i = 0; i < tof.getDataSize(); i++)
{
EXPECT_DOUBLE_AE(tof[i],result[i])<<",index:"<<i;
EXPECT_DOUBLE_AE(tof[i],result.tof[i])<<",index:"<<i;
}
}