Add Reflection dataFilter

This commit is contained in:
kradchen
2023-05-16 14:34:18 +08:00
parent a0033d9f8a
commit 24d2a64abb
3 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
#include "dataFilter.h"
#include "Function1D.h"
#include "Function2D.h"
#include "Function3D.h"
#define PI 3.141592653589793238462
using namespace Aurora;
namespace Recon {
Matrix filterReflectionData(const Matrix &aVReceiverPositionBlock,
const Matrix &aVSenderPositionBlock,
const Matrix &aVSenderNormalBlock,
int aConstrictReflectionAngles,
double aAngleLowerLimit, double aAngleUpperLimit) {
auto reflectData = ones(1, aVReceiverPositionBlock.getDimSize(1));
if (aConstrictReflectionAngles == 1) {
auto positionDifs = aVReceiverPositionBlock - aVSenderPositionBlock;
auto inbetweenAngle = acos(dot(aVSenderNormalBlock, positionDifs) /
vecnorm(positionDifs, Norm2, 1));
auto flags = Aurora::auroraNot((inbetweenAngle < (PI * aAngleLowerLimit / 180)) +
(inbetweenAngle > (PI * aAngleUpperLimit / 180)));
reflectData = reflectData * flags;
}
return reflectData;
}
} // namespace Recon

View File

@@ -0,0 +1,15 @@
#ifndef __REF_DATAFILTER_H__
#define __REF_DATAFILTER_H__
#include "Matrix.h"
namespace Recon {
Aurora::Matrix filterReflectionData(const Aurora::Matrix &aVReceiverPositionBlock,
const Aurora::Matrix &aVSenderPositionBlock,
const Aurora::Matrix &aVSenderNormalBlock,
int aConstrictReflectionAngles,
double aAngleLowerLimit,
double aAngleUpperLimit);
}
#endif // __DATAFILTER_H__

View File

@@ -4,8 +4,11 @@
#include "Function1D.h"
#include "MatlabReader.h"
#include "Matrix.h"
#include "reflectionReconstruction/dataFilter.h"
#include "transmissionReconstruction/dataFilter/dataFilter.h"
inline double fourDecimalRound(double src){
return round(src*10000.0)/10000.0;
}
@@ -114,4 +117,17 @@ TEST_F(DataFilter_Test, findDefectTransmissionData) {
}
}
TEST_F(DataFilter_Test, filterReflectionData) {
auto receiverPositionBlock = Aurora::transpose(Aurora::Matrix::fromRawData(new double[9]{-0.12,-0.12,-0.12,-0.01,-0.01,-0.01,0.03,0.03,0.04}, 3, 3));
auto senderPositionBlock = Aurora::transpose(Aurora::Matrix::fromRawData(new double[9]{-0.12,-0.12,-0.12,-0.01,-0.01,-0.01,0.03,0.03,0.03}, 3, 3));
auto senderNormalBlock = Aurora::transpose(Aurora::Matrix::fromRawData(new double[9]{0.99,0.99,0.99,0.10,0.10,0.10,0,0,0}, 3, 3));
int constrictReflectionAngles = 1;
double lowerAngle = 45;
double upperAngle = 360;
auto result = Recon::filterReflectionData(receiverPositionBlock, senderPositionBlock, senderNormalBlock, constrictReflectionAngles, lowerAngle, upperAngle);
EXPECT_EQ(3, result.getDataSize());
EXPECT_DOUBLE_AE(result[0],1);
EXPECT_DOUBLE_AE(result[1],1);
EXPECT_DOUBLE_AE(result[2],1);
}