Update geometry info , measrementInfo for startReconstruction.
This commit is contained in:
22
src/common/estimatePulseLength.cpp
Normal file
22
src/common/estimatePulseLength.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "estimatePulseLength.h"
|
||||
#include "Function1D.h"
|
||||
#include "Function2D.h"
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
using namespace Aurora;
|
||||
|
||||
double Recon::estimatePulseLength(const CeEstimatePulseLength& aCe, double aSampleFreq)
|
||||
{
|
||||
Matrix value1 = abs(hilbert(aCe.ce));
|
||||
double value2 = 0.05 * max(abs(hilbert(aCe.ce)),All)[0];
|
||||
std::vector<size_t> t;
|
||||
for(size_t i=0; i<value1.getDataSize(); ++i)
|
||||
{
|
||||
if(value1[i] > value2)
|
||||
{
|
||||
t.push_back(i);
|
||||
}
|
||||
}
|
||||
return (t[t.size()-1] - t[0]) / aCe.ce_sf * aSampleFreq;
|
||||
}
|
||||
17
src/common/estimatePulseLength.h
Normal file
17
src/common/estimatePulseLength.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef ESTIMATE_PULSE_LENGTH_H
|
||||
#define ESTIMATE_PULSE_LENGTH_H
|
||||
|
||||
#include "Matrix.h"
|
||||
|
||||
namespace Recon
|
||||
{
|
||||
struct CeEstimatePulseLength
|
||||
{
|
||||
Aurora::Matrix ce;
|
||||
double ce_sf;
|
||||
};
|
||||
|
||||
double estimatePulseLength(const CeEstimatePulseLength& aCe, double aSampleFreq);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -192,13 +192,13 @@ void getApertureBoundingBox(GeometryInfo& aOutput)
|
||||
}
|
||||
}
|
||||
|
||||
GeometryInfo Recon::getGeometryInfo(const Matrix& aMotorPos, const Matrix& aTransformationMatricesRef,
|
||||
GeometryInfo Recon::getGeometryInfo(const Matrix& aMotorPos, const Matrix& aTransformationMatrices,
|
||||
const Matrix aRlList, const Matrix aRnList, const Matrix aSlList, const Matrix aSnList)
|
||||
{
|
||||
GeometryInfo result;
|
||||
result.headTable = Recon::HEAD_TABLE;
|
||||
result.sensChar = loadSensitivity();
|
||||
transformGeometry(aMotorPos, aTransformationMatricesRef, aRlList, aRnList, aSlList, aSnList, result);
|
||||
transformGeometry(aMotorPos, aTransformationMatrices, aRlList, aRnList, aSlList, aSnList, result);
|
||||
getApertureBoundingBox(result);
|
||||
result.maxSL = emitterPositions.size();
|
||||
result.maxSN = emitterPositions[0].getDimSize(0);
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Recon
|
||||
std::vector<Aurora::Matrix> receiverPositions;
|
||||
};
|
||||
|
||||
GeometryInfo getGeometryInfo(const Aurora::Matrix& aMotorPos, const Aurora::Matrix& aTransformationMatricesRef,
|
||||
GeometryInfo getGeometryInfo(const Aurora::Matrix& aMotorPos, const Aurora::Matrix& aTransformationMatrices,
|
||||
const Aurora::Matrix aRlList, const Aurora::Matrix aRnList, const Aurora::Matrix aSlList, const Aurora::Matrix aSnList);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ MeasurementInfo Recon::loadMeasurementInfos(Parser* aParser)
|
||||
result.Wavelength = 3;
|
||||
result.expectedAScanLength = result.numberSamples;
|
||||
result.rootMeasUniqueID = metaData.getMeasurementID();
|
||||
result.dacDelay = metaData.getDacDelay();
|
||||
result.filterByPass = metaData.getFilterByPass();
|
||||
if(result.Bandpassundersampling)
|
||||
{
|
||||
result.expectedAScanLength = reflectParams::aScanReconstructionFrequency / result.sampleRate * result.expectedAScanLength;
|
||||
|
||||
@@ -20,6 +20,9 @@ namespace Recon
|
||||
int Wavelength;
|
||||
unsigned int expectedAScanLength;
|
||||
std::string rootMeasUniqueID;
|
||||
double dacDelay;
|
||||
double filterByPass;
|
||||
Aurora::Matrix matchedFilter;
|
||||
};
|
||||
|
||||
struct CEInfo
|
||||
|
||||
@@ -10,25 +10,25 @@ namespace Recon
|
||||
{
|
||||
//reconParams.measurementInfo.ce
|
||||
static bool useCEMeasured = true;
|
||||
static int removeOutliersFromCEMeasured = 1;
|
||||
static bool removeOutliersFromCEMeasured = true;
|
||||
static double offsetFilterEnabled = 6.9e-6;
|
||||
static double offsetFilterDisabled = 1.2e-6;
|
||||
//reconParams.measurementInfo.temp
|
||||
static bool useTASTempComp = true;
|
||||
static bool correctTASTemp = 1;
|
||||
static //reconParams.hardwareSelection
|
||||
int gpuSelectionList[8] = {0,1,2,3,4,5,6,7};
|
||||
static //reconParams.dataInfo
|
||||
int expectedAScanDataLength = 4000;
|
||||
//reconParams.hardwareSelection
|
||||
static Aurora::Matrix gpuSelectionList = Aurora::Matrix::fromRawData(new double[8]{0,1,2,3,4,5,6,7},8);
|
||||
//reconParams.dataInfo
|
||||
static int expectedAScanDataLength = 4000;
|
||||
}
|
||||
|
||||
namespace reflectParams
|
||||
{
|
||||
//reflectParams.dataSelection
|
||||
static double senderTasList[128]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128};//1~128
|
||||
static double senderElementList[18]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};//1~18
|
||||
static double receiverTasList[128]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128};//1~128
|
||||
static double receiverElementList[18]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};//1~18
|
||||
static Aurora::Matrix senderTasList = Aurora::Matrix::fromRawData(new double[128]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128},128);//1~128
|
||||
static Aurora::Matrix senderElementList = Aurora::Matrix::fromRawData(new double[18]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18},18);//1~18
|
||||
static Aurora::Matrix receiverTasList = Aurora::Matrix::fromRawData(new double[128]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128},128);//1~128
|
||||
static Aurora::Matrix receiverElementList = Aurora::Matrix::fromRawData(new double[18]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18},18);//1~18
|
||||
static Aurora::Matrix motorPos = Aurora::Matrix::fromRawData(new double[2]{1,2}, 2);
|
||||
static int constricReflectionAngles = 1;
|
||||
static int angleLowerLimit = 45;
|
||||
@@ -64,7 +64,7 @@ namespace Recon
|
||||
static int suppressSameHead = 1;
|
||||
static int suppressSameHeadLength = 1500;
|
||||
static int useCorrelation = 1;
|
||||
static int matchedFilterCeAScan = 1;
|
||||
static bool matchedFilterCeAScan = true;
|
||||
static int windowLength = 10;
|
||||
static int numThreads = 30;
|
||||
static int expectedUSSpeedRange[2] = {1420,1600};
|
||||
@@ -89,15 +89,16 @@ namespace Recon
|
||||
|
||||
namespace transParams
|
||||
{
|
||||
static Aurora::Matrix gpuSelectionList;
|
||||
//transParams.dataSelection
|
||||
static int verbose = 1;
|
||||
static int saveRecon = 1;
|
||||
static int saveDebugInfomation = 1;
|
||||
//transParams.dataSelection
|
||||
static double senderTasList[128]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128};//1~128
|
||||
static double senderElementList[18]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};//1~18
|
||||
static double receiverTasList[128]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128};//1~128
|
||||
static double receiverElementList[18]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};//1~18
|
||||
static Aurora::Matrix senderTasList = Aurora::Matrix::fromRawData(new double[128]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128},128);//1~128
|
||||
static Aurora::Matrix senderElementList = Aurora::Matrix::fromRawData(new double[18]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18},18);//1~18
|
||||
static Aurora::Matrix receiverTasList = Aurora::Matrix::fromRawData(new double[128]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128},128);//1~128
|
||||
static Aurora::Matrix receiverElementList = Aurora::Matrix::fromRawData(new double[18]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18},18);//1~18
|
||||
static Aurora::Matrix motorPos = Aurora::Matrix::fromRawData(new double[2]{1,2}, 2);
|
||||
static int filterSensitivity = 1;
|
||||
static double sensFilter = 0.3;
|
||||
@@ -134,6 +135,8 @@ namespace Recon
|
||||
static int maxSpeedOfSound = 1550;
|
||||
static int detectionWindowSOS = 1;
|
||||
static int detectionWindowATT = 50;
|
||||
static double pulseLengthSamples = 0;
|
||||
static double pulseLengthRefSamples = 0;
|
||||
//transParams.rayTracing
|
||||
static int bentReconstruction = 0;
|
||||
static int bresenham = 1;
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
#include "estimateOffset.h"
|
||||
#include "../../common/ceMatchedFilterHandling.h"
|
||||
#include "Function.h"
|
||||
#include "Function1D.h"
|
||||
#include "Function2D.h"
|
||||
#include "Matrix.h"
|
||||
#include "src/config/config.h"
|
||||
#include <cstddef>
|
||||
|
||||
using namespace Recon;
|
||||
using namespace Aurora;
|
||||
|
||||
double Recon::estimateOffset(const MeasurementInfo aExpInfo, const CEInfo& aCe, const Aurora::Matrix& aMatchedFilter)
|
||||
{
|
||||
double offset = 0;
|
||||
Matrix ce = aCe.ceRef;
|
||||
double ceOffSet = aCe.ceRefOffSet;
|
||||
Matrix ceMeasured;
|
||||
if(aCe.measuredCEAvailable)
|
||||
{
|
||||
if(aCe.measuredCEUsed)
|
||||
{
|
||||
ceMeasured = real(ifft(aMatchedFilter));
|
||||
}
|
||||
else
|
||||
{
|
||||
ceMeasured = real(ifft(reviseMatchedFilter(aCe.ce, true)));
|
||||
}
|
||||
}
|
||||
|
||||
offset = offset + reflectParams::offsetElectronic;
|
||||
if(!aCe.measuredCEUsed)
|
||||
{
|
||||
if(aCe.measuredCEAvailable && aCe.ceAvailable)
|
||||
{
|
||||
size_t column = ceMeasured.getDimSize(1);
|
||||
size_t ceRows = ce.getDimSize(0);
|
||||
double* offsetCEMeasuredData = Aurora::malloc(column);
|
||||
for(int i=0; i<column; ++i)
|
||||
{
|
||||
Matrix corrCE = xcorr(ceMeasured($,i).toMatrix(), ce);
|
||||
long row,column;
|
||||
max(corrCE, FunctionDirection::All,row,column);
|
||||
offsetCEMeasuredData[i] = row + 1;
|
||||
offsetCEMeasuredData[i] = offsetCEMeasuredData[i] - ceRows;
|
||||
}
|
||||
Matrix offsetCEMeasured = Matrix::New(offsetCEMeasuredData, column);
|
||||
offset = offset + median(offsetCEMeasured)[0] / reflectParams::aScanReconstructionFrequency;
|
||||
// 2代
|
||||
// if strcmpi(info.Hardware,'USCT3Dv2')
|
||||
// offset = offset - CEOffset;
|
||||
// CEOffset = 0;
|
||||
// end
|
||||
}
|
||||
else
|
||||
{
|
||||
double dacDelay = aExpInfo.dacDelay;
|
||||
double filterDisabled = aExpInfo.filterByPass;
|
||||
double dacDelayInS = dacDelay / 10000000;
|
||||
if(filterDisabled == 1)
|
||||
{
|
||||
offset += aCe.offsetFilterDisabled + dacDelayInS;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset += aCe.offsetFilterEnabled + dacDelayInS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//只对三代处理,Digitalfilterdelay为0;
|
||||
// if (strcmp(info.Hardware,'USCT3Dv2')==1 && info.Bandpassundersampling==1) %%%3.3MHz Filter 208 Tabs
|
||||
// Digitalfilterdelay=-(0.8e-6);
|
||||
// %seconds
|
||||
// elseif(strcmp(info.Hardware,'USCT3Dv2')==1) %%%%10 MHz 32 Tabs
|
||||
// Digitalfilterdelay=-(4.67e-6 + 0.8e-6);
|
||||
// %seconds
|
||||
// elseif(strcmp(info.Hardware,'USCT3Dv3')==1)
|
||||
double digitalfilterdelay = 0;
|
||||
// else
|
||||
// Digitalfilterdelay = 0;
|
||||
// end
|
||||
|
||||
if (!aCe.measuredCEUsed)
|
||||
{
|
||||
offset += digitalfilterdelay;
|
||||
offset += ceOffSet;
|
||||
}
|
||||
|
||||
offset -= aExpInfo.EOffset;
|
||||
|
||||
return offset;
|
||||
}
|
||||
11
src/reflectionReconstruction/preprocessData/estimateOffset.h
Normal file
11
src/reflectionReconstruction/preprocessData/estimateOffset.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef ESTIMATE_OFFSET_H
|
||||
#define ESTIMATE_OFFSET_H
|
||||
|
||||
#include "../../common/getMeasurementMetaData.h"
|
||||
|
||||
namespace Recon
|
||||
{
|
||||
double estimateOffset(const MeasurementInfo aExpInfo, const CEInfo& aCe, const Aurora::Matrix& aMatchedFilter);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user