Add transmissionReconstruction.
This commit is contained in:
@@ -25,6 +25,7 @@ GeometryBlock Recon::blockingGeometryInfos(const GeometryInfo& aGeom, const Auro
|
|||||||
sizeData[3] = aGeom.receiverPositions.size();
|
sizeData[3] = aGeom.receiverPositions.size();
|
||||||
size_t matrixSize = aGeom.receiverPositions[0].getDataSize();
|
size_t matrixSize = aGeom.receiverPositions[0].getDataSize();
|
||||||
Matrix receiverPositionsSize = Matrix::New(sizeData, 1, 4);
|
Matrix receiverPositionsSize = Matrix::New(sizeData, 1, 4);
|
||||||
|
#pragma omp parallel for
|
||||||
for(int i=0; i<dim; ++i)
|
for(int i=0; i<dim; ++i)
|
||||||
{
|
{
|
||||||
Matrix idx = sub2ind(receiverPositionsSize, {arrayOfDataSize * (i+1), aRnBlock, aRlBlock, aMpBlock});
|
Matrix idx = sub2ind(receiverPositionsSize, {arrayOfDataSize * (i+1), aRnBlock, aRlBlock, aMpBlock});
|
||||||
@@ -54,6 +55,7 @@ GeometryBlock Recon::blockingGeometryInfos(const GeometryInfo& aGeom, const Auro
|
|||||||
matrixSize = aGeom.receiverPositions[0].getDataSize();
|
matrixSize = aGeom.receiverPositions[0].getDataSize();
|
||||||
Matrix senderPositionsSize = Matrix::New(sizeData, 1, 4);
|
Matrix senderPositionsSize = Matrix::New(sizeData, 1, 4);
|
||||||
dim = aGeom.senderPositions[0].getDimSize(0);
|
dim = aGeom.senderPositions[0].getDimSize(0);
|
||||||
|
#pragma omp parallel for
|
||||||
for(int i=0; i<dim; ++i)
|
for(int i=0; i<dim; ++i)
|
||||||
{
|
{
|
||||||
Matrix idx = sub2ind(senderPositionsSize, {arrayOfDataSize * (i+1), aSnBlock, aSlBlock, aMpBlock});
|
Matrix idx = sub2ind(senderPositionsSize, {arrayOfDataSize * (i+1), aSnBlock, aSlBlock, aMpBlock});
|
||||||
|
|||||||
67
src/common/dataBlockCreation/getAScanBlockPreprocessed.cpp
Normal file
67
src/common/dataBlockCreation/getAScanBlockPreprocessed.cpp
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
#include "getAScanBlockPreprocessed.h"
|
||||||
|
|
||||||
|
#include "Matrix.h"
|
||||||
|
#include "blockingGeometryInfo.h"
|
||||||
|
#include "removeDataFromArrays.h"
|
||||||
|
#include "getAscanBlock.h"
|
||||||
|
#include "src/config/config.h"
|
||||||
|
#include "src/common/getGeometryInfo.h"
|
||||||
|
#include "src/common/preprocessAscanBlock.h"
|
||||||
|
#include "src/transmissionReconstruction/dataFilter/dataFilter.h"
|
||||||
|
#include "src/reflectionReconstruction/dataFilter.h"
|
||||||
|
|
||||||
|
using namespace Aurora;
|
||||||
|
using namespace Recon;
|
||||||
|
|
||||||
|
AscanBlockPreprocessed Recon::getAscanBlockPreprocessed(Parser* aParser, const Aurora::Matrix& aMp, const Aurora::Matrix& aSl, const Aurora::Matrix& aSn,
|
||||||
|
const Aurora::Matrix& aRl, const Aurora::Matrix& aRn, GeometryInfo& aGeom, const MeasurementInfo& aMeasInfo,
|
||||||
|
bool aApplyFilter, bool aTransReco)
|
||||||
|
{
|
||||||
|
AscanBlockPreprocessed result;
|
||||||
|
AscanBlock ascanBlock = getAscanBlock(aParser, aMp, aSl, aSn, aRl, aRn);
|
||||||
|
result.gainBlock = ascanBlock.gainBlock;
|
||||||
|
result.mpBlock = ascanBlock.mpBlock;
|
||||||
|
result.rlBlock = ascanBlock.rlBlock;
|
||||||
|
result.rnBlock = ascanBlock.rnBlock;
|
||||||
|
result.slBlock = ascanBlock.slBlock;
|
||||||
|
result.snBlock = ascanBlock.snBlock;
|
||||||
|
GeometryBlock geometryBlock = blockingGeometryInfos(aGeom, ascanBlock.rnBlock, ascanBlock.rlBlock, ascanBlock.snBlock, ascanBlock.slBlock, ascanBlock.mpBlock);
|
||||||
|
result.receiverPositionBlock = geometryBlock.receiverPositionBlock;
|
||||||
|
result.senderPositionBlock = geometryBlock.senderPositionBlock;
|
||||||
|
if(aApplyFilter)
|
||||||
|
{
|
||||||
|
Matrix usedData;
|
||||||
|
if(aTransReco)
|
||||||
|
{
|
||||||
|
usedData = filterTransmissionData(ascanBlock.slBlock, ascanBlock.snBlock, ascanBlock.rlBlock, ascanBlock.rnBlock,
|
||||||
|
aGeom.sensData, geometryBlock.senderNormalBlock, geometryBlock.receiverNormalBlock);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
usedData = filterReflectionData(geometryBlock.receiverPositionBlock, geometryBlock.senderPositionBlock, geometryBlock.senderNormalBlock, transParams::constrictReflectionAngles);
|
||||||
|
}
|
||||||
|
|
||||||
|
ascanBlock.ascanBlock = removeDataFromArrays(ascanBlock.ascanBlock, usedData);
|
||||||
|
result.mpBlock = removeDataFromArrays(ascanBlock.mpBlock, usedData);
|
||||||
|
result.slBlock = removeDataFromArrays(ascanBlock.slBlock, usedData);
|
||||||
|
result.snBlock = removeDataFromArrays(ascanBlock.snBlock, usedData);
|
||||||
|
result.rlBlock = removeDataFromArrays(ascanBlock.rlBlock, usedData);
|
||||||
|
result.rnBlock = removeDataFromArrays(ascanBlock.rnBlock, usedData);
|
||||||
|
|
||||||
|
result.senderPositionBlock = removeDataFromArrays(geometryBlock.senderPositionBlock, usedData);
|
||||||
|
result.receiverPositionBlock = removeDataFromArrays(geometryBlock.receiverPositionBlock, usedData);
|
||||||
|
result.gainBlock = removeDataFromArrays(ascanBlock.gainBlock, usedData);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ascanBlock.ascanBlock.getDataSize() > 0)
|
||||||
|
{
|
||||||
|
result.ascanBlockPreprocessed = preprocessAscanBlock(ascanBlock.ascanBlock, aMeasInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.ascanBlockPreprocessed = ascanBlock.ascanBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
31
src/common/dataBlockCreation/getAScanBlockPreprocessed.h
Normal file
31
src/common/dataBlockCreation/getAScanBlockPreprocessed.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#ifndef GETASCANBLOCK_PREPROCESSED_H
|
||||||
|
#define GETASCANBLOCK_PREPROCESSED_H
|
||||||
|
|
||||||
|
#include "Matrix.h"
|
||||||
|
#include "src/common/getGeometryInfo.h"
|
||||||
|
#include "src/common/getMeasurementMetaData.h"
|
||||||
|
|
||||||
|
class Parser;
|
||||||
|
|
||||||
|
namespace Recon
|
||||||
|
{
|
||||||
|
struct AscanBlockPreprocessed
|
||||||
|
{
|
||||||
|
Aurora::Matrix ascanBlockPreprocessed;
|
||||||
|
Aurora::Matrix mpBlock;
|
||||||
|
Aurora::Matrix slBlock;
|
||||||
|
Aurora::Matrix snBlock;
|
||||||
|
Aurora::Matrix rlBlock;
|
||||||
|
Aurora::Matrix rnBlock;
|
||||||
|
Aurora::Matrix senderPositionBlock;
|
||||||
|
Aurora::Matrix receiverPositionBlock;
|
||||||
|
Aurora::Matrix gainBlock;
|
||||||
|
};
|
||||||
|
|
||||||
|
AscanBlockPreprocessed getAscanBlockPreprocessed(Parser* aParser, const Aurora::Matrix& aMp, const Aurora::Matrix& aSl, const Aurora::Matrix& aSn,
|
||||||
|
const Aurora::Matrix& aRl, const Aurora::Matrix& aRn, GeometryInfo& aGeom, const MeasurementInfo& aMeasInfo,
|
||||||
|
bool aApplyFilter, bool aTransReco);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -11,6 +11,8 @@
|
|||||||
#include "Data/ElectricIndex.h"
|
#include "Data/ElectricIndex.h"
|
||||||
#include "Data/MetaData.h"
|
#include "Data/MetaData.h"
|
||||||
#include "ShotList/ShotList.h"
|
#include "ShotList/ShotList.h"
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using namespace Recon;
|
using namespace Recon;
|
||||||
@@ -18,12 +20,17 @@ using namespace Aurora;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
std::vector<int> findTasIndex(TasIndicesPointer aTasIndices, int aTasNum)
|
std::vector<int> findTasAndElementIndex(TasIndicesPointer aTasIndices, ReceiverIndicesPointer aReceiverIndices, const Matrix& aRl, const Matrix& aRn)
|
||||||
{
|
{
|
||||||
std::vector<int> result;
|
std::vector<int> result;
|
||||||
|
Matrix sortRl = Matrix::copyFromRawData(aRl.getData(), aRl.getDimSize(0), aRl.getDimSize(1), aRl.getDimSize(2));
|
||||||
|
Matrix sortRn = Matrix::copyFromRawData(aRn.getData(), aRn.getDimSize(0), aRn.getDimSize(1), aRn.getDimSize(2));
|
||||||
|
std::sort(sortRl.getData(), sortRl.getData() + sortRl.getDataSize());
|
||||||
|
std::sort(sortRn.getData(), sortRn.getData() + sortRn.getDataSize());
|
||||||
for(int i=0; i<aTasIndices.getLength(); ++i)
|
for(int i=0; i<aTasIndices.getLength(); ++i)
|
||||||
{
|
{
|
||||||
if (aTasIndices.get()[i] == aTasNum)
|
if (std::binary_search(sortRl.getData(), sortRl.getData() + sortRl.getDataSize(), aTasIndices.get()[i]) &&
|
||||||
|
std::binary_search(sortRn.getData(), sortRn.getData() + sortRn.getDataSize(), aReceiverIndices.get()[i]) )
|
||||||
{
|
{
|
||||||
result.push_back(i);
|
result.push_back(i);
|
||||||
}
|
}
|
||||||
@@ -37,8 +44,8 @@ AscanBlock Recon::getAscanBlock(Parser* aParser, const Aurora::Matrix& aMp, cons
|
|||||||
const Aurora::Matrix& aRl, const Aurora::Matrix& aRn)
|
const Aurora::Matrix& aRl, const Aurora::Matrix& aRn)
|
||||||
{
|
{
|
||||||
AscanBlock result;
|
AscanBlock result;
|
||||||
int numScans = aMp.getDataSize() * aSl.getDataSize() * aSn.getDataSize() * aRl.getDataSize() * aRn.getDataSize();
|
size_t numScans = aMp.getDataSize() * aSl.getDataSize() * aSn.getDataSize() * aRl.getDataSize() * aRn.getDataSize();
|
||||||
int numScansIndex = 0;
|
//size_t numScansIndex = 0;
|
||||||
int ascanBlockSize = numScans * aParser->getMetaData().getSampleNumber();
|
int ascanBlockSize = numScans * aParser->getMetaData().getSampleNumber();
|
||||||
double* ascanBlockData = new double[ascanBlockSize];
|
double* ascanBlockData = new double[ascanBlockSize];
|
||||||
double* mpBlockData = new double[numScans];
|
double* mpBlockData = new double[numScans];
|
||||||
@@ -57,30 +64,39 @@ AscanBlock Recon::getAscanBlock(Parser* aParser, const Aurora::Matrix& aMp, cons
|
|||||||
OneTasAScanData oenTasData = aParser->getOneTasAscanDataOfMotorPosition(1);
|
OneTasAScanData oenTasData = aParser->getOneTasAscanDataOfMotorPosition(1);
|
||||||
auto tasIndices = aParser->getMetaData().getTasIndices();
|
auto tasIndices = aParser->getMetaData().getTasIndices();
|
||||||
auto receiverIndices = aParser->getMetaData().getReceiverIndices();
|
auto receiverIndices = aParser->getMetaData().getReceiverIndices();
|
||||||
|
auto tasElementMapper = findTasAndElementIndex(tasIndices, receiverIndices, aRl, aRn);
|
||||||
|
|
||||||
for(int mpIndex=0; mpIndex<aMp.getDataSize();++mpIndex)
|
for(int mpIndex=0; mpIndex<aMp.getDataSize();++mpIndex)
|
||||||
{
|
{
|
||||||
for(int slIndex=0; slIndex<aSl.getDataSize();++slIndex)
|
for(int slIndex=0; slIndex<aSl.getDataSize();++slIndex)
|
||||||
{
|
{
|
||||||
OneTasAScanData oenTasData = aParser->getOneTasAscanDataOfMotorPosition(aSl[slIndex]);
|
OneTasAScanData oenTasData = aParser->getOneTasAscanDataOfMotorPosition(aSl[slIndex]);
|
||||||
|
|
||||||
for(int snIndex=0; snIndex<aSn.getDataSize();++snIndex)
|
for(int snIndex=0; snIndex<aSn.getDataSize();++snIndex)
|
||||||
{
|
{
|
||||||
|
//int mapperIndex = 0;
|
||||||
|
#pragma omp parallel for
|
||||||
for(int rlIndex=0; rlIndex<aRl.getDataSize();++rlIndex)
|
for(int rlIndex=0; rlIndex<aRl.getDataSize();++rlIndex)
|
||||||
{
|
{
|
||||||
auto rElementIndex = findTasIndex(tasIndices, aRl[rlIndex]);
|
for(int rnIndex=0; rnIndex<aRn.getDataSize(); ++rnIndex)
|
||||||
for(int rnIndex=0; rnIndex<rElementIndex.size(); ++rnIndex)
|
|
||||||
{
|
{
|
||||||
|
size_t mapperIndex = rnIndex + rlIndex*aRn.getDataSize();
|
||||||
|
size_t numScansIndex = rnIndex + rlIndex*aRn.getDataSize() + snIndex * aRl.getDataSize() * aRn.getDataSize() +
|
||||||
|
slIndex * aRl.getDataSize() * aRn.getDataSize() * aSn.getDataSize() +
|
||||||
|
mpIndex * aRl.getDataSize() * aRn.getDataSize() * aSn.getDataSize() * aSl.getDataSize();
|
||||||
MotorPosition mp = aMp[mpIndex] == 1 ? MotorPosition::MotorPosition1 : MotorPosition::MotorPosition2;
|
MotorPosition mp = aMp[mpIndex] == 1 ? MotorPosition::MotorPosition1 : MotorPosition::MotorPosition2;
|
||||||
AScanData ascan = aParser->searchAscanDataFromOneTasAscanDataOfMP(oenTasData, ElementIndex(GeometryIndex(aSn[snIndex])), TasElementIndex(aRl[rlIndex], ElementIndex(GeometryIndex(receiverIndices.get()[rElementIndex[rnIndex]]))), mp);
|
AScanData ascan = aParser->searchAscanDataFromOneTasAscanDataOfMP(oenTasData, ElementIndex(GeometryIndex(aSn[snIndex])), TasElementIndex(tasIndices.get()[tasElementMapper[mapperIndex]], ElementIndex(GeometryIndex(receiverIndices.get()[tasElementMapper[mapperIndex]]))), mp);
|
||||||
std::copy(ascan.get() ,ascan.get() + ascan.getAscanDataLength(), ascanBlockData);
|
double* startPointer = ascanBlockData + numScansIndex * ascan.getAscanDataLength();
|
||||||
ascanBlockData += ascan.getAscanDataLength();
|
std::copy(ascan.get() ,ascan.get() + ascan.getAscanDataLength(), startPointer);
|
||||||
|
//ascanBlockData += ascan.getAscanDataLength();
|
||||||
mpBlockData[numScansIndex] = aMp[mpIndex];
|
mpBlockData[numScansIndex] = aMp[mpIndex];
|
||||||
slBlockData[numScansIndex] = aSl[slIndex];
|
slBlockData[numScansIndex] = aSl[slIndex];
|
||||||
snBlockData[numScansIndex] = aSn[snIndex];
|
snBlockData[numScansIndex] = aSn[snIndex];
|
||||||
rlBlockData[numScansIndex] = aRl[rlIndex];
|
rlBlockData[numScansIndex] = tasIndices.get()[tasElementMapper[mapperIndex]];
|
||||||
rnBlockData[numScansIndex] = receiverIndices.get()[rElementIndex[rnIndex]];
|
rnBlockData[numScansIndex] = receiverIndices.get()[tasElementMapper[mapperIndex]];
|
||||||
gainBlockData[numScansIndex] = ascan.getAmplification()[0];
|
gainBlockData[numScansIndex] = ascan.getAmplification()[0];
|
||||||
++numScansIndex;
|
//++numScansIndex;
|
||||||
|
//++mapperIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
49
src/common/precalculateChannelList.cpp
Normal file
49
src/common/precalculateChannelList.cpp
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#include "precalculateChannelList.h"
|
||||||
|
#include "Function.h"
|
||||||
|
#include "Matrix.h"
|
||||||
|
|
||||||
|
using namespace Aurora;
|
||||||
|
using namespace Recon;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
double USCTTAS2DAQChannels(double aRl, double aRn, const MeasurementInfo& aExpInfo, const PreComputes& aPreComputes)
|
||||||
|
{
|
||||||
|
size_t size = aPreComputes.measuredCE_receiverIndices.getDataSize();
|
||||||
|
if(aExpInfo.Hardware == "USCT3dv2")
|
||||||
|
{
|
||||||
|
//暂不实现
|
||||||
|
}
|
||||||
|
else if(aExpInfo.Hardware == "USCT3dv3")
|
||||||
|
{
|
||||||
|
if (aPreComputes.measuredCEUsed == 1)
|
||||||
|
{
|
||||||
|
for(int i=0; i<size; ++i)
|
||||||
|
{
|
||||||
|
if(aPreComputes.measuredCE_TASIndices[i] == aRl && aPreComputes.measuredCE_receiverIndices[i] == aRn)
|
||||||
|
{
|
||||||
|
return i+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Aurora::Matrix Recon::precalculateChannelList(const Aurora::Matrix& aRlList, const Aurora::Matrix& aRnList,
|
||||||
|
const MeasurementInfo& aExpInfo, const PreComputes& aPreComputes)
|
||||||
|
{
|
||||||
|
int rows = aRlList.getDataSize();
|
||||||
|
int columns = aRnList.getDataSize();
|
||||||
|
double* resultData = Aurora::malloc(rows * columns);
|
||||||
|
for(int i=0; i<columns; ++i)
|
||||||
|
{
|
||||||
|
for(int j=0; j<rows; ++j)
|
||||||
|
{
|
||||||
|
resultData[i*rows + j] = USCTTAS2DAQChannels(aRlList[j], aRnList[i], aExpInfo, aPreComputes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Matrix::New(resultData, rows, columns);
|
||||||
|
}
|
||||||
13
src/common/precalculateChannelList.h
Normal file
13
src/common/precalculateChannelList.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#ifndef PRECALCULATE_CHANNELLIST_H
|
||||||
|
#define PRECALCULATE_CHANNELLIST_H
|
||||||
|
|
||||||
|
#include "Matrix.h"
|
||||||
|
#include "src/common/getMeasurementMetaData.h"
|
||||||
|
|
||||||
|
namespace Recon
|
||||||
|
{
|
||||||
|
Aurora::Matrix precalculateChannelList(const Aurora::Matrix& aRlList, const Aurora::Matrix& aRnList,
|
||||||
|
const MeasurementInfo& aExpInfo, const PreComputes& aPreComputes);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
22
src/common/preprocessAscanBlock.cpp
Normal file
22
src/common/preprocessAscanBlock.cpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include "preprocessAscanBlock.h"
|
||||||
|
#include "Function1D.h"
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
Aurora::Matrix Recon::preprocessAscanBlock(const Aurora::Matrix& aAscans, const MeasurementInfo& aMeasInfo)
|
||||||
|
{
|
||||||
|
Aurora::Matrix result = aAscans;
|
||||||
|
size_t size = aAscans.getDataSize();
|
||||||
|
short* ascanData = new short[size];
|
||||||
|
std::copy(aAscans.getData(), aAscans.getData() + size, ascanData);
|
||||||
|
if(aMeasInfo.ascanDataType == "float16")
|
||||||
|
{
|
||||||
|
result = Aurora::convertfp16tofloat(ascanData, aAscans.getDimSize(0), aAscans.getDimSize(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
//暂不考虑实现二代逻辑
|
||||||
|
// if isfield(measInfo, 'Bandpassundersampling') && (measInfo.Bandpassundersampling == 1)
|
||||||
|
// AScans = reconstructBandpasssubsampling(AScans, params.aScanReconstructionFrequency, measInfo.SampleRate);
|
||||||
|
// end
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
12
src/common/preprocessAscanBlock.h
Normal file
12
src/common/preprocessAscanBlock.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef PREPROCESS_ASCANBLOCK_H
|
||||||
|
#define PREPROCESS_ASCANBLOCK_H
|
||||||
|
|
||||||
|
#include "Matrix.h"
|
||||||
|
#include "getMeasurementMetaData.h"
|
||||||
|
|
||||||
|
namespace Recon
|
||||||
|
{
|
||||||
|
Aurora::Matrix preprocessAscanBlock(const Aurora::Matrix& aAscans, const MeasurementInfo& aMeasInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
11
src/common/qualityReview.cpp
Normal file
11
src/common/qualityReview.cpp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#include "qualityReview.h"
|
||||||
|
#include "Matrix.h"
|
||||||
|
|
||||||
|
using namespace Recon;
|
||||||
|
using namespace Aurora;
|
||||||
|
|
||||||
|
void Recon::qualityReview(double aNumValiData, double aNumTotalData)
|
||||||
|
{
|
||||||
|
double score = aNumValiData / aNumTotalData;
|
||||||
|
//to do, 输出报警用
|
||||||
|
}
|
||||||
11
src/common/qualityReview.h
Normal file
11
src/common/qualityReview.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef QUALITY_REVIEW_H
|
||||||
|
#define QUALITY_REVIEW_H
|
||||||
|
|
||||||
|
#include "Matrix.h"
|
||||||
|
|
||||||
|
namespace Recon
|
||||||
|
{
|
||||||
|
void qualityReview(double aNumValiData, double aNumTotalData);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -25,7 +25,7 @@ namespace
|
|||||||
{
|
{
|
||||||
if(aReferenceTemps.getDimSize(1) >= aMotorPos)
|
if(aReferenceTemps.getDimSize(1) >= aMotorPos)
|
||||||
{
|
{
|
||||||
result = mean(aReferenceTemps($,aMotorPos).toMatrix(), FunctionDirection::All, false)[0];
|
result = mean(aReferenceTemps($,aMotorPos - 1).toMatrix(), FunctionDirection::All, false)[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -61,6 +61,5 @@ Matrix Recon::extractTasTemperature(const Matrix& aTasTemperature, const Matrix&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Matrix result = Matrix::New(resultData, aTasList.getDataSize(), aMotorPosList.getDataSize());
|
Matrix result = Matrix::New(resultData, aTasList.getDataSize(), aMotorPosList.getDataSize());
|
||||||
result.printf();
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
215
src/startReconstructions.cpp
Normal file
215
src/startReconstructions.cpp
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
#include "startReconstructions.h"
|
||||||
|
#include "Data/TemperatureData.h"
|
||||||
|
#include "Function.h"
|
||||||
|
#include "config/config.h"
|
||||||
|
#include "common/getMeasurementMetaData.h"
|
||||||
|
#include "common/getGeometryInfo.h"
|
||||||
|
#include "common/estimatePulseLength.h"
|
||||||
|
#include "transmissionReconstruction/startTransmissionReconstruction.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include "Parser/Parser.h"
|
||||||
|
#include "Parser/Data/MetaData.h"
|
||||||
|
|
||||||
|
#include "Matrix.h"
|
||||||
|
#include "Function1D.h"
|
||||||
|
#include "Function2D.h"
|
||||||
|
#include "src/common/ceMatchedFilterHandling.h"
|
||||||
|
#include "src/reflectionReconstruction/preprocessData/estimateOffset.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace Recon;
|
||||||
|
using namespace Aurora;
|
||||||
|
|
||||||
|
void Recon::startReconstructions()
|
||||||
|
{
|
||||||
|
// std::string dataPath = "/home/AScans_Data/volunteer_20230328/20230328T123237/";
|
||||||
|
// std::string refPath = "/home/AScans_Data/volunteer_20230328/20230328T123237/";
|
||||||
|
std::string dataPath = "/home/AScans_Data/ADW_TAS_Issue/20230512T135108/";
|
||||||
|
std::string refPath = "/home/AScans_Data/ADW_TAS_Issue/20230512T141626/";
|
||||||
|
std::string outputPath;
|
||||||
|
Parser dataParser(dataPath);
|
||||||
|
Parser refParser(refPath);
|
||||||
|
std::string rootMeasUniqueID = dataParser.getMetaData().getMeasurementID();
|
||||||
|
std::string rootRefUniqueID = refParser.getMetaData().getMeasurementID();
|
||||||
|
|
||||||
|
//init total used receiver/emitter/motorPos
|
||||||
|
Matrix motorPosTotal, slList, snList, rlList, rnList;
|
||||||
|
if(transParams::runTransmissionReco && reflectParams::runReflectionReco)
|
||||||
|
{
|
||||||
|
motorPosTotal = auroraUnion(reflectParams::motorPos, transParams::motorPos);
|
||||||
|
slList = auroraUnion(reflectParams::senderTasList, transParams::senderTasList);
|
||||||
|
snList = auroraUnion(reflectParams::senderElementList, transParams::senderElementList);
|
||||||
|
rlList = auroraUnion(reflectParams::receiverTasList, transParams::receiverTasList);
|
||||||
|
rnList = auroraUnion(reflectParams::receiverElementList, transParams::receiverElementList);
|
||||||
|
}
|
||||||
|
else if(reflectParams::runReflectionReco)
|
||||||
|
{
|
||||||
|
motorPosTotal = reflectParams::motorPos;
|
||||||
|
slList = reflectParams::senderTasList;
|
||||||
|
snList = reflectParams::senderElementList;
|
||||||
|
rlList = reflectParams::receiverTasList;
|
||||||
|
rnList = reflectParams::receiverElementList;
|
||||||
|
}
|
||||||
|
else if(transParams::runTransmissionReco)
|
||||||
|
{
|
||||||
|
motorPosTotal = transParams::motorPos;
|
||||||
|
slList = transParams::senderTasList;
|
||||||
|
snList = transParams::senderElementList;
|
||||||
|
rlList = transParams::receiverTasList;
|
||||||
|
rnList = transParams::receiverElementList;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//getMeasurementMetaData
|
||||||
|
double maxNumTAS = max(auroraUnion(slList, rlList)).getData()[0];
|
||||||
|
MeasurementInfo expInfo = loadMeasurementInfos(&dataParser);
|
||||||
|
TempInfo temp = getTemperatureInfo(&dataParser, maxNumTAS);
|
||||||
|
CEInfo ce = getCEInfo(&dataParser, expInfo);
|
||||||
|
TransFormInfo transformationInfo = getTransformationMatrix(&dataParser, motorPosTotal);
|
||||||
|
Matrix transformationMatrices = transformationInfo.rotationMatrix;
|
||||||
|
Matrix motorPosAvailable = transformationInfo.motorPos;
|
||||||
|
|
||||||
|
Matrix motorPosAvailableRef;
|
||||||
|
MeasurementInfo expInfoRef;
|
||||||
|
TempInfo tempRef;
|
||||||
|
CEInfo ceRef;
|
||||||
|
Matrix transformationMatricesRef;
|
||||||
|
if(transParams::runTransmissionReco)
|
||||||
|
{
|
||||||
|
expInfoRef = loadMeasurementInfos(&refParser);
|
||||||
|
tempRef = getTemperatureInfo(&refParser, maxNumTAS);
|
||||||
|
ceRef = getCEInfo(&refParser, expInfoRef);
|
||||||
|
transformationInfo = getTransformationMatrix(&refParser, motorPosTotal);
|
||||||
|
transformationMatricesRef = transformationInfo.rotationMatrix;
|
||||||
|
motorPosAvailableRef = transformationInfo.motorPos;
|
||||||
|
if(transformationMatricesRef.isNull())
|
||||||
|
{
|
||||||
|
Matrix motorPos1 = Matrix::fromRawData(new double[1] {1}, 1);
|
||||||
|
transformationMatricesRef = getTransformationMatrix(&refParser, motorPos1).rotationMatrix;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Matrix mpRef_inter = intersect(motorPosAvailableRef, transParams::motorPos);
|
||||||
|
//extractMatchingReferenceMotorPosition
|
||||||
|
for(int i=0; i<motorPosAvailable.getDimSize(0); ++i)
|
||||||
|
{
|
||||||
|
if (sum(mpRef_inter == motorPosAvailable.getData()[i],FunctionDirection::All).getData()[0] == 0)
|
||||||
|
{
|
||||||
|
motorPosAvailableRef.getData()[i] = max(mpRef_inter).getData()[0];
|
||||||
|
int a = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
transformationMatricesRef = Matrix();
|
||||||
|
motorPosAvailableRef = Matrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix isEqual = (ce.ceRef == ceRef.ceRef);
|
||||||
|
if (sum(isEqual, FunctionDirection::All).getData()[0] == isEqual.getDataSize())
|
||||||
|
{
|
||||||
|
std::cout<<"CEs are not equal"<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!ce.ce.isNull() && !ceRef.ce.isNull())
|
||||||
|
{
|
||||||
|
isEqual = (ce.ce == ceRef.ce);
|
||||||
|
if (sum(isEqual, FunctionDirection::All).getData()[0] == isEqual.getDataSize())
|
||||||
|
{
|
||||||
|
std::cout<<"CEs are not equal."<<std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout<<"CEs is null matrix."<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
GeometryInfo geom = getGeometryInfo(motorPosAvailable, transformationMatrices, rlList, rnList, slList, snList);
|
||||||
|
PreComputes preComputes;
|
||||||
|
if((reflectParams::matchedFilterCeAScan && reflectParams::runReflectionReco) || transParams::runTransmissionReco)
|
||||||
|
{
|
||||||
|
if(ce.measuredCEUsed)
|
||||||
|
{
|
||||||
|
preComputes.matchedFilter = createMatchedFilter(ce.ce, ce.measuredCEUsed, reflectParams::findDefects, reconParams::removeOutliersFromCEMeasured, expInfo.Hardware);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
preComputes.matchedFilter = createMatchedFilter(ce.ceRef, ce.measuredCEUsed, reflectParams::findDefects, reconParams::removeOutliersFromCEMeasured, expInfo.Hardware);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(expInfo.sampleRate != reflectParams::aScanReconstructionFrequency)
|
||||||
|
{
|
||||||
|
reflectParams::expectedAScanDataLength = ceil(expInfo.numberSamples * ((double)reflectParams::aScanReconstructionFrequency / expInfo.sampleRate));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(transParams::runTransmissionReco)
|
||||||
|
{
|
||||||
|
if(ceRef.measuredCEUsed)
|
||||||
|
{
|
||||||
|
preComputes.matchedFilterRef = createMatchedFilter(ceRef.ce, ceRef.measuredCEUsed, reflectParams::findDefects, reconParams::removeOutliersFromCEMeasured, expInfo.Hardware);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
preComputes.matchedFilterRef = createMatchedFilter(ceRef.ceRef, ceRef.measuredCEUsed, reflectParams::findDefects, reconParams::removeOutliersFromCEMeasured, expInfo.Hardware);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
preComputes.timeInterval = (double)1 / reflectParams::aScanReconstructionFrequency;
|
||||||
|
preComputes.measuredCEUsed = ce.measuredCEUsed;
|
||||||
|
preComputes.measuredCE_TASIndices = ce.tasIndices;
|
||||||
|
preComputes.measuredCE_receiverIndices = ce.receiverIndices;
|
||||||
|
preComputes.offset = estimateOffset(expInfo, ce, preComputes.matchedFilter);
|
||||||
|
|
||||||
|
expInfo.matchedFilter = preComputes.matchedFilter;
|
||||||
|
expInfoRef.matchedFilter = preComputes.matchedFilterRef;
|
||||||
|
|
||||||
|
CeEstimatePulseLength ceEstimatePulseLength;
|
||||||
|
CeEstimatePulseLength ceEstimatePulseLengthRef;
|
||||||
|
if(ce.measuredCEUsed)
|
||||||
|
{
|
||||||
|
ceEstimatePulseLength.ce = mean(ce.ce, FunctionDirection::Row);
|
||||||
|
ceEstimatePulseLengthRef.ce = mean(ce.ce, FunctionDirection::Row);
|
||||||
|
ceEstimatePulseLength.ce_sf = reflectParams::aScanReconstructionFrequency;
|
||||||
|
ceEstimatePulseLengthRef.ce_sf = reflectParams::aScanReconstructionFrequency;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ceEstimatePulseLength.ce = ce.ceRef;
|
||||||
|
ceEstimatePulseLengthRef.ce = ceRef.ceRef;
|
||||||
|
ceEstimatePulseLength.ce_sf = reflectParams::aScanReconstructionFrequency;
|
||||||
|
ceEstimatePulseLengthRef.ce_sf = reflectParams::aScanReconstructionFrequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
transParams::pulseLengthSamples = estimatePulseLength(ceEstimatePulseLength, reflectParams::aScanReconstructionFrequency);
|
||||||
|
transParams::pulseLengthRefSamples = estimatePulseLength(ceEstimatePulseLengthRef, reflectParams::aScanReconstructionFrequency);
|
||||||
|
|
||||||
|
Matrix iMp;
|
||||||
|
Matrix mp_inter = intersect(motorPosAvailable, transParams::motorPos, iMp);
|
||||||
|
double* mpRef_interData = Aurora::malloc(iMp.getDataSize());
|
||||||
|
for(int i=0; i<iMp.getDataSize(); ++i)
|
||||||
|
{
|
||||||
|
mpRef_interData[i] = motorPosAvailableRef[iMp[i] - 1];
|
||||||
|
}
|
||||||
|
Matrix mpRef_inter = Matrix::New(mpRef_interData, iMp.getDataSize());
|
||||||
|
Matrix slList_inter = intersect(slList, transParams::senderTasList);
|
||||||
|
Matrix snList_inter = intersect(snList, transParams::senderElementList);
|
||||||
|
Matrix rlList_inter = intersect(rlList, transParams::receiverTasList);
|
||||||
|
Matrix rnList_inter = intersect(rnList, transParams::receiverElementList);
|
||||||
|
|
||||||
|
transParams::aScanReconstructionFrequency = reflectParams::aScanReconstructionFrequency;
|
||||||
|
transParams::gpuSelectionList = reconParams::gpuSelectionList;
|
||||||
|
|
||||||
|
GeometryInfo geomRef = getGeometryInfo(motorPosAvailableRef, transformationMatricesRef, rlList, rnList, slList, snList);
|
||||||
|
|
||||||
|
startTransmissionReconstruction(mp_inter, mpRef_inter, slList_inter, snList_inter, rlList_inter, rnList_inter, temp, tempRef, geom, geomRef, expInfo, expInfoRef, preComputes, &dataParser, &refParser);
|
||||||
|
}
|
||||||
9
src/startReconstructions.h
Normal file
9
src/startReconstructions.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#ifndef START_RECONSTRUCTIONS_H
|
||||||
|
#define START_RECONSTRUCTIONS_H
|
||||||
|
|
||||||
|
namespace Recon
|
||||||
|
{
|
||||||
|
void startReconstructions();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#include "estimateNoiseValueFromAScans.h"
|
||||||
|
#include "src/common/dataBlockCreation/getAScanBlockPreprocessed.h"
|
||||||
|
#include "src/config/config.h"
|
||||||
|
|
||||||
|
#include "Function2D.h"
|
||||||
|
|
||||||
|
using namespace Aurora;
|
||||||
|
using namespace Recon;
|
||||||
|
|
||||||
|
Matrix Recon::estimateNoiseValueFromAScans(Aurora::Matrix aSn, Aurora::Matrix aRn, GeometryInfo& aGeo, const MeasurementInfo& aMesInfo, Parser* aParser)
|
||||||
|
{
|
||||||
|
auto ascanBlockPreprocessed = getAscanBlockPreprocessed(aParser, transParams::calibReferenceMotorPosition, transParams::calibReferenceTas, aSn, transParams::calibReferenceTas, aRn, aGeo, aMesInfo, false, false);
|
||||||
|
Matrix referenceAScansForNoiseEstimation = ascanBlockPreprocessed.ascanBlockPreprocessed / repmat(ascanBlockPreprocessed.gainBlock, ascanBlockPreprocessed.ascanBlockPreprocessed.getDimSize(0), 1);
|
||||||
|
referenceAScansForNoiseEstimation = referenceAScansForNoiseEstimation - repmat(mean(referenceAScansForNoiseEstimation, FunctionDirection::Column),referenceAScansForNoiseEstimation.getDimSize(0),1);
|
||||||
|
referenceAScansForNoiseEstimation = mean(referenceAScansForNoiseEstimation, FunctionDirection::Row);
|
||||||
|
|
||||||
|
return max(abs(referenceAScansForNoiseEstimation));
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#ifndef ESTIMATENOISEVALUE_FROM_ASCAN_H
|
||||||
|
#define ESTIMATENOISEVALUE_FROM_ASCAN_H
|
||||||
|
|
||||||
|
#include "Matrix.h"
|
||||||
|
#include "src/common/getGeometryInfo.h"
|
||||||
|
#include "src/common/getMeasurementMetaData.h"
|
||||||
|
|
||||||
|
class Parser;
|
||||||
|
|
||||||
|
namespace Recon
|
||||||
|
{
|
||||||
|
Aurora::Matrix estimateNoiseValueFromAScans(Aurora::Matrix aSn, Aurora::Matrix aRn, GeometryInfo& aGeo, const MeasurementInfo& aMesInfo, Parser* aParser);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,21 +1,189 @@
|
|||||||
#include "getTransmissionData.h"
|
#include "getTransmissionData.h"
|
||||||
#include "../../config/config.h"
|
#include "Function.h"
|
||||||
|
#include "Function1D.h"
|
||||||
|
#include "Function2D.h"
|
||||||
|
#include "common/dataBlockCreation/removeDataFromArrays.h"
|
||||||
|
#include "src//config/config.h"
|
||||||
|
#include "src/common/getGeometryInfo.h"
|
||||||
#include "src/common/temperatureCalculation/extractTasTemperature.h"
|
#include "src/common/temperatureCalculation/extractTasTemperature.h"
|
||||||
|
#include "src/common/dataBlockCreation/getAScanBlockPreprocessed.h"
|
||||||
|
#include "src/common/precalculateChannelList.h"
|
||||||
#include "src/transmissionReconstruction/dataFilter/sensitivityCalculations.h"
|
#include "src/transmissionReconstruction/dataFilter/sensitivityCalculations.h"
|
||||||
|
#include "src/transmissionReconstruction/dataFilter/estimateNoiseValueFromAScans.h"
|
||||||
|
|
||||||
#include "Matrix.h"
|
#include "Matrix.h"
|
||||||
|
#include "Function3D.h"
|
||||||
|
#include "transmissionReconstruction/dataFilter/dataFilter.h"
|
||||||
|
#include "transmissionReconstruction/dataPreperation.h"
|
||||||
|
#include "transmissionReconstruction/detection/detection.h"
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <mkl_cblas.h>
|
||||||
|
|
||||||
|
#include "MatlabReader.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <mkl_vml_functions.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
using namespace Recon;
|
using namespace Recon;
|
||||||
using namespace Aurora;
|
using namespace Aurora;
|
||||||
|
|
||||||
void Recon::getTransmissionData(const Aurora::Matrix& aMotorPos, const Aurora::Matrix& aMotoPosRef, const Aurora::Matrix& aSlList,
|
namespace
|
||||||
|
{
|
||||||
|
struct BlockOfTransmissionData
|
||||||
|
{
|
||||||
|
Matrix tofData;
|
||||||
|
Matrix attData;
|
||||||
|
Matrix senderBlock;
|
||||||
|
Matrix receiverBlock;
|
||||||
|
Matrix waterTempBlock;
|
||||||
|
MetaInfos metaInfos;
|
||||||
|
};
|
||||||
|
|
||||||
|
Matrix prepareAScansForTransmissionDetection(const Matrix& aAscanBlock, const Matrix& aGainBlock)
|
||||||
|
{
|
||||||
|
Matrix result = aAscanBlock / repmat(aGainBlock, aAscanBlock.getDimSize(0), 1);
|
||||||
|
result = result - repmat(mean(result,FunctionDirection::Column), result.getDimSize(0), 1);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockOfTransmissionData getBlockOfTransmissionData(const Matrix& aMp, const Matrix& aMpRef, const Matrix& aSl, const Matrix& aSn, const Matrix& aRlList, const Matrix& aRnList,
|
||||||
|
const TasTemps& aTasTemps, const Matrix& aExpectedSOSWater, GeometryInfo aGeom, GeometryInfo& aGeomRef,
|
||||||
|
const Matrix& aSnrRmsNoise, const Matrix& aSnrRmsNoiseRef, const MeasurementInfo& aExpInfo, const MeasurementInfo& aExpInfoRef,
|
||||||
|
const PreComputes& aPreComputes, Parser* aParser, Parser* aParserRef)
|
||||||
|
{
|
||||||
|
BlockOfTransmissionData result;
|
||||||
|
MetaInfos metaInfos;
|
||||||
|
auto blockData = getAscanBlockPreprocessed(aParser, aMp, aSl, aSn, aRlList, aRnList, aGeom, aExpInfo, true, true);
|
||||||
|
auto blockDataRef = getAscanBlockPreprocessed(aParserRef, aMpRef, aSl, aSn, aRlList, aRnList, aGeomRef, aExpInfoRef, true, true);
|
||||||
|
Matrix ascanBlock = prepareAScansForTransmissionDetection(blockData.ascanBlockPreprocessed, blockData.gainBlock);
|
||||||
|
Matrix ascanBlockRef = prepareAScansForTransmissionDetection(blockDataRef.ascanBlockPreprocessed, blockDataRef.gainBlock);
|
||||||
|
if(aExpInfo.Hardware == "USCT3dv3")
|
||||||
|
{
|
||||||
|
Matrix channelList = precalculateChannelList(aRlList, aRnList, aExpInfo, aPreComputes);
|
||||||
|
double* channelListSizeData = Aurora::malloc(2);
|
||||||
|
channelListSizeData[0] = channelList.getDimSize(0);
|
||||||
|
channelListSizeData[1] = channelList.getDimSize(1);
|
||||||
|
Matrix channelListSize = Matrix::New(channelListSizeData, 2, 1);
|
||||||
|
Matrix ind = sub2ind(channelListSize, {blockData.rlBlock, blockData.rnBlock});
|
||||||
|
size_t channelListBlockSize = ind.getDataSize();
|
||||||
|
double* channelListBlockData = Aurora::malloc(channelListBlockSize);
|
||||||
|
for(size_t i=0; i<channelListBlockSize; ++i)
|
||||||
|
{
|
||||||
|
channelListBlockData[i] = channelList[ind[i] - 1];
|
||||||
|
}
|
||||||
|
Matrix channelListBlock = Matrix::New(channelListBlockData, 1, channelListBlockSize);
|
||||||
|
Matrix fx = fft(ascanBlock);
|
||||||
|
double* fhData = Aurora::malloc(aExpInfo.matchedFilter.getDimSize(0) * channelListBlockSize, true);
|
||||||
|
Matrix fh = Matrix::New(fhData, aExpInfo.matchedFilter.getDimSize(0), channelListBlockSize, 1, Aurora::Complex);
|
||||||
|
size_t matchedFilterRowDataSize = aExpInfo.matchedFilter.getDimSize(0)*2;
|
||||||
|
for(size_t i=0; i<channelListBlockSize; ++i)
|
||||||
|
{
|
||||||
|
cblas_dcopy(matchedFilterRowDataSize, aExpInfo.matchedFilter.getData() + (size_t)(channelListBlock[i] - 1) * matchedFilterRowDataSize, 1 , fhData ,1);
|
||||||
|
fhData += matchedFilterRowDataSize;
|
||||||
|
}
|
||||||
|
// Matrix fxReal = Aurora::real(fx);
|
||||||
|
// Matrix fhReal = Aurora::real(fh);
|
||||||
|
// Matrix fxImag = Aurora::imag(fx);
|
||||||
|
// Matrix fhImag = Aurora::imag(fh);
|
||||||
|
// Matrix real = fxReal * fhReal + fxImag * fhImag;
|
||||||
|
// Matrix image = fxImag * fhReal - fxReal * fhImag;
|
||||||
|
double* value1 = Aurora::malloc(fx.getDataSize());
|
||||||
|
vdMulI(fx.getDataSize(), fx.getData(), 2, fh.getData(), 2, value1, 1);
|
||||||
|
double* value2 = Aurora::malloc(fx.getDataSize());
|
||||||
|
vdMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData() + 1, 2, value2, 1);
|
||||||
|
double* realData = Aurora::malloc(fx.getDataSize());
|
||||||
|
vdAdd(fx.getDataSize(), value1, value2, realData);
|
||||||
|
Matrix real = Matrix::New(realData, fx.getDimSize(0), fx.getDimSize(1));
|
||||||
|
|
||||||
|
vdMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData(), 2, value1, 1);
|
||||||
|
vdMulI(fx.getDataSize(), fx.getData(), 2, fh.getData() + 1, 2, value2, 1);
|
||||||
|
double* imagData = Aurora::malloc(fx.getDataSize());
|
||||||
|
vdSub(fx.getDataSize(), value1, value2, imagData);
|
||||||
|
Matrix image = Matrix::New(imagData, fx.getDimSize(0), fx.getDimSize(1));
|
||||||
|
|
||||||
|
double* complexData = Aurora::malloc(real.getDataSize(), true);
|
||||||
|
cblas_dcopy(real.getDataSize(), real.getData(), 1 , complexData ,2);
|
||||||
|
cblas_dcopy(image.getDataSize(), image.getData(), 1 , complexData + 1 ,2);
|
||||||
|
Matrix complex = Matrix::New(complexData, real.getDimSize(0), real.getDimSize(1), 1, Aurora::Complex);
|
||||||
|
ascanBlock = Aurora::real(ifft(complex));
|
||||||
|
|
||||||
|
fx = fft(ascanBlockRef);
|
||||||
|
fhData = Aurora::malloc(aExpInfoRef.matchedFilter.getDimSize(0) * channelListBlockSize, true);
|
||||||
|
fh = Matrix::New(fhData, aExpInfoRef.matchedFilter.getDimSize(0), channelListBlockSize, 1, Aurora::Complex);
|
||||||
|
matchedFilterRowDataSize = aExpInfoRef.matchedFilter.getDimSize(0)*2;
|
||||||
|
for(size_t i=0; i<channelListBlockSize; ++i)
|
||||||
|
{
|
||||||
|
cblas_dcopy(matchedFilterRowDataSize, aExpInfoRef.matchedFilter.getData() + (size_t)(channelListBlock[i] - 1) * matchedFilterRowDataSize, 1 , fhData ,1);
|
||||||
|
fhData += matchedFilterRowDataSize;
|
||||||
|
}
|
||||||
|
// real = Aurora::real(fx) * Aurora::real(fh) + Aurora::imag(fx) * Aurora::imag(fh);
|
||||||
|
// image = Aurora::imag(fx) * Aurora::real(fh) - Aurora::real(fx) * Aurora::imag(fh);
|
||||||
|
vdMulI(fx.getDataSize(), fx.getData(), 2, fh.getData(), 2, value1, 1);
|
||||||
|
vdMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData() + 1, 2, value2, 1);
|
||||||
|
realData = Aurora::malloc(fx.getDataSize());
|
||||||
|
vdAdd(fx.getDataSize(), value1, value2, realData);
|
||||||
|
real = Matrix::New(realData, fx.getDimSize(0), fx.getDimSize(1));
|
||||||
|
|
||||||
|
vdMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData(), 2, value1, 1);
|
||||||
|
vdMulI(fx.getDataSize(), fx.getData(), 2, fh.getData() + 1, 2, value2, 1);
|
||||||
|
imagData = Aurora::malloc(fx.getDataSize());
|
||||||
|
vdSub(fx.getDataSize(), value1, value2, imagData);
|
||||||
|
image = Matrix::New(imagData, fx.getDimSize(0), fx.getDimSize(1));
|
||||||
|
Aurora::free(value1);
|
||||||
|
Aurora::free(value2);
|
||||||
|
|
||||||
|
complexData = Aurora::malloc(real.getDataSize(), true);
|
||||||
|
cblas_dcopy(real.getDataSize(), real.getData(), 1 , complexData ,2);
|
||||||
|
cblas_dcopy(image.getDataSize(), image.getData(), 1 , complexData + 1 ,2);
|
||||||
|
complex = Matrix::New(complexData, real.getDimSize(0), real.getDimSize(1), 1, Aurora::Complex);
|
||||||
|
ascanBlockRef = Aurora::real(ifft(complex));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
transParams::detectionWindowSOS = transParams::pulseLengthSamples;
|
||||||
|
transParams::detectionWindowATT = transParams::pulseLengthSamples;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(transParams::applyCalib)
|
||||||
|
{
|
||||||
|
metaInfos.snrValues = calculateSnr(ascanBlock, aSnrRmsNoise[0]);
|
||||||
|
metaInfos.snrValuesRef = calculateSnr(ascanBlockRef, aSnrRmsNoiseRef[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix dists = distanceBetweenTwoPoints(blockData.senderPositionBlock, blockData.receiverPositionBlock);
|
||||||
|
Matrix distRefBlock = distanceBetweenTwoPoints(blockDataRef.senderPositionBlock, blockDataRef.receiverPositionBlock);
|
||||||
|
|
||||||
|
Matrix waterTempBlock = calculateWaterTemperature(aTasTemps.waterTempPreCalc_sl, aTasTemps.waterTempPreCalc_rl, blockData.slBlock, blockData.rlBlock, blockData.mpBlock);
|
||||||
|
Matrix waterTempRefBlock = calculateWaterTemperature(aTasTemps.waterTempRefPreCalc_sl, aTasTemps.waterTempRefPreCalc_rl, blockData.slBlock, blockData.rlBlock, blockDataRef.mpBlock);
|
||||||
|
|
||||||
|
if(transParams::saveDetection || transParams::outlierOnTasDetection || transParams::saveDebugInfomation)
|
||||||
|
{
|
||||||
|
metaInfos.mpBlock = blockData.mpBlock;
|
||||||
|
metaInfos.slBlock = blockData.slBlock;
|
||||||
|
metaInfos.snBlock = blockData.snBlock;
|
||||||
|
metaInfos.rlBlock = blockData.rlBlock;
|
||||||
|
metaInfos.rnBlock = blockData.rnBlock;
|
||||||
|
}
|
||||||
|
result.metaInfos = metaInfos;
|
||||||
|
result.senderBlock = blockData.senderPositionBlock;
|
||||||
|
result.receiverBlock = blockData.receiverPositionBlock;
|
||||||
|
result.waterTempBlock = waterTempBlock;
|
||||||
|
|
||||||
|
DetectResult detect = transmissionDetection(ascanBlock, ascanBlockRef, dists, distRefBlock, waterTempBlock, waterTempRefBlock, aExpectedSOSWater[0]);
|
||||||
|
result.attData = detect.att;
|
||||||
|
result.tofData = detect.tof;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TransmissionData Recon::getTransmissionData(const Aurora::Matrix& aMotorPos, const Aurora::Matrix& aMotoPosRef, const Aurora::Matrix& aSlList,
|
||||||
const Aurora::Matrix& aSnList, const Aurora::Matrix& aRlList, const Aurora::Matrix& aRnList,
|
const Aurora::Matrix& aSnList, const Aurora::Matrix& aRlList, const Aurora::Matrix& aRnList,
|
||||||
const TempInfo& aTemp, const TempInfo& aTempRef, GeometryInfo& aGeom,
|
const TempInfo& aTemp, const TempInfo& aTempRef, GeometryInfo& aGeom,
|
||||||
GeometryInfo& aGeomRef, const MeasurementInfo& aExpInfo, const MeasurementInfo& aExpInfoRef,
|
GeometryInfo& aGeomRef, const MeasurementInfo& aExpInfo, const MeasurementInfo& aExpInfoRef,
|
||||||
const PreComputes& aPreComputes)
|
const PreComputes& aPreComputes, Parser* aParser, Parser* aParserRef)
|
||||||
{
|
{
|
||||||
//推测是已经完成过透射重建并从完成的透射重建读取数据,但下方读取后数据又被覆盖
|
//推测是已经完成过透射重建并从完成的透射重建读取数据
|
||||||
//暂不考虑此逻辑运行
|
//暂不考虑此逻辑运行
|
||||||
// if transParams.detection.forceRedetect == 0 && exist(transParams.pathSaveDetection, 'dir') && size(dir(transParams.pathSaveDetection), 1) > 2 % i.e. detection folder exists and is not empty
|
// if transParams.detection.forceRedetect == 0 && exist(transParams.pathSaveDetection, 'dir') && size(dir(transParams.pathSaveDetection), 1) > 2 % i.e. detection folder exists and is not empty
|
||||||
// % Load transmission detection data
|
// % Load transmission detection data
|
||||||
@@ -30,4 +198,204 @@ void Recon::getTransmissionData(const Aurora::Matrix& aMotorPos, const Aurora::M
|
|||||||
aGeom.sensData = precalcSensitivity(aSlList, aSnList, aRlList, aRnList, aMotorPos, aGeom);
|
aGeom.sensData = precalcSensitivity(aSlList, aSnList, aRlList, aRnList, aMotorPos, aGeom);
|
||||||
aGeomRef.sensData = aGeom.sensData;
|
aGeomRef.sensData = aGeom.sensData;
|
||||||
|
|
||||||
|
Matrix rmsNoise, rmsNoiseRef;
|
||||||
|
if (transParams::applyCalib)
|
||||||
|
{
|
||||||
|
rmsNoise = estimateNoiseValueFromAScans(aSnList, aRnList, aGeom, aExpInfo, aParser);
|
||||||
|
rmsNoiseRef = estimateNoiseValueFromAScans(aSnList, aRnList, aGeom, aExpInfo, aParserRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t numScans = aMotorPos.getDataSize() * aSlList.getDataSize() * aSnList.getDataSize() * aRlList.getDataSize() * aRnList.getDataSize();
|
||||||
|
Matrix tofDataTotal = Matrix::fromRawData(new double[numScans], 1, numScans) + NAN;
|
||||||
|
Matrix attDataTotal = Matrix::fromRawData(new double[numScans], 1, numScans) + NAN;
|
||||||
|
Matrix waterTempList = zeros(1,numScans,1);
|
||||||
|
Matrix senderList = zeros(3,numScans,1);
|
||||||
|
Matrix receiverList = zeros(3,numScans,1);
|
||||||
|
Matrix snrValues = zeros(1,numScans,1);
|
||||||
|
Matrix snrValuesRef = zeros(1,numScans,1);
|
||||||
|
|
||||||
|
Matrix mpBlockTotal;
|
||||||
|
Matrix slBlockTotal;
|
||||||
|
Matrix snBlockTotal;
|
||||||
|
Matrix rlBlockTotal;
|
||||||
|
Matrix rnBlockTotal;
|
||||||
|
if(transParams::saveDetection || transParams::outlierOnTasDetection || transParams::saveDebugInfomation)
|
||||||
|
{
|
||||||
|
mpBlockTotal = zeros(1,numScans,1);
|
||||||
|
slBlockTotal = zeros(1,numScans,1);
|
||||||
|
snBlockTotal = zeros(1,numScans,1);
|
||||||
|
rlBlockTotal = zeros(1,numScans,1);
|
||||||
|
rnBlockTotal = zeros(1,numScans,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int numData = 0;
|
||||||
|
int numPossibleScans = 0;
|
||||||
|
|
||||||
|
for(int i=0; i<aMotorPos.getDataSize(); ++i)
|
||||||
|
{
|
||||||
|
for(int j=0; j<aSlList.getDataSize() / transParams::senderTASSize; ++j)
|
||||||
|
{
|
||||||
|
for(int k=0; k<aSnList.getDataSize() / transParams::senderElementSize; ++k)
|
||||||
|
{
|
||||||
|
Matrix mp = aMotorPos(i).toMatrix();
|
||||||
|
Matrix mpRef = aMotoPosRef(i).toMatrix();
|
||||||
|
Matrix sl = aSlList.block(0, transParams::senderTASSize*j, transParams::senderTASSize*j+transParams::senderTASSize - 1);
|
||||||
|
Matrix sn = aSnList.block(0, transParams::senderElementSize*k, transParams::senderElementSize*k+transParams::senderElementSize - 1);
|
||||||
|
auto transmissionBlock = getBlockOfTransmissionData(mp,mpRef,sl,sn,aRlList,aRnList,tasTemps,aTemp.expectedSOSWater,aGeom,aGeomRef,rmsNoise,rmsNoiseRef,aExpInfo,aExpInfoRef,aPreComputes,aParser, aParserRef);
|
||||||
|
size_t numUsedData = transmissionBlock.senderBlock.getDimSize(1);
|
||||||
|
if(transParams::applyCalib)
|
||||||
|
{
|
||||||
|
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.snrValues.getData(), 1, snrValues.getData() + numData, 1);
|
||||||
|
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.snrValuesRef.getData(), 1, snrValuesRef.getData() + numData, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rows = transmissionBlock.senderBlock.getDimSize(0);
|
||||||
|
cblas_dcopy(numUsedData * rows, transmissionBlock.senderBlock.getData(), 1, senderList.getData() + numData*rows, 1);
|
||||||
|
cblas_dcopy(numUsedData * rows, transmissionBlock.receiverBlock.getData(), 1, receiverList.getData() + numData*rows, 1);
|
||||||
|
cblas_dcopy(numUsedData, transmissionBlock.tofData.getData(), 1, tofDataTotal.getData() + numData, 1);
|
||||||
|
cblas_dcopy(numUsedData, transmissionBlock.attData.getData(), 1, attDataTotal.getData() + numData, 1);
|
||||||
|
cblas_dcopy(numUsedData, transmissionBlock.waterTempBlock.getData(), 1, waterTempList.getData() + numData, 1);
|
||||||
|
|
||||||
|
if(transParams::saveDetection || transParams::outlierOnTasDetection || transParams::saveDebugInfomation)
|
||||||
|
{
|
||||||
|
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.mpBlock.getData(), 1, mpBlockTotal.getData() + numData, 1);
|
||||||
|
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.slBlock.getData(), 1, slBlockTotal.getData() + numData, 1);
|
||||||
|
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.snBlock.getData(), 1, snBlockTotal.getData() + numData, 1);
|
||||||
|
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.rlBlock.getData(), 1, rlBlockTotal.getData() + numData, 1);
|
||||||
|
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.rnBlock.getData(), 1, rnBlockTotal.getData() + numData, 1);
|
||||||
|
}
|
||||||
|
numData += numUsedData;
|
||||||
|
std::cout<<j<<std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double* filterData = Aurora::malloc(tofDataTotal.getDataSize());
|
||||||
|
for(int i=0;i<tofDataTotal.getDataSize();++i)
|
||||||
|
{
|
||||||
|
if(tofDataTotal[i] != tofDataTotal[i])
|
||||||
|
{
|
||||||
|
filterData[i] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filterData[i] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Matrix filter = Matrix::New(filterData, 1, tofDataTotal.getDataSize());
|
||||||
|
if(transParams::applyCalib)
|
||||||
|
{
|
||||||
|
snrValues = removeDataFromArrays(snrValues, filter);
|
||||||
|
snrValuesRef = removeDataFromArrays(snrValuesRef, filter);
|
||||||
|
}
|
||||||
|
senderList = removeDataFromArrays(senderList, filter);
|
||||||
|
receiverList = removeDataFromArrays(receiverList, filter);
|
||||||
|
tofDataTotal = removeDataFromArrays(tofDataTotal, filter);
|
||||||
|
attDataTotal = removeDataFromArrays(attDataTotal, filter);
|
||||||
|
waterTempList = removeDataFromArrays(waterTempList, filter);
|
||||||
|
if(transParams::saveDebugInfomation || transParams::outlierOnTasDetection || transParams::saveDetection)
|
||||||
|
{
|
||||||
|
mpBlockTotal = removeDataFromArrays(mpBlockTotal, filter);
|
||||||
|
slBlockTotal = removeDataFromArrays(slBlockTotal, filter);
|
||||||
|
snBlockTotal = removeDataFromArrays(snBlockTotal, filter);
|
||||||
|
rlBlockTotal = removeDataFromArrays(rlBlockTotal, filter);
|
||||||
|
rnBlockTotal = removeDataFromArrays(rnBlockTotal, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix valid;
|
||||||
|
if(transParams::applyCalib)
|
||||||
|
{
|
||||||
|
double* snr = Aurora::malloc(numData);
|
||||||
|
valid = findDefectTransmissionData(Matrix::copyFromRawData(snrValues.getData(), 1, numData), transParams::snrThreshold) *
|
||||||
|
findDefectTransmissionData(Matrix::copyFromRawData(snrValuesRef.getData(), 1, numData), transParams::snrThreshold);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
valid = zeros(1,numData) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataInfo dataInfno;
|
||||||
|
double* findDefectData = Aurora::malloc(valid.getDataSize());
|
||||||
|
int findDefectDataIndex = 0;
|
||||||
|
for(int i=0; i<valid.getDataSize(); ++i)
|
||||||
|
{
|
||||||
|
if(valid[i] == 0)
|
||||||
|
{
|
||||||
|
findDefectData[findDefectDataIndex] = i + 1;
|
||||||
|
++findDefectDataIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataInfno.findDefect = Matrix::New(findDefectData, 1, findDefectDataIndex);
|
||||||
|
|
||||||
|
if(transParams::saveDebugInfomation)
|
||||||
|
{
|
||||||
|
dataInfno.sn = snBlockTotal;
|
||||||
|
dataInfno.sl = slBlockTotal;
|
||||||
|
dataInfno.rn = rnBlockTotal;
|
||||||
|
dataInfno.rl = rlBlockTotal;
|
||||||
|
dataInfno.mp = mpBlockTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
tofDataTotal = removeDataFromArrays(tofDataTotal, valid);
|
||||||
|
attDataTotal = removeDataFromArrays(attDataTotal, valid);
|
||||||
|
senderList = removeDataFromArrays(senderList, valid);
|
||||||
|
receiverList = removeDataFromArrays(receiverList, valid);
|
||||||
|
waterTempList = removeDataFromArrays(waterTempList, valid);
|
||||||
|
|
||||||
|
dataInfno.numPossibleScans = numData;
|
||||||
|
dataInfno.numValidScans = sum(valid);
|
||||||
|
|
||||||
|
//以下逻辑config默认值不走。后续再实现
|
||||||
|
// if(transParams.detection.outlierOnTasDetection)
|
||||||
|
// snBlockTotal = snBlockTotal(valid);
|
||||||
|
// slBlockTotal = slBlockTotal(valid);
|
||||||
|
// rnBlockTotal = rnBlockTotal(valid);
|
||||||
|
// rlBlockTotal = rlBlockTotal(valid);
|
||||||
|
|
||||||
|
// outliers = analyzeDetections(slBlockTotal, snBlockTotal, rlBlockTotal, rnBlockTotal, tofDataTotal);
|
||||||
|
|
||||||
|
|
||||||
|
// tofDataTotal = tofDataTotal(~outliers);
|
||||||
|
// attDataTotal = attDataTotal(:,~outliers);
|
||||||
|
// senderList = senderList(:,~outliers);
|
||||||
|
// receiverList = receiverList(:,~outliers);
|
||||||
|
// waterTempList = waterTempList(~outliers);
|
||||||
|
|
||||||
|
// writeReconstructionLog(sprintf('Removed additionally %i outliers. \n',sum(outliers)),1);
|
||||||
|
// writeReconstructionLog(sprintf('Total data after 3 filter steps: Taken %d/%d AScans for reconstruction (%.2f percent).', numel(tofDataTotal), numScans, (numel(tofDataTotal) / numScans)*100), 1)
|
||||||
|
// end
|
||||||
|
|
||||||
|
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
|
||||||
|
// if transParams.detection.saveDetection % writing the detected values to file
|
||||||
|
// writeReconstructionLog('Save transmission detections.', 1);
|
||||||
|
|
||||||
|
// if(~transParams.detection.outlierOnTasDetection)
|
||||||
|
// snBlockTotal = snBlockTotal(valid);
|
||||||
|
// slBlockTotal = slBlockTotal(valid);
|
||||||
|
// rnBlockTotal = rnBlockTotal(valid);
|
||||||
|
// rlBlockTotal = rlBlockTotal(valid);
|
||||||
|
// end
|
||||||
|
// mpBlockTotal = mpBlockTotal(valid);
|
||||||
|
|
||||||
|
// if(transParams.detection.outlierOnTasDetection)
|
||||||
|
// snBlockTotal = snBlockTotal(~outliers);
|
||||||
|
// slBlockTotal = slBlockTotal(~outliers);
|
||||||
|
// rnBlockTotal = rnBlockTotal(~outliers);
|
||||||
|
// rlBlockTotal = rlBlockTotal(~outliers);
|
||||||
|
// mpBlockTotal = mpBlockTotal(~outliers);
|
||||||
|
// end
|
||||||
|
|
||||||
|
// saveTransmisssionDetectionData(transParams.pathSaveDetection, tofDataTotal, attDataTotal, senderList, receiverList, mpBlockTotal, slBlockTotal, snBlockTotal, rlBlockTotal, rnBlockTotal, waterTempList, expInfo.rootMeasUniqueID, dataInfo);
|
||||||
|
// end
|
||||||
|
|
||||||
|
TransmissionData result;
|
||||||
|
result.attDataTotal = attDataTotal;
|
||||||
|
result.tofDataTotal = tofDataTotal;
|
||||||
|
result.receiverList = receiverList;
|
||||||
|
result.senderList = senderList;
|
||||||
|
result.dataInfo = dataInfno;
|
||||||
|
result.waterTempList = waterTempList;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
@@ -5,13 +5,47 @@
|
|||||||
#include "../../common/getMeasurementMetaData.h"
|
#include "../../common/getMeasurementMetaData.h"
|
||||||
#include "src/common/getGeometryInfo.h"
|
#include "src/common/getGeometryInfo.h"
|
||||||
|
|
||||||
|
class Parser;
|
||||||
namespace Recon
|
namespace Recon
|
||||||
{
|
{
|
||||||
void getTransmissionData(const Aurora::Matrix& aMotorPos, const Aurora::Matrix& aMotoPosRef, const Aurora::Matrix& aSlList,
|
struct MetaInfos
|
||||||
|
{
|
||||||
|
Aurora::Matrix snrValues;
|
||||||
|
Aurora::Matrix snrValuesRef;
|
||||||
|
Aurora::Matrix mpBlock;
|
||||||
|
Aurora::Matrix slBlock;
|
||||||
|
Aurora::Matrix snBlock;
|
||||||
|
Aurora::Matrix rlBlock;
|
||||||
|
Aurora::Matrix rnBlock;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DataInfo
|
||||||
|
{
|
||||||
|
Aurora::Matrix findDefect;
|
||||||
|
Aurora::Matrix sn;
|
||||||
|
Aurora::Matrix sl;
|
||||||
|
Aurora::Matrix rn;
|
||||||
|
Aurora::Matrix rl;
|
||||||
|
Aurora::Matrix mp;
|
||||||
|
unsigned long long numPossibleScans;
|
||||||
|
Aurora::Matrix numValidScans;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TransmissionData
|
||||||
|
{
|
||||||
|
Aurora::Matrix tofDataTotal;
|
||||||
|
Aurora::Matrix attDataTotal;
|
||||||
|
Aurora::Matrix senderList;
|
||||||
|
Aurora::Matrix receiverList;
|
||||||
|
Aurora::Matrix waterTempList;
|
||||||
|
DataInfo dataInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
TransmissionData getTransmissionData(const Aurora::Matrix& aMotorPos, const Aurora::Matrix& aMotoPosRef, const Aurora::Matrix& aSlList,
|
||||||
const Aurora::Matrix& aSnList, const Aurora::Matrix& aRlList, const Aurora::Matrix& aRnList,
|
const Aurora::Matrix& aSnList, const Aurora::Matrix& aRlList, const Aurora::Matrix& aRnList,
|
||||||
const TempInfo& aTemp, const TempInfo& aTempRef, GeometryInfo& aGeom,
|
const TempInfo& aTemp, const TempInfo& aTempRef, GeometryInfo& aGeom,
|
||||||
GeometryInfo& aGeomRef, const MeasurementInfo& aExpInfo, const MeasurementInfo& aExpInfoRef,
|
GeometryInfo& aGeomRef, const MeasurementInfo& aExpInfo, const MeasurementInfo& aExpInfoRef,
|
||||||
const PreComputes& aPreComputes);
|
const PreComputes& aPreComputes, Parser* aParser, Parser* aParserRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -78,9 +78,9 @@ namespace Recon {
|
|||||||
return dims;
|
return dims;
|
||||||
}
|
}
|
||||||
|
|
||||||
void slownessToSOS(Aurora::Matrix & aVF1, double aSOS_IN_WATER)
|
Matrix slownessToSOS(Aurora::Matrix & aVF1, double aSOS_IN_WATER)
|
||||||
{
|
{
|
||||||
aVF1 = 1 / ((aVF1 + 1) / aSOS_IN_WATER);
|
return 1 / ((aVF1 + 1) / aSOS_IN_WATER);
|
||||||
}
|
}
|
||||||
|
|
||||||
DiscretizePositionValues discretizePositions(Aurora::Matrix &aVSenderCoordList, Aurora::Matrix &aVReceiverCoordList, double aNumPixelXY)
|
DiscretizePositionValues discretizePositions(Aurora::Matrix &aVSenderCoordList, Aurora::Matrix &aVReceiverCoordList, double aNumPixelXY)
|
||||||
@@ -224,7 +224,14 @@ namespace Recon {
|
|||||||
|
|
||||||
if(!data.isNull())
|
if(!data.isNull())
|
||||||
{
|
{
|
||||||
result.outSOS = solveParameterIterator(buildMatrixR.M, b, dims, false, transParams::nonNeg)[0][0];
|
Matrix sosValue = solveParameterIterator(buildMatrixR.M, b, dims, false, transParams::nonNeg)[0][0];
|
||||||
|
result.outSOS = slownessToSOS(sosValue, SOS_IN_WATER) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!dataAtt.isNull())
|
||||||
|
{
|
||||||
|
Matrix attValue = solveParameterIterator(buildMatrixR.M, bAtt, dims, false, transParams::nonNeg)[0][0];
|
||||||
|
result.outATT = attValue/100 ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ Aurora::Matrix calculateResolution(const Aurora::Matrix &aVDdims, const Aurora::
|
|||||||
|
|
||||||
Aurora::Matrix getDimensions(double aNumPixelXY, const Aurora::Matrix& ddims);
|
Aurora::Matrix getDimensions(double aNumPixelXY, const Aurora::Matrix& ddims);
|
||||||
|
|
||||||
void slownessToSOS(Aurora::Matrix & aVF1, double aSOS_IN_WATER);
|
Aurora::Matrix slownessToSOS(Aurora::Matrix & aVF1, double aSOS_IN_WATER);
|
||||||
|
|
||||||
DiscretizePositionValues discretizePositions(Aurora::Matrix &aVSenderCoordList, Aurora::Matrix &aVReceiverCoordList, double aNumPixelXY);
|
DiscretizePositionValues discretizePositions(Aurora::Matrix &aVSenderCoordList, Aurora::Matrix &aVReceiverCoordList, double aNumPixelXY);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#include "startTransmissionReconstruction.h"
|
||||||
|
#include "./detection/getTransmissionData.h"
|
||||||
|
#include "Matrix.h"
|
||||||
|
#include "common/dataBlockCreation/removeDataFromArrays.h"
|
||||||
|
#include "src/transmissionReconstruction/dataFilter/dataFilter.h"
|
||||||
|
#include "src/transmissionReconstruction/dataPreperation.h"
|
||||||
|
#include "src/common/getMeasurementMetaData.h"
|
||||||
|
#include "src/common/qualityReview.h"
|
||||||
|
#include "src/transmissionReconstruction/reconstruction/reconstruction.h"
|
||||||
|
#include "src/config/config.h"
|
||||||
|
|
||||||
|
#include "Function2D.h"
|
||||||
|
|
||||||
|
#include "MatlabWriter.h"
|
||||||
|
|
||||||
|
using namespace Aurora;
|
||||||
|
using namespace Recon;
|
||||||
|
|
||||||
|
void Recon::startTransmissionReconstruction(const Aurora::Matrix& aMotorPos, const Aurora::Matrix& aMotoPosRef, const Aurora::Matrix& aSlList,
|
||||||
|
const Aurora::Matrix& aSnList, const Aurora::Matrix& aRlList, const Aurora::Matrix& aRnList,
|
||||||
|
const TempInfo& aTemp, const TempInfo& aTempRef, Recon::GeometryInfo& aGeom,
|
||||||
|
GeometryInfo& aGeomRef, const MeasurementInfo& aExpInfo, const MeasurementInfo& aExpInfoRef,
|
||||||
|
const PreComputes& aPreComputes, Parser* aParser, Parser* aParserRef)
|
||||||
|
{
|
||||||
|
auto transmissionData = getTransmissionData(aMotorPos, aMotoPosRef, aSlList, aSnList, aRlList, aRnList, aTemp, aTempRef,
|
||||||
|
aGeom, aGeomRef, aExpInfo, aExpInfoRef, aPreComputes, aParser, aParserRef);
|
||||||
|
Matrix dists = Recon::distanceBetweenTwoPoints(transmissionData.senderList, transmissionData.receiverList);
|
||||||
|
Matrix sosRef = Recon::temperatureToSoundSpeed(transmissionData.waterTempList, "marczak");
|
||||||
|
Matrix valid = Recon::checkTofDetections(transmissionData.tofDataTotal, dists, sosRef,
|
||||||
|
Recon::transParams::minSpeedOfSound,Recon::transParams::maxSpeedOfSound).valid;
|
||||||
|
|
||||||
|
if(transParams::qualityCheck)
|
||||||
|
{
|
||||||
|
qualityReview(sum(valid,Aurora::All)[0], transmissionData.dataInfo.numPossibleScans);
|
||||||
|
}
|
||||||
|
DiscretizePositionValues positionValues = Recon::discretizePositions(transmissionData.senderList, transmissionData.receiverList, Recon::transParams::numPixelXY);
|
||||||
|
Matrix tofData = removeDataFromArrays(transmissionData.tofDataTotal, valid);
|
||||||
|
Matrix attData = removeDataFromArrays(transmissionData.attDataTotal, valid);
|
||||||
|
Matrix senderList = removeDataFromArrays(positionValues.senderCoordList, valid);
|
||||||
|
Matrix reveiverList = removeDataFromArrays(positionValues.receiverCoordList, valid);
|
||||||
|
auto transmissionReon = reconstructArt(tofData, attData, positionValues.dims, senderList, reveiverList, positionValues.res, aTemp.expectedSOSWater[0]);
|
||||||
|
|
||||||
|
MatlabWriter w1("/home/sun/transmissionATT.mat");
|
||||||
|
MatlabWriter w2("/home/sun/transmissionSOS.mat");
|
||||||
|
w1.write(transmissionReon.outATT, "ATT");
|
||||||
|
w2.write(transmissionReon.outSOS, "SOS");
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#ifndef START_TRANSMISSION_RECONSTRUCTION_H
|
||||||
|
#define START_TRANSMISSION_RECONSTRUCTION_H
|
||||||
|
|
||||||
|
#include "Matrix.h"
|
||||||
|
#include "../common/getMeasurementMetaData.h"
|
||||||
|
#include "../common/getGeometryInfo.h"
|
||||||
|
|
||||||
|
class Parser;
|
||||||
|
|
||||||
|
namespace Recon
|
||||||
|
{
|
||||||
|
void startTransmissionReconstruction(const Aurora::Matrix& aMotorPos, const Aurora::Matrix& aMotoPosRef, const Aurora::Matrix& aSlList,
|
||||||
|
const Aurora::Matrix& aSnList, const Aurora::Matrix& aRlList, const Aurora::Matrix& aRnList,
|
||||||
|
const TempInfo& aTemp, const TempInfo& aTempRef, Recon::GeometryInfo& aGeom,
|
||||||
|
GeometryInfo& aGeomRef, const MeasurementInfo& aExpInfo, const MeasurementInfo& aExpInfoRef,
|
||||||
|
const PreComputes& aPreComputes, Parser* aParser, Parser* aParserRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user