|
|
|
|
@@ -13,10 +13,14 @@
|
|
|
|
|
#include "Parser/Data/MetaData.h"
|
|
|
|
|
|
|
|
|
|
#include "Matrix.h"
|
|
|
|
|
#include "MatlabReader.h"
|
|
|
|
|
#include "Function1D.h"
|
|
|
|
|
#include "Function2D.h"
|
|
|
|
|
#include "src/common/ceMatchedFilterHandling.h"
|
|
|
|
|
#include "src/reflectionReconstruction/preprocessData/estimateOffset.h"
|
|
|
|
|
#include "src/reflectionReconstruction/preprocessData/precalcImageParameters.h"
|
|
|
|
|
#include "src/reflectionReconstruction/preprocessData/preprocessTransmissionReconstructionForReflection.h"
|
|
|
|
|
#include "src/reflectionReconstruction/startReflectionReconstruction.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using namespace Recon;
|
|
|
|
|
@@ -26,8 +30,8 @@ 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 dataPath = "/home/AScans_Data/ADW_TAS_Issue/20230418T145123/";
|
|
|
|
|
std::string refPath = "/home/AScans_Data/ADW_TAS_Issue/20230418T141000/";
|
|
|
|
|
std::string outputPath;
|
|
|
|
|
Parser dataParser(dataPath);
|
|
|
|
|
Parser refParser(refPath);
|
|
|
|
|
@@ -150,6 +154,9 @@ void Recon::startReconstructions()
|
|
|
|
|
reflectParams::expectedAScanDataLength = ceil(expInfo.numberSamples * ((double)reflectParams::aScanReconstructionFrequency / expInfo.sampleRate));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TransmissionReconstructionResult transmissionResult;
|
|
|
|
|
bool sosAvailable = false;
|
|
|
|
|
bool attAvailable = false;
|
|
|
|
|
if(transParams::runTransmissionReco)
|
|
|
|
|
{
|
|
|
|
|
if(ceRef.measuredCEUsed)
|
|
|
|
|
@@ -160,56 +167,79 @@ void Recon::startReconstructions()
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
transmissionResult = startTransmissionReconstruction(mp_inter, mpRef_inter, slList_inter, snList_inter, rlList_inter, rnList_inter, temp, tempRef, geom, geomRef, expInfo, expInfoRef, preComputes, &dataParser, &refParser);
|
|
|
|
|
attAvailable = true;
|
|
|
|
|
sosAvailable = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
if(reflectParams::runReflectionReco)
|
|
|
|
|
{
|
|
|
|
|
ceEstimatePulseLength.ce = ce.ceRef;
|
|
|
|
|
ceEstimatePulseLengthRef.ce = ceRef.ceRef;
|
|
|
|
|
ceEstimatePulseLength.ce_sf = reflectParams::aScanReconstructionFrequency;
|
|
|
|
|
ceEstimatePulseLengthRef.ce_sf = reflectParams::aScanReconstructionFrequency;
|
|
|
|
|
Matrix recoSOS = transmissionResult.recoSOS;
|
|
|
|
|
Matrix recoATT = transmissionResult.recoATT;
|
|
|
|
|
precalcImageParameters(geom);
|
|
|
|
|
//检测可使用内存是否足够,输出警报用,todo
|
|
|
|
|
//checkEnvAndMemory(reflectParams.imageInfos.IMAGE_XYZ);
|
|
|
|
|
auto preProcessData = preprocessTransmissionReconstructionForReflection(recoSOS, recoATT, transmissionResult.ddmis, geom, temp);
|
|
|
|
|
Matrix mp_inter = intersect(motorPosAvailable, reflectParams::motorPos);
|
|
|
|
|
Matrix slList_inter = intersect(slList, reflectParams::senderTasList);
|
|
|
|
|
Matrix snList_inter = intersect(snList, reflectParams::senderElementList);
|
|
|
|
|
Matrix rlList_inter = intersect(rlList, reflectParams::receiverTasList);
|
|
|
|
|
Matrix rnList_inter = intersect(rnList, reflectParams::receiverElementList);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
reflectParams::gpuSelectionList = reconParams::gpuSelectionList;
|
|
|
|
|
startReflectionReconstruction(&dataParser, preProcessData.saftMode, mp_inter, slList_inter, snList_inter, rlList_inter, rnList_inter, geom, preProcessData.transRecos, expInfo, preComputes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|