Merge branch 'master' of http://192.168.1.9:3000/Bug/UR
This commit is contained in:
@@ -66,21 +66,24 @@ namespace Recon {
|
||||
return transData;
|
||||
}
|
||||
|
||||
Aurora::Matrix checkTofDetections(Aurora::Matrix &aVTofValues, const Aurora::Matrix &aVDists,
|
||||
checkTofDetectionsResult checkTofDetections(const Aurora::Matrix &aVTofValues, const Aurora::Matrix &aVDists,
|
||||
const Aurora::Matrix &aVSosRef,
|
||||
double minSpeedOfSound,
|
||||
double maxSpeedOfSound)
|
||||
{
|
||||
checkTofDetectionsResult result;
|
||||
auto sosValues = aVDists / (aVTofValues + (aVDists / aVSosRef));
|
||||
|
||||
auto valid = (sosValues < maxSpeedOfSound) * (sosValues > minSpeedOfSound);
|
||||
result.valid = valid;
|
||||
|
||||
auto minSpeedOfSoundM = minSpeedOfSound+ zeros(sosValues.getDimSize(0),sosValues.getDimSize(1),sosValues.getDimSize(2));
|
||||
auto maxSpeedOfSoundM = maxSpeedOfSound+zeros(sosValues.getDimSize(0),sosValues.getDimSize(1),sosValues.getDimSize(2));
|
||||
sosValues = max(minSpeedOfSoundM, sosValues);
|
||||
sosValues = min(maxSpeedOfSoundM, sosValues);
|
||||
|
||||
aVTofValues = (aVDists / sosValues) - (aVDists / aVSosRef);
|
||||
return sosValues;
|
||||
Matrix tofValues = (aVDists / sosValues) - (aVDists / aVSosRef);
|
||||
result.tofValues = tofValues;
|
||||
return result;
|
||||
}
|
||||
|
||||
Aurora::Matrix filterTransmissionData(const Aurora::Matrix &aVslBlock,
|
||||
|
||||
@@ -17,7 +17,13 @@ filterTransmissionAngle(double aAngleLowerLimit, double aAngleUpperLimit,
|
||||
const Aurora::Matrix &aMSenderNormalBlock,
|
||||
const Aurora::Matrix &aMReceiverNormalBlock);
|
||||
|
||||
Aurora::Matrix checkTofDetections(Aurora::Matrix &aVTofValues,
|
||||
struct checkTofDetectionsResult
|
||||
{
|
||||
Aurora::Matrix tofValues;
|
||||
Aurora::Matrix valid;
|
||||
};
|
||||
|
||||
checkTofDetectionsResult checkTofDetections(const Aurora::Matrix &aVTofValues,
|
||||
const Aurora::Matrix &aVDists,
|
||||
const Aurora::Matrix &aVSosRef,
|
||||
double minSpeedOfSound,
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "config/config.h"
|
||||
#include "reflectionReconstruction/dataFilter.h"
|
||||
#include "transmissionReconstruction/dataFilter/dataFilter.h"
|
||||
#include "src/transmissionReconstruction/dataPreperation.h"
|
||||
#include "src/common/getMeasurementMetaData.h"
|
||||
|
||||
|
||||
|
||||
@@ -71,21 +73,28 @@ TEST_F(DataFilter_Test, filterTransmissionAngle) {
|
||||
EXPECT_DOUBLE_EQ(1.0,result.getData()[3]);
|
||||
}
|
||||
|
||||
TEST_F(DataFilter_Test, checkTofDetections) {
|
||||
double *dataA = new double[3]{-3.0e-07, -2.6e-06, -2.6e-06};
|
||||
auto tofValues = Aurora::Matrix::fromRawData(dataA, 3, 1);
|
||||
double *dataB = new double[3]{0.238, 0.249, 0.249};
|
||||
auto dists = Aurora::Matrix::fromRawData(dataB, 3, 1);
|
||||
double *data3 = new double[3]{1476.35, 1476.28, 1476.28};
|
||||
auto sosRef = Aurora::Matrix::fromRawData(data3, 3, 1);
|
||||
double minSpeedOfSound = 1400;
|
||||
double maxSpeedOfSound = 1650;
|
||||
|
||||
auto result = Recon::checkTofDetections(tofValues, dists, sosRef, minSpeedOfSound,maxSpeedOfSound);
|
||||
EXPECT_EQ(3,result.getDataSize());
|
||||
EXPECT_DOUBLE_AE(1479.1025,result.getData()[0]);
|
||||
EXPECT_DOUBLE_AE(1499.3931,result.getData()[1]);
|
||||
EXPECT_DOUBLE_AE(1499.3931,result.getData()[2]);
|
||||
TEST_F(DataFilter_Test, checkTofDetections) {
|
||||
MatlabReader m("/home/sun/testData/checkTofDetections.mat");
|
||||
auto receiverList = m.read("receiverList");
|
||||
auto senderList = m.read("senderList");
|
||||
auto tofDataTotal = m.read("tofDataTotal");
|
||||
auto waterTempList = m.read("waterTempList");
|
||||
auto tofValues = m.read("tofValues");
|
||||
auto valid = m.read("valid");
|
||||
Aurora::Matrix dists = Recon::distanceBetweenTwoPoints(senderList, receiverList);
|
||||
Aurora::Matrix sosRef = Recon::temperatureToSoundSpeed(waterTempList, "marczak");
|
||||
auto result = Recon::checkTofDetections(tofDataTotal, dists, sosRef, Recon::transParams::minSpeedOfSound,Recon::transParams::maxSpeedOfSound);
|
||||
|
||||
for (size_t i = 0; i < result.valid.getDataSize(); i++)
|
||||
{
|
||||
EXPECT_DOUBLE_AE(valid.getData()[i],result.valid.getData()[i]) << " :"<<i;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < result.tofValues.getDataSize(); i++)
|
||||
{
|
||||
EXPECT_DOUBLE_AE(tofValues.getData()[i],result.tofValues.getData()[i])<< " :"<<i;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(DataFilter_Test, calculateSnr) {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include <cstddef>
|
||||
#include <gtest/gtest.h>
|
||||
#include <limits>
|
||||
|
||||
#include "Function1D.h"
|
||||
#include "MatlabReader.h"
|
||||
#include "Matrix.h"
|
||||
#include "config/config.h"
|
||||
#include "transmissionReconstruction/reconstruction/buildMatrix/DGradient.h"
|
||||
#include "transmissionReconstruction/reconstruction/buildMatrix/FMM.h"
|
||||
#include "transmissionReconstruction/reconstruction/buildMatrix/buildMatrix.h"
|
||||
@@ -66,12 +68,45 @@ TEST_F(Reconstruction_Test, getDimensions) {
|
||||
}
|
||||
|
||||
TEST_F(Reconstruction_Test, discretizePositions) {
|
||||
auto senderList = Aurora::Matrix::fromRawData(new double[6]{1, 2, 3, 1, 2, 4}, 3, 2);
|
||||
auto receiverList = Aurora::Matrix::fromRawData(new double[6]{1, 8, 3, 1, 2, 1}, 3, 2);
|
||||
double numPixelXY = 128;
|
||||
auto result = Recon::discretizePositions(senderList,receiverList,numPixelXY);
|
||||
EXPECT_DOUBLE_AE(128,result.receiverCoordList[1]);
|
||||
EXPECT_DOUBLE_AE(1,result.senderCoordList[1]);
|
||||
MatlabReader m("/home/sun/testData/discretizePositions.mat");
|
||||
auto senderList = m.read("senderList");
|
||||
auto receiverList = m.read("receiverList");
|
||||
auto result = Recon::discretizePositions(senderList,receiverList,Recon::transParams::numPixelXY);
|
||||
auto senderListResult = m.read("senderListResult");
|
||||
auto receiverListResult = m.read("receiverListResult");
|
||||
auto dims = m.read("dims");
|
||||
auto ddims = m.read("ddims");
|
||||
auto res = m.read("res");
|
||||
|
||||
EXPECT_DOUBLE_AE(senderListResult.getDataSize(), result.senderCoordList.getDataSize());
|
||||
for(size_t i=0; i<senderListResult.getDataSize(); ++i)
|
||||
{
|
||||
EXPECT_DOUBLE_AE(senderListResult[i], result.senderCoordList[i]);
|
||||
}
|
||||
|
||||
EXPECT_DOUBLE_AE(receiverListResult.getDataSize(), result.receiverCoordList.getDataSize());
|
||||
for(size_t i=0; i<receiverListResult.getDataSize(); ++i)
|
||||
{
|
||||
EXPECT_DOUBLE_AE(receiverListResult[i], result.receiverCoordList[i]);
|
||||
}
|
||||
|
||||
EXPECT_DOUBLE_AE(dims.getDataSize(), result.dims.getDataSize());
|
||||
for(size_t i=0; i<dims.getDataSize(); ++i)
|
||||
{
|
||||
EXPECT_DOUBLE_AE(dims[i], result.dims[i]);
|
||||
}
|
||||
|
||||
EXPECT_DOUBLE_AE(ddims.getDataSize(), result.ddims.getDataSize());
|
||||
for(size_t i=0; i<ddims.getDataSize(); ++i)
|
||||
{
|
||||
EXPECT_DOUBLE_AE(ddims[i], result.ddims[i]);
|
||||
}
|
||||
|
||||
EXPECT_DOUBLE_AE(res.getDataSize(), result.res.getDataSize());
|
||||
for(size_t i=0; i<res.getDataSize(); ++i)
|
||||
{
|
||||
EXPECT_DOUBLE_AE(res[i], result.res[i]);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(Reconstruction_Test, DGradient) {
|
||||
|
||||
Reference in New Issue
Block a user