feat: Add logic block log to performSignalProcessing in reflect reconstruction

This commit is contained in:
kradchen
2024-11-06 11:36:52 +08:00
parent 4bf226e4b2
commit b859728562
2 changed files with 36 additions and 5 deletions

View File

@@ -7,6 +7,7 @@
#include "Matrix.h" #include "Matrix.h"
#include "common/dataBlockCreation/removeDataFromArrays.h" #include "common/dataBlockCreation/removeDataFromArrays.h"
#include "config/config.h" #include "config/config.h"
#include "log/log.h"
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <cstddef> #include <cstddef>
@@ -121,6 +122,7 @@ namespace Recon {
const Aurora::Matrix &blockedReceiverPosition, const Aurora::Matrix &blockedReceiverPosition,
const Aurora::Matrix &blockedGain, const Aurora::Matrix &blockedChannels, const Aurora::Matrix &blockedGain, const Aurora::Matrix &blockedChannels,
MeasurementInfo &info, const PreComputes &preComputes) { MeasurementInfo &info, const PreComputes &preComputes) {
RECON_INFO("============================>performSignalProcessing start!");
std::vector<Aurora::Matrix> result; std::vector<Aurora::Matrix> result;
auto t = size(blockedAScans); auto t = size(blockedAScans);
size_t nSamples = (int)t[0]; size_t nSamples = (int)t[0];
@@ -133,6 +135,8 @@ namespace Recon {
} }
int winLength = 100; int winLength = 100;
auto ascanMapValue = Aurora::zeros(1,blockedAScans.getDimSize(1),1); auto ascanMapValue = Aurora::zeros(1,blockedAScans.getDimSize(1),1);
RECON_INFO("performSignalProcessing step 1 done!");
// #pragma omp parallel for num_threads(32) // #pragma omp parallel for num_threads(32)
#pragma omp parallel for #pragma omp parallel for
for (size_t i = 0; i < blockedAScans.getDimSize(1); i++) for (size_t i = 0; i < blockedAScans.getDimSize(1); i++)
@@ -179,7 +183,10 @@ namespace Recon {
} }
blockedAScans(Aurora::$,i)= _blockedAScans; blockedAScans(Aurora::$,i)= _blockedAScans;
} }
RECON_INFO("performSignalProcessing loop 1 done!");
auto fx_all = fft(blockedAScans); auto fx_all = fft(blockedAScans);
RECON_INFO("performSignalProcessing fft 1 done!");
if (reflectParams::useCorrelation && reflectParams::matchedFilterCeAScan) if (reflectParams::useCorrelation && reflectParams::matchedFilterCeAScan)
{ {
@@ -218,18 +225,25 @@ namespace Recon {
Aurora::free(value2); Aurora::free(value2);
fx_all(Aurora::$,i) = complex; fx_all(Aurora::$,i) = complex;
} }
RECON_INFO("performSignalProcessing loop 2 done!");
blockedAScans = Aurora::real(ifft(fx_all)); blockedAScans = Aurora::real(ifft(fx_all));
RECON_INFO("performSignalProcessing ifft 2 done!");
blockedAScans.setBlockValue(0, 0, winLength-1, 0); blockedAScans.setBlockValue(0, 0, winLength-1, 0);
blockedAScans.setBlockValue(0, blockedAScans.getDimSize(0)-winLength, blockedAScans.getDimSize(0)-1, 0); blockedAScans.setBlockValue(0, blockedAScans.getDimSize(0)-winLength, blockedAScans.getDimSize(0)-1, 0);
blockedAScans = fft(blockedAScans); blockedAScans = fft(blockedAScans);
RECON_INFO("performSignalProcessing fft 2 done!");
} }
else{ else{
blockedAScans = fx_all; blockedAScans = fx_all;
} }
RECON_INFO("->offsetSignalFourier start!");
auto exponent = offsetSignalFourier(preComputes, nSamples); auto exponent = offsetSignalFourier(preComputes, nSamples);
// exponent.forceReshape(1, exponent.getDataSize(), 1); // exponent.forceReshape(1, exponent.getDataSize(), 1);
RECON_INFO("->offsetSignalFourier finish!");
// #pragma omp parallel for num_threads(32) // #pragma omp parallel for num_threads(32)
#pragma omp parallel for #pragma omp parallel for
@@ -238,8 +252,11 @@ namespace Recon {
Aurora::Matrix _blockedAScans = getPartMatrixColRef(blockedAScans,i); Aurora::Matrix _blockedAScans = getPartMatrixColRef(blockedAScans,i);
blockedAScans(Aurora::$,i) =_blockedAScans*exponent; blockedAScans(Aurora::$,i) =_blockedAScans*exponent;
} }
RECON_INFO("performSignalProcessing loop 3 done!");
blockedAScans = real(ifft(blockedAScans)); blockedAScans = real(ifft(blockedAScans));
RECON_INFO("performSignalProcessing ifft 3 done!");
if (reflectParams::removeTransmissionSignal == 1) { if (reflectParams::removeTransmissionSignal == 1) {
// #pragma omp parallel for num_threads(32) // #pragma omp parallel for num_threads(32)
#pragma omp parallel for #pragma omp parallel for
@@ -342,9 +359,13 @@ namespace Recon {
// blockedAScans(Aurora::$,i) =_blockedAScans; // blockedAScans(Aurora::$,i) =_blockedAScans;
} }
} }
RECON_INFO("performSignalProcessing loop 4 done!");
} }
// auto __blockedAScans = fft(blockedAScans(Aurora::$,0).toMatrix()); // auto __blockedAScans = fft(blockedAScans(Aurora::$,0).toMatrix());
blockedAScans = fft(blockedAScans); blockedAScans = fft(blockedAScans);
RECON_INFO("performSignalProcessing fft 4 done!");
if(reflectParams::useOptPulse==1){ if(reflectParams::useOptPulse==1){
auto n = nSamples; auto n = nSamples;
auto nHalf = round((float)n/2); auto nHalf = round((float)n/2);
@@ -358,8 +379,11 @@ namespace Recon {
_blockedAScans.setBlockComplexValue(0,nHalf,_blockedAScans.getDimSize(0)-1, std::complex<float>{0,0}); _blockedAScans.setBlockComplexValue(0,nHalf,_blockedAScans.getDimSize(0)-1, std::complex<float>{0,0});
_blockedAScans.setBlock(0,1,nHalf-1,_blockedAScans.block(0,1,nHalf-1)*2); _blockedAScans.setBlock(0,1,nHalf-1,_blockedAScans.block(0,1,nHalf-1)*2);
} }
RECON_INFO("performSignalProcessing loop 5 done!");
blockedAScans = ifft(blockedAScans, n); blockedAScans = ifft(blockedAScans, n);
RECON_INFO("performSignalProcessing ifft 5 done!");
blockedAScans = abs(blockedAScans); blockedAScans = abs(blockedAScans);
@@ -407,8 +431,11 @@ namespace Recon {
} }
help_all(Aurora::$,i) = help; help_all(Aurora::$,i) = help;
} }
RECON_INFO("performSignalProcessing loop 6 done!");
help_all = fft(help_all); help_all = fft(help_all);
RECON_INFO("performSignalProcessing fft 6 done!");
// #pragma omp parallel for num_threads(32) // #pragma omp parallel for num_threads(32)
#pragma omp parallel for #pragma omp parallel for
@@ -418,8 +445,10 @@ namespace Recon {
Aurora::Matrix help = getPartMatrixColRef(help_all,i); Aurora::Matrix help = getPartMatrixColRef(help_all,i);
help_all(Aurora::$,i) = help*(preComputes.sincPeak_ft); help_all(Aurora::$,i) = help*(preComputes.sincPeak_ft);
} }
RECON_INFO("performSignalProcessing loop 7 done!");
help_all = real(ifft(help_all)); help_all = real(ifft(help_all));
RECON_INFO("performSignalProcessing ifft 7 done!");
// #pragma omp parallel for num_threads(32) // #pragma omp parallel for num_threads(32)
#pragma omp parallel for #pragma omp parallel for
@@ -429,10 +458,13 @@ namespace Recon {
Aurora::Matrix help = getPartMatrixColRef(help_all,i); Aurora::Matrix help = getPartMatrixColRef(help_all,i);
Aurora::compareSet(_blockedAScans,0,help,Aurora::NL); Aurora::compareSet(_blockedAScans,0,help,Aurora::NL);
} }
RECON_INFO("performSignalProcessing loop 8 done!");
} }
else{ else{
blockedAScans = real(ifft(blockedAScans)); blockedAScans = real(ifft(blockedAScans));
RECON_INFO("performSignalProcessing ifft 8.1 done!");
} }
result.push_back(blockedAScans); result.push_back(blockedAScans);
@@ -443,6 +475,7 @@ namespace Recon {
} }
result.push_back(ascanMapValue); result.push_back(ascanMapValue);
RECON_INFO("============================>performSignalProcessing finish!");
return result; return result;
} }

View File

@@ -48,7 +48,7 @@ void producerThread( Parser* aParser, const Aurora::Matrix& aMotorPos,
std::string msg; std::string msg;
} }
printf(" - optimal pulse"); // printf(" - optimal pulse");
if(reflectParams::useOptPulse==1 && reflectParams::runReflectionReco) if(reflectParams::useOptPulse==1 && reflectParams::runReflectionReco)
{ {
aPreComputes.sincPeak_ft = determineOptimalPulse(aPreComputes.timeInterval, aExpInfo.expectedAScanLength); aPreComputes.sincPeak_ft = determineOptimalPulse(aPreComputes.timeInterval, aExpInfo.expectedAScanLength);
@@ -91,8 +91,7 @@ void producerThread( Parser* aParser, const Aurora::Matrix& aMotorPos,
auto preprocessData = preprocessAScanBlockForReflection(blockData.ascanBlockPreprocessed, blockData.mpBlock, blockData.slBlock, auto preprocessData = preprocessAScanBlockForReflection(blockData.ascanBlockPreprocessed, blockData.mpBlock, blockData.slBlock,
blockData.snBlock, blockData.rlBlock, blockData.rnBlock, blockData.senderPositionBlock, blockData.snBlock, blockData.rlBlock, blockData.rnBlock, blockData.senderPositionBlock,
blockData.receiverPositionBlock, blockData.gainBlock, channelBlock, aExpInfo, aPreComputes); blockData.receiverPositionBlock, blockData.gainBlock, channelBlock, aExpInfo, aPreComputes);
std::cout<<"\rReflect reconstructing...... "<< index<<"/64"; RECON_INFO("Reflect reconstructing...... {0}",index);
std::cout.flush();
index++; index++;
// std::unique_lock<std::mutex> lock(PRODUCER_MUTEX); // std::unique_lock<std::mutex> lock(PRODUCER_MUTEX);
// PRODUCER_BLOCKDATAS.push(blockData); // PRODUCER_BLOCKDATAS.push(blockData);
@@ -148,7 +147,6 @@ Aurora::Matrix Recon::startReflectionReconstruction( Parser* aParser, int aSAFT_
// } // }
// thread.join(); // thread.join();
std::cout<<"Reflect reconstructing done"<< std::endl; RECON_INFO("Reflect reconstructing done");
std::cout.flush();
return Matrix(); return Matrix();
} }