#include "getGeometryInfo.h" #include "../config/geometryConfig.h" #include "Function1D.h" #include "Function.h" #include "Function2D.h" #include "Matrix.h" #include "src/common/getMeasurementMetaData.h" #include #include #include #include using namespace Recon; using namespace Aurora; namespace { Matrix loadSensitivity() { double* senseRevise = new double[Recon::ANGLE_CORRECTION_SIZE - 1]; std::reverse_copy(ANGLE_CORRECTION.getData(), ANGLE_CORRECTION.getData() + Recon::ANGLE_CORRECTION_SIZE - 1, senseRevise); size_t fullSens1DSize = Recon::ANGLE_CORRECTION_SIZE * 2 - 1; double* fullSens1DData = new double[fullSens1DSize]; std::copy(ANGLE_CORRECTION.getData(), ANGLE_CORRECTION.getData() + Recon::ANGLE_CORRECTION_SIZE, fullSens1DData); std::copy(senseRevise, senseRevise + Recon::ANGLE_CORRECTION_SIZE - 1, fullSens1DData + Recon::ANGLE_CORRECTION_SIZE); Matrix fullSens1D = Matrix::fromRawData(fullSens1DData, 1, fullSens1DSize); Matrix fullSens2D = repmat(fullSens1D, fullSens1DSize, 1); Matrix fullSens2DTransposed = transpose(fullSens2D); fullSens2D = sqrt(fullSens2D * fullSens2DTransposed); fullSens2D = fullSens2D / max(fullSens2D,FunctionDirection::All); Matrix x0 = linspace(-90,90,fullSens1D.getDataSize()); Matrix y0 = linspace(-90,90,fullSens1D.getDataSize()); Matrix x1 = linspace(-90,90,181); Matrix y1 = linspace(-90,90,181); double* resultData = new double[y1.getDataSize() * x1.getDataSize()]; Matrix result = Matrix::fromRawData(resultData, y1.getDataSize(), x1.getDataSize()); std::vector resultTemp(181); #pragma omp parallel for for(int i=0; i<181; ++i) { Matrix y = repmat(Matrix::copyFromRawData(y1.getData() + i, 1),181,1); resultTemp[i]=interpn(x0,y0,fullSens2D,x1,y,InterpnMethod::Linear); } for(int i=0; i<181; ++i) { std::copy(resultTemp[i].getData(), resultTemp[i].getData() + resultTemp[i].getDataSize(), resultData); resultData += resultTemp[i].getDataSize(); } return result; } Matrix rotateAndTranslate(const Matrix& transMat, Matrix& aGeometryMatrix) { padding(aGeometryMatrix, aGeometryMatrix.getDataSize(), 1); Matrix out = transMat.mul(aGeometryMatrix); out.forceReshape(out.getDimSize(0) - 1, out.getDimSize(1), out.getDimSize(2)); return out; } void transformGeometry(const Matrix& aMotorPos, const Matrix& aTransformationMatrices, const Matrix aRlList, const Matrix aRnList, const Matrix aSlList, const Matrix aSnList, GeometryInfo& aOutput) { double motorPos = max(aMotorPos)[0]; size_t receiverMatrixSize = motorPos * max(aRlList)[0] * max(aRnList)[0] * 3; size_t senderMatrixSize = motorPos * max(aSlList)[0] * max(aSnList)[0] * 3; for(int m=0; m= result.maxRL) ? result.maxSL : result.maxRL; return result; }