Add transmissionReconstruction.
This commit is contained in:
@@ -25,6 +25,7 @@ GeometryBlock Recon::blockingGeometryInfos(const GeometryInfo& aGeom, const Auro
|
||||
sizeData[3] = aGeom.receiverPositions.size();
|
||||
size_t matrixSize = aGeom.receiverPositions[0].getDataSize();
|
||||
Matrix receiverPositionsSize = Matrix::New(sizeData, 1, 4);
|
||||
#pragma omp parallel for
|
||||
for(int i=0; i<dim; ++i)
|
||||
{
|
||||
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();
|
||||
Matrix senderPositionsSize = Matrix::New(sizeData, 1, 4);
|
||||
dim = aGeom.senderPositions[0].getDimSize(0);
|
||||
#pragma omp parallel for
|
||||
for(int i=0; i<dim; ++i)
|
||||
{
|
||||
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/MetaData.h"
|
||||
#include "ShotList/ShotList.h"
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
using namespace Recon;
|
||||
@@ -18,12 +20,17 @@ using namespace Aurora;
|
||||
|
||||
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;
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
@@ -37,8 +44,8 @@ AscanBlock Recon::getAscanBlock(Parser* aParser, const Aurora::Matrix& aMp, cons
|
||||
const Aurora::Matrix& aRl, const Aurora::Matrix& aRn)
|
||||
{
|
||||
AscanBlock result;
|
||||
int numScans = aMp.getDataSize() * aSl.getDataSize() * aSn.getDataSize() * aRl.getDataSize() * aRn.getDataSize();
|
||||
int numScansIndex = 0;
|
||||
size_t numScans = aMp.getDataSize() * aSl.getDataSize() * aSn.getDataSize() * aRl.getDataSize() * aRn.getDataSize();
|
||||
//size_t numScansIndex = 0;
|
||||
int ascanBlockSize = numScans * aParser->getMetaData().getSampleNumber();
|
||||
double* ascanBlockData = new double[ascanBlockSize];
|
||||
double* mpBlockData = new double[numScans];
|
||||
@@ -57,30 +64,39 @@ AscanBlock Recon::getAscanBlock(Parser* aParser, const Aurora::Matrix& aMp, cons
|
||||
OneTasAScanData oenTasData = aParser->getOneTasAscanDataOfMotorPosition(1);
|
||||
auto tasIndices = aParser->getMetaData().getTasIndices();
|
||||
auto receiverIndices = aParser->getMetaData().getReceiverIndices();
|
||||
auto tasElementMapper = findTasAndElementIndex(tasIndices, receiverIndices, aRl, aRn);
|
||||
|
||||
for(int mpIndex=0; mpIndex<aMp.getDataSize();++mpIndex)
|
||||
{
|
||||
for(int slIndex=0; slIndex<aSl.getDataSize();++slIndex)
|
||||
{
|
||||
OneTasAScanData oenTasData = aParser->getOneTasAscanDataOfMotorPosition(aSl[slIndex]);
|
||||
|
||||
for(int snIndex=0; snIndex<aSn.getDataSize();++snIndex)
|
||||
{
|
||||
//int mapperIndex = 0;
|
||||
#pragma omp parallel for
|
||||
for(int rlIndex=0; rlIndex<aRl.getDataSize();++rlIndex)
|
||||
{
|
||||
auto rElementIndex = findTasIndex(tasIndices, aRl[rlIndex]);
|
||||
for(int rnIndex=0; rnIndex<rElementIndex.size(); ++rnIndex)
|
||||
{
|
||||
for(int rnIndex=0; rnIndex<aRn.getDataSize(); ++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;
|
||||
AScanData ascan = aParser->searchAscanDataFromOneTasAscanDataOfMP(oenTasData, ElementIndex(GeometryIndex(aSn[snIndex])), TasElementIndex(aRl[rlIndex], ElementIndex(GeometryIndex(receiverIndices.get()[rElementIndex[rnIndex]]))), mp);
|
||||
std::copy(ascan.get() ,ascan.get() + ascan.getAscanDataLength(), ascanBlockData);
|
||||
ascanBlockData += ascan.getAscanDataLength();
|
||||
|
||||
AScanData ascan = aParser->searchAscanDataFromOneTasAscanDataOfMP(oenTasData, ElementIndex(GeometryIndex(aSn[snIndex])), TasElementIndex(tasIndices.get()[tasElementMapper[mapperIndex]], ElementIndex(GeometryIndex(receiverIndices.get()[tasElementMapper[mapperIndex]]))), mp);
|
||||
double* startPointer = ascanBlockData + numScansIndex * ascan.getAscanDataLength();
|
||||
std::copy(ascan.get() ,ascan.get() + ascan.getAscanDataLength(), startPointer);
|
||||
//ascanBlockData += ascan.getAscanDataLength();
|
||||
mpBlockData[numScansIndex] = aMp[mpIndex];
|
||||
slBlockData[numScansIndex] = aSl[slIndex];
|
||||
snBlockData[numScansIndex] = aSn[snIndex];
|
||||
rlBlockData[numScansIndex] = aRl[rlIndex];
|
||||
rnBlockData[numScansIndex] = receiverIndices.get()[rElementIndex[rnIndex]];
|
||||
rlBlockData[numScansIndex] = tasIndices.get()[tasElementMapper[mapperIndex]];
|
||||
rnBlockData[numScansIndex] = receiverIndices.get()[tasElementMapper[mapperIndex]];
|
||||
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)
|
||||
{
|
||||
result = mean(aReferenceTemps($,aMotorPos).toMatrix(), FunctionDirection::All, false)[0];
|
||||
result = mean(aReferenceTemps($,aMotorPos - 1).toMatrix(), FunctionDirection::All, false)[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -61,6 +61,5 @@ Matrix Recon::extractTasTemperature(const Matrix& aTasTemperature, const Matrix&
|
||||
}
|
||||
}
|
||||
Matrix result = Matrix::New(resultData, aTasList.getDataSize(), aMotorPosList.getDataSize());
|
||||
result.printf();
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user