From 4913ab7e6092d2c12e6bec21e454327a18bebeda Mon Sep 17 00:00:00 2001 From: sunwen Date: Wed, 14 Jun 2023 12:19:54 +0800 Subject: [PATCH] Update startReonstruction. --- src/startReconstructions.cpp | 130 +++++++++++------- .../reconstruction/reconstruction.h | 1 - .../startTransmissionReconstruction.cpp | 11 +- .../startTransmissionReconstruction.h | 10 +- 4 files changed, 95 insertions(+), 57 deletions(-) diff --git a/src/startReconstructions.cpp b/src/startReconstructions.cpp index a984dbd..b22a720 100644 --- a/src/startReconstructions.cpp +++ b/src/startReconstructions.cpp @@ -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