First update.

This commit is contained in:
sunwen
2023-10-09 09:29:21 +08:00
parent a434c105c0
commit 903ac2c087
56 changed files with 1044 additions and 1021 deletions

View File

@@ -22,7 +22,7 @@ namespace Recon {
}
Matrix calculateSOSOffset(const Matrix &sosBlock, double referenceSOS, const Matrix &distBlock, double sampleRate){
Matrix calculateSOSOffset(const Matrix &sosBlock, float referenceSOS, const Matrix &distBlock, float sampleRate){
auto offset = (distBlock / sosBlock - distBlock / referenceSOS) * sampleRate;
return offset;
}
@@ -52,10 +52,10 @@ namespace Recon {
}
SearchPosition calculateStarEndSearchPosition(const Matrix &aVDistBlock,
double minSpeedOfSound, double maxSpeedOfSound,
double sampleRate, double maxSample,
float minSpeedOfSound, float maxSpeedOfSound,
float sampleRate, float maxSample,
const Matrix &aVSosOffsetBlock,
double startOffset, double segmentLenOffset)
float startOffset, float segmentLenOffset)
{
auto startSearch = floor((aVDistBlock / maxSpeedOfSound)*sampleRate+aVSosOffsetBlock+startOffset);
for (size_t i = 0; i < startSearch.getDataSize(); i++)
@@ -78,10 +78,10 @@ namespace Recon {
return result;
}
TimeWindowResult applyTimeWindowing(const Aurora::Matrix &AscanBlock, double sampleRate,
TimeWindowResult applyTimeWindowing(const Aurora::Matrix &AscanBlock, float sampleRate,
const Aurora::Matrix &distBlock, const Aurora::Matrix &sosBlock,
double expectedSOSWater, double startOffset, double segmentLenOffset,
double minSpeedOfSound, double maxSpeedOfSound, bool gaussWindow)
float expectedSOSWater, float startOffset, float segmentLenOffset,
float minSpeedOfSound, float maxSpeedOfSound, bool gaussWindow)
{
auto sosOffset = calculateSOSOffset(sosBlock, expectedSOSWater, distBlock, sampleRate);
@@ -132,12 +132,12 @@ namespace Recon {
const Aurora::Matrix &distRef,
const Aurora::Matrix &sosWaterRef,
const Aurora::Matrix &tof, int aScanReconstructionFrequency,
double offsetElectronic, int detectionWindowATT)
float offsetElectronic, int detectionWindowATT)
{
auto sizeAscan = size(Ascan);
auto sampleRate = aScanReconstructionFrequency;
double offsetElectronicSamples = offsetElectronic * sampleRate;
float offsetElectronicSamples = offsetElectronic * sampleRate;
auto envelopeOfAScan = abs(hilbert(Ascan));
auto envelopeOfReferenceAScan = abs(hilbert(AscanRef));
@@ -150,9 +150,9 @@ namespace Recon {
#pragma omp parallel for
for (size_t i = 0; i < Ascan.getDimSize(1); i++)
{
startPos[i] = std::floor(std::max(tof[i]*sampleRate+offsetElectronicSamples,1.0));
startPos[i] = std::floor(std::max(tof[i]*sampleRate+offsetElectronicSamples,(float)1.0));
endPos[i] = std::ceil(std::min(sizeAscan[0], tof[i]*sampleRate+offsetElectronicSamples+detectionWindowATT));
startPosRef[i] = std::floor(std::max( tof2[i],1.0));
startPosRef[i] = std::floor(std::max( tof2[i],(float)1.0));
endPosRef[i] = std::ceil(std::min(sizeAscan[1], tof2[i]+detectionWindowATT));
}
return calculateAttenuation(envelopeOfAScan,startPos,endPos,envelopeOfReferenceAScan,startPosRef,endPosRef);
@@ -172,13 +172,13 @@ namespace Recon {
const Aurora::Matrix &AscanBlock, const Aurora::Matrix &AscanRefBlock,
const Aurora::Matrix &distBlock, const Aurora::Matrix &distBlockRef,
const Aurora::Matrix &sosWaterBlock,
const Aurora::Matrix &sosWaterRefBlock, double expectedSOSWater,
const Aurora::Matrix &sosWaterRefBlock, float expectedSOSWater,
int useTimeWindowing, int aScanReconstructionFrequency,
double offsetElectronic, int detectionWindowSOS, double minSpeedOfSound,
double maxSpeedOfSound, bool gaussWindow)
float offsetElectronic, int detectionWindowSOS, float minSpeedOfSound,
float maxSpeedOfSound, bool gaussWindow)
{
auto sampleRate = aScanReconstructionFrequency;
double offsetElectronicSamples = offsetElectronic * sampleRate;
float offsetElectronicSamples = offsetElectronic * sampleRate;
Matrix diffStartSearch;
TimeWindowResult timeResult1;
timeResult1.AscanBlockProcessed = AscanBlock;
@@ -245,13 +245,13 @@ namespace Recon {
const Aurora::Matrix &distBlock, const Aurora::Matrix &distRefBlock,
const Aurora::Matrix &sosWaterBlock,
const Aurora::Matrix &sosWaterRefBlock,
int resampleFactor,int nthreads, double expectedSOSWater,
int resampleFactor,int nthreads, float expectedSOSWater,
int useTimeWindowing, int aScanReconstructionFrequency,int detectionWindowATT,
double offsetElectronic, int detectionWindowSOS, double minSpeedOfSound,
double maxSpeedOfSound, bool gaussWindow)
float offsetElectronic, int detectionWindowSOS, float minSpeedOfSound,
float maxSpeedOfSound, bool gaussWindow)
{
auto sampleRate = aScanReconstructionFrequency;
double offsetElectronicSamples = offsetElectronic * sampleRate;
float offsetElectronicSamples = offsetElectronic * sampleRate;
Matrix diffStartSearch;
TimeWindowResult timeResult1;
timeResult1.AscanBlockProcessed = AscanBlock;
@@ -323,16 +323,16 @@ namespace Recon {
const Aurora::Matrix &distBlock, const Aurora::Matrix &distRefBlock,
const Aurora::Matrix &sosWaterBlock,
const Aurora::Matrix &sosWaterRefBlock,
int resampleFactor,int nthreads, double expectedSOSWater,
int resampleFactor,int nthreads, float expectedSOSWater,
int useTimeWindowing, int aScanReconstructionFrequency,int detectionWindowATT,
double offsetElectronic, int detectionWindowSOS, double minSpeedOfSound,
double maxSpeedOfSound, bool gaussWindow)
float offsetElectronic, int detectionWindowSOS, float minSpeedOfSound,
float maxSpeedOfSound, bool gaussWindow)
{
auto sizeAscan = size(AscanBlock);
auto sampleRate = aScanReconstructionFrequency;
double offsetElectronicSamples = offsetElectronic * sampleRate;
float offsetElectronicSamples = offsetElectronic * sampleRate;
Matrix diffStartSearch;
TimeWindowResult timeResult1;
timeResult1.AscanBlockProcessed = AscanBlock;
@@ -356,8 +356,8 @@ namespace Recon {
int M =std::min(AscanBlock.getDimSize(0),AscanRefBlock.getDimSize(0));
Matrix resDetect;
double * resEnvelopeD = nullptr;
double * resEnvelopeRefD = nullptr;
float * resEnvelopeD = nullptr;
float * resEnvelopeRefD = nullptr;
size_t N = _AscanBlock.getDimSize(1);
size_t totalSize = N*M;
@@ -402,9 +402,9 @@ namespace Recon {
#pragma omp parallel for
for (size_t i = 0; i < _AscanBlock.getDimSize(1); i++)
{
startPos[i] = std::floor(std::max(tofAbs[i]*sampleRate+offsetElectronicSamples,1.0));
startPos[i] = std::floor(std::max(tofAbs[i]*sampleRate+offsetElectronicSamples,(float)1.0));
endPos[i] = std::ceil(std::min(sizeAscan[0], tofAbs[i]*sampleRate+offsetElectronicSamples+detectionWindowATT));
startPosRef[i] = std::floor(std::max( tof2[i],1.0));
startPosRef[i] = std::floor(std::max( tof2[i],(float)1.0));
endPosRef[i] = std::ceil(std::min(sizeAscan[0], tof2[i]+detectionWindowATT));
}
DetectResult result;
@@ -420,7 +420,7 @@ namespace Recon {
const Aurora::Matrix &distRefBlock,
const Aurora::Matrix &sosWaterBlock,
const Aurora::Matrix &sosWaterRefBlock,
double expectedSOSWater) {
float expectedSOSWater) {
auto _sosWaterBlock = temperatureToSoundSpeed(sosWaterBlock, "marczak");
auto _sosWaterRefBlock = temperatureToSoundSpeed(sosWaterRefBlock, "marczak");
switch (Recon::transParams::version) {