First update.
This commit is contained in:
@@ -5,6 +5,11 @@ project(UR)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc)
|
||||
enable_language(CUDA)
|
||||
find_package(CUDAToolkit REQUIRED)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
|
||||
|
||||
find_package(Aurora REQUIRED)
|
||||
find_package(Parser REQUIRED)
|
||||
find_package(Req REQUIRED)
|
||||
@@ -12,6 +17,7 @@ find_package(URDepends REQUIRED)
|
||||
find_package(DCMTK REQUIRED)
|
||||
set(DCMTK_WITH_JPEG OFF)
|
||||
file(GLOB_RECURSE cpp_files ./src/*.cpp)
|
||||
file(GLOB_RECURSE cu_files ./src/*.cu)
|
||||
file(GLOB_RECURSE cxx_files ./src/*.cxx)
|
||||
file(GLOB_RECURSE header_files ./src/*.h)
|
||||
add_executable(UR ${cpp_files} ${cxx_files} ${header_files} ${Aurora_Source})
|
||||
@@ -22,6 +28,7 @@ target_include_directories(UR PUBLIC ${DCMTK_INCLUDE_DIRS})
|
||||
target_include_directories(UR PUBLIC ${Req_INCLUDES_DIRS})
|
||||
target_include_directories(UR PUBLIC ${Parser_INCLUDE_DIRS})
|
||||
target_include_directories(UR PUBLIC ${URDepends_INCLUDES_DIRS})
|
||||
target_include_directories(UR PUBLIC ${DCMTK_INCLUDE_DIRS})
|
||||
target_link_libraries(UR PUBLIC ${Aurora_Libraries})
|
||||
target_link_libraries(UR PUBLIC dcmdata)
|
||||
target_link_libraries(UR PUBLIC matio)
|
||||
@@ -32,6 +39,22 @@ target_link_libraries(UR PUBLIC URDepends::TransDetection)
|
||||
target_link_libraries(UR PUBLIC URDepends::eikonal)
|
||||
target_link_libraries(UR PUBLIC URDepends::TVALGPU)
|
||||
target_link_libraries(UR PUBLIC URDepends::SaftTofi)
|
||||
target_link_libraries(UR PUBLIC dcmdata)
|
||||
|
||||
|
||||
target_include_directories(UR PRIVATE ./src /usr/local/cuda/include)
|
||||
set_target_properties(UR PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
||||
#target_compile_options(UR PRIVATE ${Aurora_Complie_Options} "-march=native")
|
||||
# target_compile_options(UR PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
|
||||
# --use_fast_math
|
||||
# --ptxas-options=-v
|
||||
# -arch sm_75
|
||||
# >)
|
||||
target_compile_options(UR PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
|
||||
-arch=sm_75
|
||||
>)
|
||||
target_link_libraries(UR PRIVATE ${CUDA_RUNTIME_LIBRARY} CUDA::cufft CUDA::cudart)
|
||||
|
||||
# target_link_libraries(UR PUBLIC URDepends::SaftATT)
|
||||
find_package(GTest REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
using namespace std;
|
||||
namespace {
|
||||
double getSpacing(double * startPoint, double* endPoint, int* imageXYZ, int index){
|
||||
return (endPoint[index]-startPoint[index])/(double)(imageXYZ[index])*1000.0;
|
||||
float getSpacing(float * startPoint, float* endPoint, int* imageXYZ, int index){
|
||||
return (endPoint[index]-startPoint[index])/(float)(imageXYZ[index])*1000.0;
|
||||
}
|
||||
|
||||
void initialDicomFile(DcmDataset* dataset,DcmMetaInfo* metaInfo)
|
||||
@@ -132,7 +132,7 @@ namespace Recon
|
||||
reflectParams::imageEndpoint.getData(), XYZ, aMatrix.getData(), type);
|
||||
}
|
||||
|
||||
void DICOMExporter::exportDCM(string path, double * startPoint, double* endPoint, int* imageXYZ,double* data, int type)
|
||||
void DICOMExporter::exportDCM(string path, float * startPoint, float* endPoint, int* imageXYZ,float* data, int type)
|
||||
{
|
||||
long Rows = imageXYZ[0], Cols = imageXYZ[1] ,Slices = imageXYZ[2];
|
||||
DcmFileFormat dcmFile;
|
||||
@@ -173,17 +173,17 @@ namespace Recon
|
||||
// dataset->putAndInsertString(DCM_ProtocolName, "?");
|
||||
|
||||
// initial spacing and position
|
||||
double spacing[3]{.0,.0,.0};
|
||||
float spacing[3]{.0,.0,.0};
|
||||
spacing[0] = getSpacing(startPoint,endPoint,imageXYZ,0);
|
||||
spacing[1] = getSpacing(startPoint,endPoint,imageXYZ,1);
|
||||
spacing[2] = getSpacing(startPoint,endPoint,imageXYZ,2);
|
||||
|
||||
double originPosition[3] = {
|
||||
endPoint[1]*1000.0,
|
||||
endPoint[2]*1000.0,
|
||||
endPoint[0]*1000.0,
|
||||
float originPosition[3] = {
|
||||
endPoint[1]*(float)1000.0,
|
||||
endPoint[2]*(float)1000.0,
|
||||
endPoint[0]*(float)1000.0,
|
||||
};
|
||||
double originLocation =endPoint[1]*1000.0;
|
||||
float originLocation =endPoint[1]*1000.0;
|
||||
dataset->putAndInsertString(DCM_SliceThickness, to_string(spacing[2]).data());
|
||||
dataset->putAndInsertUint16(DCM_Rows, Rows);
|
||||
dataset->putAndInsertUint16(DCM_Columns, Cols);
|
||||
@@ -191,11 +191,11 @@ namespace Recon
|
||||
dataset->putAndInsertString(DCM_PixelSpacing, spacingsBP.data());
|
||||
|
||||
// initial data, wwwl , Slope,Intercept
|
||||
double Slope = 1, Intercept = 0 ;
|
||||
float Slope = 1, Intercept = 0 ;
|
||||
size_t size = Rows*Cols*Slices;
|
||||
ushort* udata = new ushort[size]{0};
|
||||
double min = data[0];
|
||||
double max = data[0];
|
||||
float min = data[0];
|
||||
float max = data[0];
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
if (type == 0) data[i] = 1000*data[i];
|
||||
@@ -204,8 +204,8 @@ namespace Recon
|
||||
}
|
||||
|
||||
long windowCenter = min + (max-min)/2, windowWidth = max-min;
|
||||
double dSlope = 1.0/(pow(2,16)/windowWidth);
|
||||
double dIntercept = min;
|
||||
float dSlope = 1.0/(pow(2,16)/windowWidth);
|
||||
float dIntercept = min;
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
udata[i] = (ushort)((data[i] - min)/dSlope);
|
||||
|
||||
@@ -33,7 +33,7 @@ private:
|
||||
char mStudyInstanceUID[100]={0};
|
||||
char mSeriesInstanceUID[100]={0};
|
||||
PatientData mPatientData;
|
||||
void exportDCM(std::string path, double * startPoint, double* endPoint, int* imageXYZ,double* data, int type);
|
||||
void exportDCM(std::string path, float * startPoint, float* endPoint, int* imageXYZ,float* data, int type);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include <mkl_vml_defines.h>
|
||||
#include <mkl_vml_functions.h>
|
||||
|
||||
Aurora::Matrix Recon::adaptFrequency(Aurora::Matrix &aCE, double ceSampleFrequency, double requiredFrequency)
|
||||
Aurora::Matrix Recon::adaptFrequency(Aurora::Matrix &aCE, float ceSampleFrequency, float requiredFrequency)
|
||||
{
|
||||
if (requiredFrequency < ceSampleFrequency){
|
||||
double stride = ceSampleFrequency / (aCE.getDataSize() - 1);
|
||||
double *f2Data = Aurora::malloc(aCE.getDataSize());
|
||||
float stride = ceSampleFrequency / (aCE.getDataSize() - 1);
|
||||
float *f2Data = Aurora::malloc(aCE.getDataSize());
|
||||
for (size_t i = 0; i < aCE.getDataSize(); i++)
|
||||
{
|
||||
f2Data[i] = i*stride;
|
||||
@@ -20,20 +20,20 @@ Aurora::Matrix Recon::adaptFrequency(Aurora::Matrix &aCE, double ceSampleFrequen
|
||||
auto f2 = Aurora::Matrix::New(f2Data, aCE.getDataSize(), 1, 1);
|
||||
auto df = fft(aCE);
|
||||
df = df * (f2 < (requiredFrequency / 2));
|
||||
int halfdfLength = (int)std::ceil(((double)aCE.getDataSize()) * 0.5);
|
||||
int halfdfLength = (int)std::ceil(((float)aCE.getDataSize()) * 0.5);
|
||||
df.forceReshape(halfdfLength, 1, 1);
|
||||
aCE = Aurora::ifft_symmetric(df, aCE.getDataSize());
|
||||
}
|
||||
double *xData = Aurora::malloc(aCE.getDataSize());
|
||||
float *xData = Aurora::malloc(aCE.getDataSize());
|
||||
for (size_t i = 0; i < aCE.getDataSize(); i++)
|
||||
{
|
||||
xData[i] = (double)(i+1.0);
|
||||
xData[i] = (float)(i+1.0);
|
||||
}
|
||||
auto xMatrix = Aurora::Matrix::New(xData,aCE.getDataSize(),1,1);
|
||||
double stride = ceSampleFrequency /requiredFrequency;
|
||||
double value = 1.0;
|
||||
size_t length = std::ceil(((double)(aCE.getDataSize()-1))/stride);
|
||||
double *x1Data = Aurora::malloc(length);
|
||||
float stride = ceSampleFrequency /requiredFrequency;
|
||||
float value = 1.0;
|
||||
size_t length = std::ceil(((float)(aCE.getDataSize()-1))/stride);
|
||||
float *x1Data = Aurora::malloc(length);
|
||||
for (size_t i = 0; i < length; i++)
|
||||
{
|
||||
x1Data[i] = value;
|
||||
@@ -45,7 +45,7 @@ Aurora::Matrix Recon::adaptFrequency(Aurora::Matrix &aCE, double ceSampleFrequen
|
||||
return aCE;
|
||||
}
|
||||
|
||||
Aurora::Matrix Recon::preprocessCE(Aurora::Matrix &aCE, double ceSampleFrequency, double requiredFrequency, double expectedLength)
|
||||
Aurora::Matrix Recon::preprocessCE(Aurora::Matrix &aCE, float ceSampleFrequency, float requiredFrequency, float expectedLength)
|
||||
{
|
||||
adaptFrequency(aCE,ceSampleFrequency,requiredFrequency);
|
||||
aCE = aCE - Aurora::mean(aCE).getScalar();
|
||||
@@ -101,9 +101,9 @@ Aurora::Matrix Recon::reviseMatchedFilter(const Aurora::Matrix &aMFTime,
|
||||
sumDiff.getData()[k] = Aurora::sum(Aurora::abs(matchedFilter(Aurora::$, k).toMatrix() - maxMatchFilter)).getData()[0];
|
||||
}
|
||||
|
||||
double meansumDiff = Aurora::mean(sumDiff).getScalar();
|
||||
double stdSumDiff = Aurora::std(sumDiff).getScalar();
|
||||
double sumDiffJ = meansumDiff + 2.596 * stdSumDiff;
|
||||
float meansumDiff = Aurora::mean(sumDiff).getScalar();
|
||||
float stdSumDiff = Aurora::std(sumDiff).getScalar();
|
||||
float sumDiffJ = meansumDiff + 2.596 * stdSumDiff;
|
||||
for (int l = 0; l < sumDiff.getDataSize(); ++l)
|
||||
{
|
||||
if (sumDiff.getData()[l] > sumDiffJ)
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
namespace Recon
|
||||
{
|
||||
|
||||
Aurora::Matrix adaptFrequency(Aurora::Matrix &aCE,double ceSampleFrequency, double requiredFrequency);
|
||||
Aurora::Matrix adaptFrequency(Aurora::Matrix &aCE,float ceSampleFrequency, float requiredFrequency);
|
||||
// Aurora::Matrix preprocessMeasuredCE(Aurora::Matrix &aCEMeasured,int aBandpassundersampling,int aNumberSamples);
|
||||
Aurora::Matrix preprocessCE(Aurora::Matrix &aCE,double ceSampleFrequency, double requiredFrequency, double expectedLength);
|
||||
Aurora::Matrix preprocessCE(Aurora::Matrix &aCE,float ceSampleFrequency, float requiredFrequency, float expectedLength);
|
||||
Aurora::Matrix reviseMatchedFilter(const Aurora::Matrix &aMFTime,
|
||||
bool aRemoveOutliersFromCEMeasured);
|
||||
Aurora::Matrix createMatchedFilter(const Aurora::Matrix &aCE,
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
|
||||
namespace Recon
|
||||
{
|
||||
Aurora::Matrix reconstructBandpasssubsampling(Aurora::Matrix aMatrix, double aAScanReconstructionFreq, double aSampleRate)
|
||||
Aurora::Matrix reconstructBandpasssubsampling(Aurora::Matrix aMatrix, float aAScanReconstructionFreq, float aSampleRate)
|
||||
{
|
||||
double downsamplingfactor = aAScanReconstructionFreq / aSampleRate;
|
||||
double minimalExpectedAScanLength = 48;
|
||||
float downsamplingfactor = aAScanReconstructionFreq / aSampleRate;
|
||||
float minimalExpectedAScanLength = 48;
|
||||
int expectedAScanlengthDS = (int)std::ceil(minimalExpectedAScanLength/downsamplingfactor);
|
||||
double expectedAScanLength = std::max(expectedAScanlengthDS*downsamplingfactor, aMatrix.getDimSize(0)*downsamplingfactor);
|
||||
float expectedAScanLength = std::max(expectedAScanlengthDS*downsamplingfactor, aMatrix.getDimSize(0)*downsamplingfactor);
|
||||
expectedAScanlengthDS = std::ceil(expectedAScanLength/downsamplingfactor);
|
||||
|
||||
double s1 = aAScanReconstructionFreq;
|
||||
double f1Stride = s1 / (expectedAScanLength - 1);
|
||||
double * f1Data = Aurora::malloc(expectedAScanLength);
|
||||
float s1 = aAScanReconstructionFreq;
|
||||
float f1Stride = s1 / (expectedAScanLength - 1);
|
||||
float * f1Data = Aurora::malloc(expectedAScanLength);
|
||||
auto f1 = Aurora::Matrix::New(f1Data,expectedAScanLength,1,1);
|
||||
for (int i = 0; i<expectedAScanLength; ++i) {
|
||||
f1Data[i] = i*f1Stride;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Recon {
|
||||
* @param SampleRate
|
||||
* @return Aurora::Matrix
|
||||
*/
|
||||
Aurora::Matrix reconstructBandpasssubsampling(Aurora::Matrix aMatrix, double aAScanReconstructionFreq, double SampleRate);
|
||||
Aurora::Matrix reconstructBandpasssubsampling(Aurora::Matrix aMatrix, float aAScanReconstructionFreq, float SampleRate);
|
||||
|
||||
Aurora::Matrix convertToLinearIndices(Aurora::Matrix aVMatrixSize, Aurora::Matrix aMCoordinates);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace {
|
||||
const __m128i twokBlock =
|
||||
_mm_set_epi16(2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048);
|
||||
const uint CONVERT_ADD_VALUE = UINT32_MAX - 4095;
|
||||
void convert(short * ptr, double* des,bool single = false){
|
||||
void convert(short * ptr, float* des,bool single = false){
|
||||
// 初始化值
|
||||
auto value = _mm_set_epi16(ptr[0], ptr[1], ptr[2], ptr[3], single?ptr[0]:ptr[4], single?ptr[0]:ptr[5],
|
||||
single?ptr[0]:ptr[6], single?ptr[0]:ptr[7]);
|
||||
@@ -69,7 +69,7 @@ Aurora::Matrix Recon::convertfp16tofloat(Aurora::Matrix aMatrix) {
|
||||
auto input = aMatrix.getData();
|
||||
// uint16变换为float(32位)输出大小翻倍
|
||||
auto output = Aurora::malloc(aMatrix.getDataSize() * 4);
|
||||
size_t rows = aMatrix.getDataSize() * sizeof(double) / sizeof(short);
|
||||
size_t rows = aMatrix.getDataSize() * sizeof(float) / sizeof(short);
|
||||
size_t total_count = aMatrix.getDataSize();
|
||||
|
||||
|
||||
@@ -78,22 +78,22 @@ Aurora::Matrix Recon::convertfp16tofloat(Aurora::Matrix aMatrix) {
|
||||
// 循环展开以避免过度的线程调用
|
||||
if (i < total_count) {
|
||||
auto ptr = (short *)(input + i);
|
||||
double *des = output + i * 4;
|
||||
float *des = output + i * 4;
|
||||
::convert(ptr, des,i+1>total_count);
|
||||
}
|
||||
if (i+2 < total_count) {
|
||||
auto ptr = (short *)(input + i + 2);
|
||||
double *des = output + (i+2) * 4;
|
||||
float *des = output + (i+2) * 4;
|
||||
::convert(ptr, des,i+3>total_count);
|
||||
}
|
||||
if (i+4 < total_count) {
|
||||
auto ptr = (short *)(input + i + 4);
|
||||
double *des = output + (i+4) * 4;
|
||||
float *des = output + (i+4) * 4;
|
||||
::convert(ptr, des,i+5>total_count);
|
||||
}
|
||||
if (i+6 < total_count) {
|
||||
auto ptr = (short *)(input + i + 6);
|
||||
double *des = output + (i+6) * 4;
|
||||
float *des = output + (i+6) * 4;
|
||||
::convert(ptr, des,i+7>total_count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,12 @@ GeometryBlock Recon::blockingGeometryInfos(const GeometryInfo& aGeom, const Auro
|
||||
int numData = aRnBlock.getDimSize(1);
|
||||
Matrix arrayOfDataSize = zeros(1, numData, 1) + 1;
|
||||
int dim = aGeom.receiverPositions[0].getDimSize(0);
|
||||
double* receiverPositionBlockData = Aurora::malloc(dim * numData);
|
||||
double* receiverNormalBlockData = Aurora::malloc(dim * numData);
|
||||
float* receiverPositionBlockData = Aurora::malloc(dim * numData);
|
||||
float* receiverNormalBlockData = Aurora::malloc(dim * numData);
|
||||
result.receiverPositionBlock = Matrix::New(receiverPositionBlockData, dim, numData);
|
||||
result.receiverNormalBlock = Matrix::New(receiverNormalBlockData, dim, numData);
|
||||
|
||||
double* sizeData = Aurora::malloc(4);
|
||||
float* sizeData = Aurora::malloc(4);
|
||||
sizeData[0] = aGeom.receiverPositions[0].getDimSize(0);
|
||||
sizeData[1] = aGeom.receiverPositions[0].getDimSize(1);
|
||||
sizeData[2] = aGeom.receiverPositions[0].getDimSize(2);
|
||||
@@ -43,8 +43,8 @@ GeometryBlock Recon::blockingGeometryInfos(const GeometryInfo& aGeom, const Auro
|
||||
}
|
||||
}
|
||||
|
||||
double* senderPositionBlockData = Aurora::malloc(dim * numData);
|
||||
double* senderNormalBlockData = Aurora::malloc(dim * numData);
|
||||
float* senderPositionBlockData = Aurora::malloc(dim * numData);
|
||||
float* senderNormalBlockData = Aurora::malloc(dim * numData);
|
||||
result.senderPositionBlock = Matrix::New(senderPositionBlockData, dim, numData);
|
||||
result.senderNormalBlock = Matrix::New(senderNormalBlockData, dim, numData);
|
||||
sizeData = Aurora::malloc(4);
|
||||
|
||||
@@ -47,13 +47,13 @@ AscanBlock Recon::getAscanBlock(Parser* aParser, const Aurora::Matrix& aMp, cons
|
||||
size_t numScans = aMp.getDataSize() * aSl.getDataSize() * aSn.getDataSize() * aRl.getDataSize() * aRn.getDataSize();
|
||||
//size_t numScansIndex = 0;
|
||||
int ascanBlockSize = numScans * aParser->getMetaData().getSampleNumber();
|
||||
double* ascanBlockData = new double[ascanBlockSize];
|
||||
double* mpBlockData = new double[numScans];
|
||||
double* slBlockData = new double[numScans];
|
||||
double* snBlockData = new double[numScans];
|
||||
double* rlBlockData = new double[numScans];
|
||||
double* rnBlockData = new double[numScans];
|
||||
double* gainBlockData = new double[numScans];
|
||||
float* ascanBlockData = new float[ascanBlockSize];
|
||||
float* mpBlockData = new float[numScans];
|
||||
float* slBlockData = new float[numScans];
|
||||
float* snBlockData = new float[numScans];
|
||||
float* rlBlockData = new float[numScans];
|
||||
float* rnBlockData = new float[numScans];
|
||||
float* gainBlockData = new float[numScans];
|
||||
result.ascanBlock = Matrix::fromRawData(ascanBlockData, aParser->getMetaData().getSampleNumber(), numScans);
|
||||
result.mpBlock = Matrix::fromRawData(mpBlockData, 1, numScans);
|
||||
result.slBlock = Matrix::fromRawData(slBlockData, 1, numScans);
|
||||
@@ -85,7 +85,7 @@ AscanBlock Recon::getAscanBlock(Parser* aParser, const Aurora::Matrix& aMp, cons
|
||||
mpIndex * aRl.getDataSize() * aRn.getDataSize() * aSn.getDataSize() * aSl.getDataSize();
|
||||
MotorPosition mp = aMp[mpIndex] == 1 ? MotorPosition::MotorPosition1 : MotorPosition::MotorPosition2;
|
||||
AScanData ascan = aParser->searchAscanDataFromOneTasAscanDataOfMP(oneTasData, ElementIndex(GeometryIndex(aSn[snIndex])), TasElementIndex(tasIndices.get()[tasElementMapper[mapperIndex]], ElementIndex(GeometryIndex(receiverIndices.get()[tasElementMapper[mapperIndex]]))), mp);
|
||||
double* startPointer = ascanBlockData + numScansIndex * ascan.getAscanDataLength();
|
||||
float* startPointer = ascanBlockData + numScansIndex * ascan.getAscanDataLength();
|
||||
std::copy(ascan.get() ,ascan.get() + ascan.getAscanDataLength(), startPointer);
|
||||
//ascanBlockData += ascan.getAscanDataLength();
|
||||
mpBlockData[numScansIndex] = aMp[mpIndex];
|
||||
|
||||
@@ -14,7 +14,7 @@ Aurora::Matrix Recon::removeDataFromArrays(const Aurora::Matrix& aOutPutMatrix,
|
||||
{
|
||||
size_t columnSize = sum(aRemoveList, FunctionDirection::All)[0];
|
||||
size_t rowSize = aOutPutMatrix.getDimSize(0);
|
||||
double* resultData = Aurora::malloc(columnSize * rowSize);
|
||||
float* resultData = Aurora::malloc(columnSize * rowSize);
|
||||
Matrix result = Matrix::New(resultData, rowSize, columnSize);
|
||||
std::vector<std::pair<int,size_t>> copyList;
|
||||
size_t length = 0;
|
||||
@@ -39,12 +39,12 @@ Aurora::Matrix Recon::removeDataFromArrays(const Aurora::Matrix& aOutPutMatrix,
|
||||
copyList.push_back({end - length + 1, length});
|
||||
}
|
||||
|
||||
double* start = aOutPutMatrix.getData();
|
||||
float* start = aOutPutMatrix.getData();
|
||||
|
||||
for(size_t i=0; i<copyList.size(); ++i)
|
||||
{
|
||||
size_t copyLength = copyList[i].second * rowSize;
|
||||
cblas_dcopy(copyLength, start + copyList[i].first * rowSize, 1, resultData, 1);
|
||||
cblas_scopy(copyLength, start + copyList[i].first * rowSize, 1, resultData, 1);
|
||||
resultData += copyLength;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
using namespace Aurora;
|
||||
|
||||
double Recon::estimatePulseLength(const CeEstimatePulseLength& aCe, double aSampleFreq)
|
||||
float Recon::estimatePulseLength(const CeEstimatePulseLength& aCe, float aSampleFreq)
|
||||
{
|
||||
Matrix value1 = abs(hilbert(aCe.ce));
|
||||
double value2 = 0.05 * max(abs(hilbert(aCe.ce)),All)[0];
|
||||
float value2 = 0.05 * max(abs(hilbert(aCe.ce)),All)[0];
|
||||
std::vector<size_t> t;
|
||||
for(size_t i=0; i<value1.getDataSize(); ++i)
|
||||
{
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace Recon
|
||||
struct CeEstimatePulseLength
|
||||
{
|
||||
Aurora::Matrix ce;
|
||||
double ce_sf;
|
||||
float ce_sf;
|
||||
};
|
||||
|
||||
double estimatePulseLength(const CeEstimatePulseLength& aCe, double aSampleFreq);
|
||||
float estimatePulseLength(const CeEstimatePulseLength& aCe, float aSampleFreq);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -19,10 +19,10 @@ namespace
|
||||
{
|
||||
Matrix loadSensitivity()
|
||||
{
|
||||
double* senseRevise = new double[Recon::ANGLE_CORRECTION_SIZE - 1];
|
||||
float* senseRevise = new float[Recon::ANGLE_CORRECTION_SIZE - 1];
|
||||
std::reverse_copy(ANGLE_CORRECTION.getData(), ANGLE_CORRECTION.getData() + Recon::ANGLE_CORRECTION_SIZE - 1, senseRevise);
|
||||
size_t fullSens1DSize = Recon::ANGLE_CORRECTION_SIZE * 2 - 1;
|
||||
double* fullSens1DData = new double[fullSens1DSize];
|
||||
float* fullSens1DData = new float[fullSens1DSize];
|
||||
std::copy(ANGLE_CORRECTION.getData(), ANGLE_CORRECTION.getData() + Recon::ANGLE_CORRECTION_SIZE, fullSens1DData);
|
||||
std::copy(senseRevise, senseRevise + Recon::ANGLE_CORRECTION_SIZE - 1, fullSens1DData + Recon::ANGLE_CORRECTION_SIZE);
|
||||
Matrix fullSens1D = Matrix::fromRawData(fullSens1DData, 1, fullSens1DSize);
|
||||
@@ -35,7 +35,7 @@ Matrix loadSensitivity()
|
||||
Matrix y0 = linspace(-90,90,fullSens1D.getDataSize());
|
||||
Matrix x1 = linspace(-90,90,181);
|
||||
Matrix y1 = linspace(-90,90,181);
|
||||
double* resultData = new double[y1.getDataSize() * x1.getDataSize()];
|
||||
float* resultData = new float[y1.getDataSize() * x1.getDataSize()];
|
||||
Matrix result = Matrix::fromRawData(resultData, y1.getDataSize(), x1.getDataSize());
|
||||
std::vector<Matrix> resultTemp(181);
|
||||
#pragma omp parallel for
|
||||
@@ -63,7 +63,7 @@ Matrix rotateAndTranslate(const Matrix& transMat, Matrix& aGeometryMatrix)
|
||||
void transformGeometry(const Matrix& aMotorPos, const Matrix& aTransformationMatrices,
|
||||
const Matrix aRlList, const Matrix aRnList, const Matrix aSlList, const Matrix aSnList, GeometryInfo& aOutput)
|
||||
{
|
||||
double motorPos = max(aMotorPos)[0];
|
||||
float motorPos = max(aMotorPos)[0];
|
||||
|
||||
for(int m=0; m<motorPos; ++m)
|
||||
{
|
||||
@@ -91,8 +91,8 @@ void transformGeometry(const Matrix& aMotorPos, const Matrix& aTransformationMat
|
||||
|
||||
Matrix senderNormal = Aurora::zeros(3, max(aSnList)[0], max(aSlList)[0]) + NAN;
|
||||
Matrix senderPosition = Aurora::zeros(3, max(aSnList)[0], max(aSlList)[0]) + NAN;
|
||||
double maxSl = max(aSlList)[0];
|
||||
double maxSn = max(aSnList)[0];
|
||||
float maxSl = max(aSlList)[0];
|
||||
float maxSn = max(aSnList)[0];
|
||||
for(int i=0; i<aSlList.getDataSize(); ++i)
|
||||
{
|
||||
for(int j=0; j<aSnList.getDataSize(); ++j)
|
||||
@@ -116,15 +116,15 @@ void transformGeometry(const Matrix& aMotorPos, const Matrix& aTransformationMat
|
||||
void getApertureBoundingBox(GeometryInfo& aOutput)
|
||||
{
|
||||
//Emitter
|
||||
double* minEmitterData = new double[3];
|
||||
double* maxEmitterData = new double[3];
|
||||
float* minEmitterData = new float[3];
|
||||
float* maxEmitterData = new float[3];
|
||||
|
||||
size_t emitterSize = emitterPositions.size() * emitterPositions[0].getDimSize(0);
|
||||
double* emitterXData = new double[emitterSize];
|
||||
float* emitterXData = new float[emitterSize];
|
||||
Matrix emitterX = Matrix::fromRawData(emitterXData, emitterSize);
|
||||
double* emitterYData = new double[emitterSize];
|
||||
float* emitterYData = new float[emitterSize];
|
||||
Matrix emitterY = Matrix::fromRawData(emitterYData, emitterSize);
|
||||
double* emitterZData = new double[emitterSize];
|
||||
float* emitterZData = new float[emitterSize];
|
||||
Matrix emitterZ = Matrix::fromRawData(emitterZData, emitterSize);
|
||||
for(int i=0; i<emitterPositions.size(); ++i)
|
||||
{
|
||||
@@ -151,15 +151,15 @@ void getApertureBoundingBox(GeometryInfo& aOutput)
|
||||
aOutput.maxEmitter = Matrix::fromRawData(maxEmitterData, 3);
|
||||
|
||||
//Receiver
|
||||
double* minReceiverData = new double[3];
|
||||
double* maxReceiverData = new double[3];
|
||||
float* minReceiverData = new float[3];
|
||||
float* maxReceiverData = new float[3];
|
||||
|
||||
size_t receiverSize = receiverPositions.size() * receiverPositions[0].getDimSize(0);
|
||||
double* receiverXData = new double[receiverSize];
|
||||
float* receiverXData = new float[receiverSize];
|
||||
Matrix receiverX = Matrix::fromRawData(receiverXData, receiverSize);
|
||||
double* receiverYData = new double[receiverSize];
|
||||
float* receiverYData = new float[receiverSize];
|
||||
Matrix receiverY = Matrix::fromRawData(receiverYData, receiverSize);
|
||||
double* receiverZData = new double[receiverSize];
|
||||
float* receiverZData = new float[receiverSize];
|
||||
Matrix receiverZ = Matrix::fromRawData(receiverZData, receiverSize);
|
||||
for(int i=0; i<receiverPositions.size(); ++i)
|
||||
{
|
||||
|
||||
@@ -15,11 +15,11 @@ namespace Recon
|
||||
Aurora::Matrix maxEmitter;
|
||||
Aurora::Matrix maxReceiver;
|
||||
Aurora::Matrix maxSize;
|
||||
double maxSL;
|
||||
double maxSN;
|
||||
double maxRL;
|
||||
double maxRN;
|
||||
double numTAS;
|
||||
float maxSL;
|
||||
float maxSN;
|
||||
float maxRL;
|
||||
float maxRN;
|
||||
float numTAS;
|
||||
std::vector<Aurora::Matrix> senderNormals;
|
||||
std::vector<Aurora::Matrix> receiverNormals;
|
||||
std::vector<Aurora::Matrix> senderPositions;
|
||||
|
||||
@@ -24,7 +24,7 @@ using namespace Aurora;
|
||||
|
||||
Matrix Recon::getAvailableMotorPositions(Parser* aParser)
|
||||
{
|
||||
std::vector<double> mpData;
|
||||
std::vector<float> mpData;
|
||||
if(aParser->hasCEMeasured())
|
||||
{
|
||||
mpData.push_back(0);
|
||||
@@ -72,11 +72,11 @@ TransFormInfo Recon::getTransformationMatrix(Parser* aParser, const Matrix& aMot
|
||||
int columns = 2;//一个角度一个高度
|
||||
unsigned long long length = listRealData.getLength();
|
||||
int rows = length / columns;
|
||||
double* data = new double[length];
|
||||
float* data = new float[length];
|
||||
std::copy(listRealData.get(), listRealData.get() + length, data);
|
||||
std::vector<int> info = {rows, columns, 1};
|
||||
Matrix movementsListReal(std::shared_ptr<double>(data, std::default_delete<double[]>()), info);
|
||||
double* motorPosListAvailableData = Aurora::malloc(rows);
|
||||
Matrix movementsListReal(std::shared_ptr<float>(data, std::default_delete<float[]>()), info);
|
||||
float* motorPosListAvailableData = Aurora::malloc(rows);
|
||||
for(int i=0; i<rows; ++i)
|
||||
{
|
||||
motorPosListAvailableData[i] = i + 1;
|
||||
@@ -93,13 +93,13 @@ TransFormInfo Recon::getTransformationMatrix(Parser* aParser, const Matrix& aMot
|
||||
if(movementRealAvailable)
|
||||
{
|
||||
int maxMotorPosNum = motorPosList.getDimSize(0);
|
||||
double* transformationMatrixListData = Aurora::malloc(16*maxMotorPosNum);
|
||||
double zero = 0.0;
|
||||
cblas_dcopy(16*maxMotorPosNum,&zero,0,transformationMatrixListData,1);
|
||||
float* transformationMatrixListData = Aurora::malloc(16*maxMotorPosNum);
|
||||
float zero = 0.0;
|
||||
cblas_scopy(16*maxMotorPosNum,&zero,0,transformationMatrixListData,1);
|
||||
for(int i=0; i<maxMotorPosNum; ++i)
|
||||
{
|
||||
double rotation = movementsListReal.getData()[i];
|
||||
double distance = movementsListReal.getData()[i + aParser->getMetaData().getAperturePositionNumber()];
|
||||
float rotation = movementsListReal.getData()[i];
|
||||
float distance = movementsListReal.getData()[i + aParser->getMetaData().getAperturePositionNumber()];
|
||||
transformationMatrixListData[16*i + 0] = cos(rotation*PI/180);
|
||||
transformationMatrixListData[16*i + 1] = sin(rotation*PI/180);
|
||||
transformationMatrixListData[16*i + 4] = -sin(rotation*PI/180);
|
||||
@@ -114,7 +114,7 @@ TransFormInfo Recon::getTransformationMatrix(Parser* aParser, const Matrix& aMot
|
||||
{
|
||||
auto rotationMatrix = aParser->getMovementData().getRotationMatrix();
|
||||
int maxMotorPosNum = motorPosList.getDimSize(0);
|
||||
double* transformationMatrixListData = new double[16*maxMotorPosNum];
|
||||
float* transformationMatrixListData = new float[16*maxMotorPosNum];
|
||||
for(size_t i=0; i<maxMotorPosNum; ++i)
|
||||
{
|
||||
std::copy(rotationMatrix.at(i).get(), rotationMatrix.at(i).get()+16, transformationMatrixListData + i*16);
|
||||
@@ -130,26 +130,26 @@ Matrix Recon::temperatureToSoundSpeed(const Matrix& aTemperature, const std::str
|
||||
Matrix result;
|
||||
if (aMethod == "marczak")
|
||||
{
|
||||
double* kData = new double[6] {2.78786e-9, -1.398845e-6, 3.287156e-4, -5.799136e-2, 5.038813, 1.402385e3};
|
||||
float* kData = new float[6] {2.78786e-9, -1.398845e-6, 3.287156e-4, -5.799136e-2, 5.038813, 1.402385e3};
|
||||
Matrix k = Matrix::fromRawData(kData, 6);
|
||||
result = polyval(k, aTemperature);
|
||||
}
|
||||
else if(aMethod == "mader")
|
||||
{
|
||||
double* kData = new double[6] {3.14643e-9, -1.478e-6, 0.000334199, -0.0580852, 5.03711, 1402.39};
|
||||
float* kData = new float[6] {3.14643e-9, -1.478e-6, 0.000334199, -0.0580852, 5.03711, 1402.39};
|
||||
Matrix k = Matrix::fromRawData(kData, 6);
|
||||
result = polyval(k, aTemperature);
|
||||
}
|
||||
else if(aMethod == "jan")
|
||||
{
|
||||
double speedData = 1557 - 0.0245 * pow((74 - aTemperature.getData()[0]), 2);
|
||||
result = Matrix::fromRawData(new double[1] {speedData}, 1);
|
||||
float speedData = 1557 - 0.0245 * pow((74 - aTemperature.getData()[0]), 2);
|
||||
result = Matrix::fromRawData(new float[1] {speedData}, 1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//已验证,完全正确
|
||||
TempInfo Recon::getTemperatureInfo(Parser* aParser, double aNumTas)
|
||||
TempInfo Recon::getTemperatureInfo(Parser* aParser, float aNumTas)
|
||||
{
|
||||
TempInfo result;
|
||||
//jumoTemp
|
||||
@@ -173,7 +173,7 @@ TempInfo Recon::getTemperatureInfo(Parser* aParser, double aNumTas)
|
||||
jumoTempNum = jumoTemp4.getLength();
|
||||
}
|
||||
|
||||
double* jumoTempData = Aurora::malloc(jumoTempNum * 4);
|
||||
float* jumoTempData = Aurora::malloc(jumoTempNum * 4);
|
||||
for(int i=0; i<jumoTempNum; ++i)
|
||||
{
|
||||
jumoTempData[4*i] = jumoTemp1.get()[i];
|
||||
@@ -209,7 +209,7 @@ TempInfo Recon::getTemperatureInfo(Parser* aParser, double aNumTas)
|
||||
{
|
||||
size_t tasTempLength = aParser->getTemperatureData().getTasTemperature()[0].getLength();
|
||||
float* fromTasTempData = aParser->getTemperatureData().getTasTemperature()[0].get();
|
||||
double* tasTempData = new double[tasTempLength];
|
||||
float* tasTempData = new float[tasTempLength];
|
||||
std::copy(fromTasTempData, fromTasTempData+ tasTempLength, tasTempData);
|
||||
Matrix tasTemp = Matrix::fromRawData(tasTempData, 2, tasTempLength / 2);
|
||||
|
||||
@@ -279,7 +279,7 @@ CEInfo Recon::getCEInfo(Parser* aParser, const MeasurementInfo aInfo)
|
||||
}
|
||||
else
|
||||
{
|
||||
double* ceData = new double[ceMeasuredLength * ceMeasuredPointer.getSize()];
|
||||
float* ceData = new float[ceMeasuredLength * ceMeasuredPointer.getSize()];
|
||||
std::copy(ceMeasuredData, ceMeasuredData + ceMeasuredLength * ceMeasuredPointer.getSize(), ceData);
|
||||
ce = Matrix::fromRawData(ceData, ceMeasuredLength, ceMeasuredPointer.getSize());
|
||||
}
|
||||
@@ -306,13 +306,13 @@ CEInfo Recon::getCEInfo(Parser* aParser, const MeasurementInfo aInfo)
|
||||
{
|
||||
size_t size = aParser->getMetaData().getTasIndices().getLength();
|
||||
uint8_t* fromData = aParser->getMetaData().getTasIndices().get();
|
||||
double* tasIndicesData = new double[size];
|
||||
float* tasIndicesData = new float[size];
|
||||
std::copy(fromData, fromData + size, tasIndicesData);
|
||||
result.tasIndices = Matrix::fromRawData(tasIndicesData, size);
|
||||
|
||||
size = aParser->getMetaData().getReceiverIndices().getLength();
|
||||
fromData = aParser->getMetaData().getReceiverIndices().get();
|
||||
double* receiverIndicesData = new double[size];
|
||||
float* receiverIndicesData = new float[size];
|
||||
std::copy(fromData, fromData + size, receiverIndicesData);
|
||||
result.receiverIndices = Matrix::fromRawData(receiverIndicesData, size);
|
||||
}
|
||||
@@ -330,7 +330,7 @@ CEInfo Recon::getCEInfo(Parser* aParser, const MeasurementInfo aInfo)
|
||||
{
|
||||
result.ceAvailable = true;
|
||||
size_t ceRefSize = ceRefFromData.getLength();
|
||||
double* ceRefData = new double[ceRefSize];
|
||||
float* ceRefData = new float[ceRefSize];
|
||||
std::copy(ceRefFromData.get(), ceRefFromData.get() + ceRefSize, ceRefData);
|
||||
Matrix ceRefCE = Matrix::fromRawData(ceRefData, ceRefSize);
|
||||
result.ceRef = preprocessCE(ceRefCE, result.ceRef_sf, reflectParams::aScanReconstructionFrequency, aInfo.expectedAScanLength);
|
||||
|
||||
@@ -20,26 +20,26 @@ namespace Recon
|
||||
int Wavelength;
|
||||
unsigned int expectedAScanLength;
|
||||
std::string rootMeasUniqueID;
|
||||
double dacDelay;
|
||||
double filterByPass;
|
||||
float dacDelay;
|
||||
float filterByPass;
|
||||
Aurora::Matrix matchedFilter;
|
||||
};
|
||||
|
||||
struct CEInfo
|
||||
{
|
||||
Aurora::Matrix ce;
|
||||
double ceOffSet;
|
||||
double ce_sf;
|
||||
float ceOffSet;
|
||||
float ce_sf;
|
||||
Aurora::Matrix tasIndices;
|
||||
Aurora::Matrix receiverIndices;
|
||||
Aurora::Matrix ceRef;
|
||||
double ceRefOffSet;
|
||||
double ceRef_sf;
|
||||
float ceRefOffSet;
|
||||
float ceRef_sf;
|
||||
bool measuredCEUsed;
|
||||
bool measuredCEAvailable;
|
||||
bool ceAvailable;
|
||||
double offsetFilterEnabled;
|
||||
double offsetFilterDisabled;
|
||||
float offsetFilterEnabled;
|
||||
float offsetFilterDisabled;
|
||||
};
|
||||
|
||||
struct TempInfo
|
||||
@@ -60,19 +60,19 @@ namespace Recon
|
||||
{
|
||||
Aurora::Matrix matchedFilter;
|
||||
Aurora::Matrix matchedFilterRef;
|
||||
double timeInterval;
|
||||
float timeInterval;
|
||||
bool measuredCEUsed;
|
||||
Aurora::Matrix measuredCE_TASIndices;
|
||||
Aurora::Matrix measuredCE_receiverIndices;
|
||||
Aurora::Matrix sincPeak_ft;
|
||||
double offset;
|
||||
float offset;
|
||||
};
|
||||
|
||||
//无用函数
|
||||
Aurora::Matrix getAvailableMotorPositions(Parser* aParser);
|
||||
MeasurementInfo loadMeasurementInfos(Parser* aParser);
|
||||
TransFormInfo getTransformationMatrix(Parser* aParser, const Aurora::Matrix& aMotorPosList);
|
||||
TempInfo getTemperatureInfo(Parser* aParser, double aNumTas);
|
||||
TempInfo getTemperatureInfo(Parser* aParser, float aNumTas);
|
||||
CEInfo getCEInfo(Parser* aParser, const MeasurementInfo aInfo);
|
||||
Aurora::Matrix temperatureToSoundSpeed(const Aurora::Matrix& aTemperature, const std::string& aMethod);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using namespace Recon;
|
||||
|
||||
namespace
|
||||
{
|
||||
double USCTTAS2DAQChannels(double aRl, double aRn, const MeasurementInfo& aExpInfo, const PreComputes& aPreComputes)
|
||||
float USCTTAS2DAQChannels(float aRl, float aRn, const MeasurementInfo& aExpInfo, const PreComputes& aPreComputes)
|
||||
{
|
||||
size_t size = aPreComputes.measuredCE_receiverIndices.getDataSize();
|
||||
if(aExpInfo.Hardware == "USCT3dv2")
|
||||
@@ -36,7 +36,7 @@ Aurora::Matrix Recon::precalculateChannelList(const Aurora::Matrix& aRlList, con
|
||||
{
|
||||
int rows = aRlList.getDataSize();
|
||||
int columns = aRnList.getDataSize();
|
||||
double* resultData = Aurora::malloc(rows * columns);
|
||||
float* resultData = Aurora::malloc(rows * columns);
|
||||
for(int i=0; i<columns; ++i)
|
||||
{
|
||||
for(int j=0; j<rows; ++j)
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
using namespace Recon;
|
||||
using namespace Aurora;
|
||||
|
||||
void Recon::qualityReview(double aNumValiData, double aNumTotalData)
|
||||
void Recon::qualityReview(float aNumValiData, float aNumTotalData)
|
||||
{
|
||||
double score = aNumValiData / aNumTotalData;
|
||||
float score = aNumValiData / aNumTotalData;
|
||||
//to do, 输出报警用
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace Recon
|
||||
{
|
||||
void qualityReview(double aNumValiData, double aNumTotalData);
|
||||
void qualityReview(float aNumValiData, float aNumTotalData);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -6,10 +6,10 @@ using namespace Aurora;
|
||||
|
||||
namespace
|
||||
{
|
||||
double getTemperatureForTas(const Matrix& aTasTemperature, double aTasNum, double aMotorPos, const Matrix& aReferenceTemps,
|
||||
double aMinTemperature, double aMaxTemperature)
|
||||
float getTemperatureForTas(const Matrix& aTasTemperature, float aTasNum, float aMotorPos, const Matrix& aReferenceTemps,
|
||||
float aMinTemperature, float aMaxTemperature)
|
||||
{
|
||||
double result = NAN;
|
||||
float result = NAN;
|
||||
if(aMotorPos == 1)
|
||||
{
|
||||
for(int i=0; i<aTasTemperature.getDimSize(1); ++i)
|
||||
@@ -49,10 +49,10 @@ namespace
|
||||
|
||||
|
||||
Matrix Recon::extractTasTemperature(const Matrix& aTasTemperature, const Matrix& aTasList, const Matrix& aMotorPosList, const Matrix& aDefaultTemps,
|
||||
double aMinTemperature, double aMaxTemperature)
|
||||
float aMinTemperature, float aMaxTemperature)
|
||||
{
|
||||
size_t resultSize = aTasList.getDataSize() * aMotorPosList.getDataSize();
|
||||
double* resultData = Aurora::malloc(resultSize);
|
||||
float* resultData = Aurora::malloc(resultSize);
|
||||
for(int i=0; i<aMotorPosList.getDataSize(); ++i)
|
||||
{
|
||||
for(int j=0; j<aTasList.getDataSize(); ++j)
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Recon
|
||||
};
|
||||
|
||||
Aurora::Matrix extractTasTemperature(const Aurora::Matrix& aTasTemperature, const Aurora::Matrix& aTasList, const Aurora::Matrix& aMotorPosList,
|
||||
const Aurora::Matrix& aDefaultTemps,double aMinTemperature, double aMaxTemperature);
|
||||
const Aurora::Matrix& aDefaultTemps,float aMinTemperature, float aMaxTemperature);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -17,8 +17,8 @@ namespace Recon
|
||||
{
|
||||
if(aJsonObj.is_array())
|
||||
{
|
||||
std::vector<double> vec = aJsonObj.get<std::vector<double>>();
|
||||
double* data = vec.data();
|
||||
std::vector<float> vec = aJsonObj.get<std::vector<float>>();
|
||||
float* data = vec.data();
|
||||
int size = vec.size();
|
||||
if(aIsHorizontal)
|
||||
{
|
||||
@@ -29,8 +29,8 @@ namespace Recon
|
||||
|
||||
if(aJsonObj.is_number())
|
||||
{
|
||||
double value = aJsonObj.get<double>();
|
||||
return Aurora::Matrix::fromRawData(new double[1]{value}, 1);
|
||||
float value = aJsonObj.get<float>();
|
||||
return Aurora::Matrix::fromRawData(new float[1]{value}, 1);
|
||||
}
|
||||
|
||||
return Aurora::Matrix();
|
||||
@@ -66,11 +66,11 @@ namespace Recon
|
||||
}
|
||||
if(ce.contains("offsetFilterEnabled"))
|
||||
{
|
||||
reconParams::offsetFilterEnabled = ce.at("offsetFilterEnabled").get<double>();
|
||||
reconParams::offsetFilterEnabled = ce.at("offsetFilterEnabled").get<float>();
|
||||
}
|
||||
if(ce.contains("offsetFilterDisabled"))
|
||||
{
|
||||
reconParams::offsetFilterDisabled = ce.at("offsetFilterDisabled").get<double>();
|
||||
reconParams::offsetFilterDisabled = ce.at("offsetFilterDisabled").get<float>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,11 +195,11 @@ namespace Recon
|
||||
}
|
||||
if(qualityCheck.contains("warningThreshold"))
|
||||
{
|
||||
reflectParams::warningThreshold = qualityCheck.at("warningThreshold").get<double>();
|
||||
reflectParams::warningThreshold = qualityCheck.at("warningThreshold").get<float>();
|
||||
}
|
||||
if(qualityCheck.contains("errorThreshold"))
|
||||
{
|
||||
reflectParams::errorThreshold = qualityCheck.at("errorThreshold").get<double>();
|
||||
reflectParams::errorThreshold = qualityCheck.at("errorThreshold").get<float>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace Recon
|
||||
}
|
||||
if(dataPreparation.contains("offsetElectronic"))
|
||||
{
|
||||
reflectParams::offsetElectronic = dataPreparation.at("offsetElectronic").get<double>();
|
||||
reflectParams::offsetElectronic = dataPreparation.at("offsetElectronic").get<float>();
|
||||
}
|
||||
if(dataPreparation.contains("removeDCOffset"))
|
||||
{
|
||||
@@ -229,11 +229,11 @@ namespace Recon
|
||||
nlohmann::json imageInfos = params.at("imageInfos");
|
||||
if(imageInfos.contains("pixelResolutionX"))
|
||||
{
|
||||
reflectParams::pixelResolutionX = imageInfos.at("pixelResolutionX").get<double>();
|
||||
reflectParams::pixelResolutionX = imageInfos.at("pixelResolutionX").get<float>();
|
||||
}
|
||||
if(imageInfos.contains("pixelResolutionY"))
|
||||
{
|
||||
reflectParams::pixelResolutionY = imageInfos.at("pixelResolutionY").get<double>();
|
||||
reflectParams::pixelResolutionY = imageInfos.at("pixelResolutionY").get<float>();
|
||||
}
|
||||
if(imageInfos.contains("imageStartpoint"))
|
||||
{
|
||||
@@ -319,7 +319,7 @@ namespace Recon
|
||||
}
|
||||
if(transmissionCorrection.contains("resolutionTransmMap"))
|
||||
{
|
||||
reflectParams::resolutionTransmMap = transmissionCorrection.at("resolutionTransmMap").get<double>();
|
||||
reflectParams::resolutionTransmMap = transmissionCorrection.at("resolutionTransmMap").get<float>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ namespace Recon
|
||||
}
|
||||
if(dataSelection.contains("sensFilter"))
|
||||
{
|
||||
transParams::sensFilter = dataSelection.at("sensFilter").get<double>();
|
||||
transParams::sensFilter = dataSelection.at("sensFilter").get<float>();
|
||||
}
|
||||
if(dataSelection.contains("angleLowerLimit"))
|
||||
{
|
||||
@@ -456,11 +456,11 @@ namespace Recon
|
||||
}
|
||||
if(qualityCheck.contains("warningThreshold"))
|
||||
{
|
||||
transParams::warningThreshold = qualityCheck.at("warningThreshold").get<double>();
|
||||
transParams::warningThreshold = qualityCheck.at("warningThreshold").get<float>();
|
||||
}
|
||||
if(qualityCheck.contains("errorThreshold"))
|
||||
{
|
||||
transParams::errorThreshold = qualityCheck.at("errorThreshold").get<double>();
|
||||
transParams::errorThreshold = qualityCheck.at("errorThreshold").get<float>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,7 +490,7 @@ namespace Recon
|
||||
}
|
||||
if(dataPreparation.contains("offsetElectronic"))
|
||||
{
|
||||
transParams::offsetElectronic = dataPreparation.at("offsetElectronic").get<double>();
|
||||
transParams::offsetElectronic = dataPreparation.at("offsetElectronic").get<float>();
|
||||
}
|
||||
if(dataPreparation.contains("aScanReconstructionFrequency"))
|
||||
{
|
||||
@@ -498,11 +498,11 @@ namespace Recon
|
||||
}
|
||||
if(dataPreparation.contains("minTemperature"))
|
||||
{
|
||||
transParams::minTemperature = dataPreparation.at("minTemperature").get<double>();
|
||||
transParams::minTemperature = dataPreparation.at("minTemperature").get<float>();
|
||||
}
|
||||
if(dataPreparation.contains("maxTemperature"))
|
||||
{
|
||||
transParams::maxTemperature = dataPreparation.at("maxTemperature").get<double>();
|
||||
transParams::maxTemperature = dataPreparation.at("maxTemperature").get<float>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,16 +628,16 @@ namespace Recon
|
||||
reconParams::useTASTempComp = true;
|
||||
reconParams::correctTASTemp = 1;
|
||||
//reconParams.hardwareSelection
|
||||
reconParams::gpuSelectionList = Aurora::Matrix::fromRawData(new double[8] {0,1,2,3,4,5,6,7},8);
|
||||
reconParams::gpuSelectionList = Aurora::Matrix::fromRawData(new float[8] {0,1,2,3,4,5,6,7},8);
|
||||
//reconParams.dataInfo
|
||||
reconParams::expectedAScanDataLength = 4000;
|
||||
|
||||
//reflectParams.dataSelection
|
||||
reflectParams::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
|
||||
reflectParams::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
|
||||
reflectParams::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
|
||||
reflectParams::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
|
||||
reflectParams::motorPos = Aurora::Matrix::fromRawData(new double[2] {1,2}, 2);
|
||||
reflectParams::senderTasList = Aurora::Matrix::fromRawData(new float[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
|
||||
reflectParams::senderElementList = Aurora::Matrix::fromRawData(new float[18] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18},18); //1~18
|
||||
reflectParams::receiverTasList = Aurora::Matrix::fromRawData(new float[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
|
||||
reflectParams::receiverElementList = Aurora::Matrix::fromRawData(new float[18] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18},18); //1~18
|
||||
reflectParams::motorPos = Aurora::Matrix::fromRawData(new float[2] {1,2}, 2);
|
||||
reflectParams::constrictReflectionAngles = 1;
|
||||
reflectParams::angleLowerLimit = 45;
|
||||
reflectParams::angleUpperLimit = 360;
|
||||
@@ -661,8 +661,8 @@ namespace Recon
|
||||
reflectParams::pixelResolutionX = 400;
|
||||
reflectParams::pixelResolutionY = 400;
|
||||
reflectParams::pixelResolutionZ = NAN;
|
||||
reflectParams::imageStartpoint = Aurora::Matrix::fromRawData(new double[3] {-0.18,-0.18,-0.22}, 1, 3);
|
||||
reflectParams::imageEndpoint = Aurora::Matrix::fromRawData(new double[3] {0.18,0.18,0.02}, 1, 3);
|
||||
reflectParams::imageStartpoint = Aurora::Matrix::fromRawData(new float[3] {-0.18,-0.18,-0.22}, 1, 3);
|
||||
reflectParams::imageEndpoint = Aurora::Matrix::fromRawData(new float[3] {0.18,0.18,0.02}, 1, 3);
|
||||
reflectParams::imageResolution = NAN;
|
||||
reflectParams::imageXYZ = Aurora::Matrix();
|
||||
//reflectParams.signalProcessing
|
||||
@@ -678,7 +678,7 @@ namespace Recon
|
||||
reflectParams::matchedFilterCeAScan = true;
|
||||
reflectParams::windowLength = 10;
|
||||
reflectParams::numThreads = 30;
|
||||
reflectParams::expectedUSSpeedRange = Aurora::Matrix::fromRawData(new double[2] {1420,1600}, 1, 2);
|
||||
reflectParams::expectedUSSpeedRange = Aurora::Matrix::fromRawData(new float[2] {1420,1600}, 1, 2);
|
||||
//reflectParams.transmissionCorrection
|
||||
reflectParams::soundSpeedCorrection = 0;
|
||||
reflectParams::attenuationCorrection = 0;
|
||||
@@ -688,10 +688,10 @@ namespace Recon
|
||||
reflectParams::debugMode = 0;
|
||||
reflectParams::blockSizeReco = 60000;
|
||||
reflectParams::medianWindowSize = 1;
|
||||
reflectParams::saftVariant = Aurora::Matrix::fromRawData(new double[6]{1,1,1,1,0,0} , 1, 6);
|
||||
reflectParams::saftVariant = Aurora::Matrix::fromRawData(new float[6]{1,1,1,1,0,0} , 1, 6);
|
||||
reflectParams::useAscanIndex = 1;
|
||||
reflectParams::attenuationCorrectionLimit = 20;
|
||||
reflectParams::blockDimXYZ = Aurora::Matrix::fromRawData(new double[3]{16,16,1} , 1, 3);
|
||||
reflectParams::blockDimXYZ = Aurora::Matrix::fromRawData(new float[3]{16,16,1} , 1, 3);
|
||||
reflectParams::gpuSelectionList = reconParams::gpuSelectionList;;
|
||||
//reflectParams
|
||||
reflectParams::VERSION_MATLAB_MAJOR = 9;
|
||||
@@ -704,19 +704,19 @@ namespace Recon
|
||||
transParams::saveRecon = 1;
|
||||
transParams::saveDebugInfomation = 1;
|
||||
//transParams.dataSelection
|
||||
transParams::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
|
||||
transParams::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
|
||||
transParams::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
|
||||
transParams::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
|
||||
transParams::motorPos = Aurora::Matrix::fromRawData(new double[2] {1,2}, 2);
|
||||
transParams::senderTasList = Aurora::Matrix::fromRawData(new float[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
|
||||
transParams::senderElementList = Aurora::Matrix::fromRawData(new float[18] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18},18); //1~18
|
||||
transParams::receiverTasList = Aurora::Matrix::fromRawData(new float[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
|
||||
transParams::receiverElementList = Aurora::Matrix::fromRawData(new float[18] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18},18); //1~18
|
||||
transParams::motorPos = Aurora::Matrix::fromRawData(new float[2] {1,2}, 2);
|
||||
transParams::filterSensitivity = 1;
|
||||
transParams::sensFilter = 0.3;
|
||||
transParams::angleLowerLimit = 120;
|
||||
transParams::angleUpperLimit = 180;
|
||||
transParams::applyCalib = true;
|
||||
transParams::snrThreshold = 10;
|
||||
transParams::calibReferenceTas = Aurora::Matrix::fromRawData(new double[1] {1},1);
|
||||
transParams::calibReferenceMotorPosition = Aurora::Matrix::fromRawData(new double[1] {1},1);
|
||||
transParams::calibReferenceTas = Aurora::Matrix::fromRawData(new float[1] {1},1);
|
||||
transParams::calibReferenceMotorPosition = Aurora::Matrix::fromRawData(new float[1] {1},1);
|
||||
//transParams.qualityCheck
|
||||
transParams::qualityCheck = 1;
|
||||
transParams::warningThreshold = 0.5;
|
||||
@@ -755,8 +755,8 @@ namespace Recon
|
||||
//transParams.solver
|
||||
transParams::name = "TVAL3";
|
||||
transParams::maxIter = 50;
|
||||
transParams::muValues = Aurora::Matrix::fromRawData(new double[1] {100}, 1);
|
||||
transParams::betaValues = Aurora::Matrix::fromRawData(new double[1] {1}, 1);
|
||||
transParams::muValues = Aurora::Matrix::fromRawData(new float[1] {100}, 1);
|
||||
transParams::betaValues = Aurora::Matrix::fromRawData(new float[1] {1}, 1);
|
||||
transParams::runTransmissionReco = true;
|
||||
transParams::nonNeg = false;
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace Recon
|
||||
//reconParams.measurementInfo.ce
|
||||
EXTERN_C bool useCEMeasured;
|
||||
EXTERN_C bool removeOutliersFromCEMeasured;
|
||||
EXTERN_C double offsetFilterEnabled;
|
||||
EXTERN_C double offsetFilterDisabled;
|
||||
EXTERN_C float offsetFilterEnabled;
|
||||
EXTERN_C float offsetFilterDisabled;
|
||||
//reconParams.measurementInfo.temp
|
||||
EXTERN_C bool useTASTempComp;
|
||||
EXTERN_C bool correctTASTemp;
|
||||
@@ -46,21 +46,21 @@ namespace Recon
|
||||
EXTERN_C int senderElementSize;
|
||||
//reflectParams.qualityCheck
|
||||
EXTERN_C bool qualityCheck;
|
||||
EXTERN_C double warningThreshold;
|
||||
EXTERN_C double errorThreshold;
|
||||
EXTERN_C float warningThreshold;
|
||||
EXTERN_C float errorThreshold;
|
||||
//reflectParams.dataPreparation
|
||||
EXTERN_C int version;
|
||||
EXTERN_C int aScanReconstructionFrequency;
|
||||
EXTERN_C double offsetElectronic;
|
||||
EXTERN_C float offsetElectronic;
|
||||
EXTERN_C bool removeDCOffset;
|
||||
EXTERN_C int expectedAScanDataLength;
|
||||
//reflectParams.imageInfos
|
||||
EXTERN_C double pixelResolutionX;
|
||||
EXTERN_C double pixelResolutionY;
|
||||
EXTERN_C double pixelResolutionZ;
|
||||
EXTERN_C float pixelResolutionX;
|
||||
EXTERN_C float pixelResolutionY;
|
||||
EXTERN_C float pixelResolutionZ;
|
||||
EXTERN_C Aurora::Matrix imageStartpoint;
|
||||
EXTERN_C Aurora::Matrix imageEndpoint;
|
||||
EXTERN_C double imageResolution;
|
||||
EXTERN_C float imageResolution;
|
||||
EXTERN_C Aurora::Matrix imageXYZ;
|
||||
//reflectParams.signalProcessing
|
||||
EXTERN_C int useOptPulse;
|
||||
@@ -80,7 +80,7 @@ namespace Recon
|
||||
EXTERN_C int soundSpeedCorrection;
|
||||
EXTERN_C int attenuationCorrection;
|
||||
EXTERN_C int saveTransmInReflCoords;
|
||||
EXTERN_C double resolutionTransmMap;
|
||||
EXTERN_C float resolutionTransmMap;
|
||||
//reflectParams.saft
|
||||
EXTERN_C int debugMode;
|
||||
EXTERN_C int blockSizeReco;
|
||||
@@ -110,7 +110,7 @@ namespace Recon
|
||||
EXTERN_C Aurora::Matrix receiverElementList;
|
||||
EXTERN_C Aurora::Matrix motorPos;
|
||||
EXTERN_C int filterSensitivity;
|
||||
EXTERN_C double sensFilter;
|
||||
EXTERN_C float sensFilter;
|
||||
EXTERN_C int angleLowerLimit;
|
||||
EXTERN_C int angleUpperLimit;
|
||||
EXTERN_C bool applyCalib;
|
||||
@@ -119,18 +119,18 @@ namespace Recon
|
||||
EXTERN_C Aurora::Matrix calibReferenceMotorPosition;
|
||||
//transParams.qualityCheck
|
||||
EXTERN_C int qualityCheck;
|
||||
EXTERN_C double warningThreshold;
|
||||
EXTERN_C double errorThreshold;
|
||||
EXTERN_C float warningThreshold;
|
||||
EXTERN_C float errorThreshold;
|
||||
//transParams.dataBlocking
|
||||
EXTERN_C int mpSize;
|
||||
EXTERN_C int senderTASSize;
|
||||
EXTERN_C int senderElementSize;
|
||||
//transParams.dataPreparation
|
||||
EXTERN_C int numPixelXY;
|
||||
EXTERN_C double offsetElectronic;
|
||||
EXTERN_C float offsetElectronic;
|
||||
EXTERN_C int aScanReconstructionFrequency;
|
||||
EXTERN_C double minTemperature;
|
||||
EXTERN_C double maxTemperature;
|
||||
EXTERN_C float minTemperature;
|
||||
EXTERN_C float maxTemperature;
|
||||
//transParams.detection
|
||||
EXTERN_C int forceRedetect;
|
||||
EXTERN_C int saveDetection;
|
||||
@@ -144,8 +144,8 @@ namespace Recon
|
||||
EXTERN_C int maxSpeedOfSound;
|
||||
EXTERN_C int detectionWindowSOS;
|
||||
EXTERN_C int detectionWindowATT;
|
||||
EXTERN_C double pulseLengthSamples;
|
||||
EXTERN_C double pulseLengthRefSamples;
|
||||
EXTERN_C float pulseLengthSamples;
|
||||
EXTERN_C float pulseLengthRefSamples;
|
||||
//transParams.rayTracing
|
||||
EXTERN_C bool bentReconstruction;
|
||||
EXTERN_C int bresenham;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,12 @@
|
||||
#include "Parser.h"
|
||||
#include "config/config.h"
|
||||
#include "log/notify.h"
|
||||
#include <vector>
|
||||
#define EIGEN_USE_MKL_ALL
|
||||
|
||||
#include "src/common/fileHelper.h"
|
||||
#include "startReconstructions.h"
|
||||
#include "log/log.h"
|
||||
|
||||
/* 0 is data path.
|
||||
1 is dataRef path.
|
||||
2 is output path.
|
||||
@@ -14,12 +15,10 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
auto defaultLogger = getLogger("Main");
|
||||
spdlog::set_default_logger(defaultLogger);
|
||||
int argNum = 4;
|
||||
std::vector<std::string> args(argNum);
|
||||
args[0] = "";
|
||||
args[1] = "";
|
||||
args[0] = "/home/sun/20230418T141000/";
|
||||
args[1] = "/home/sun/20230418T145123/";
|
||||
args[2] = Recon::DEFAULT_OUTPUT_PATH;
|
||||
args[3] = Recon::DEFAULT_CONFIG_PATH;
|
||||
argc = argc <= argNum? argc-1 : argNum;
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
#include <omp.h>
|
||||
namespace Recon {
|
||||
|
||||
Aurora::Matrix determineOptimalPulse(double timeInterval, size_t expectedAScanLength)
|
||||
Aurora::Matrix determineOptimalPulse(float timeInterval, size_t expectedAScanLength)
|
||||
{
|
||||
double imgResolution = reflectParams::imageResolution;
|
||||
float imgResolution = reflectParams::imageResolution;
|
||||
int optPulseFactor = reflectParams::optPulseFactor;
|
||||
auto minOptPulse = ceil(8*imgResolution*(1/timeInterval)/1500);
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace Recon {
|
||||
}
|
||||
|
||||
auto desSamplingFreq = (1/timeInterval)*0.5;
|
||||
double sincFact = optPulseFactor;
|
||||
double sincLength = round(11*sincFact/16);
|
||||
float sincFact = optPulseFactor;
|
||||
float sincLength = round(11*sincFact/16);
|
||||
sincLength = 3*sincLength;
|
||||
double begin =-sincLength/2+(timeInterval)/2;
|
||||
double end = sincLength/2;
|
||||
float begin =-sincLength/2+(timeInterval)/2;
|
||||
float end = sincLength/2;
|
||||
int length = end - begin + 1;
|
||||
auto sincT = Aurora::zeros(1,length);
|
||||
for (int j = 0; begin <= end; begin++, j++)
|
||||
@@ -47,15 +47,15 @@ namespace Recon {
|
||||
|
||||
Aurora::padding(sincPeak, expectedAScanLength-1, 0);
|
||||
// sincPeak = Aurora::transpose(sincPeak);
|
||||
size_t offset = floor((double)sincPeak_len/2);
|
||||
size_t offset = floor((float)sincPeak_len/2);
|
||||
//cicshift
|
||||
// #pragma omp parallel for
|
||||
for (size_t i = 0; i < sincPeak.getDimSize(1); i++)
|
||||
{
|
||||
double *temp = new double[offset]{0};
|
||||
double * beginPtr = sincPeak.getData()+i*sincPeak.getDimSize(0);
|
||||
double * endPtr = beginPtr + offset;
|
||||
double * col_end = beginPtr + (i+1)*sincPeak.getDimSize(0);
|
||||
float *temp = new float[offset]{0};
|
||||
float * beginPtr = sincPeak.getData()+i*sincPeak.getDimSize(0);
|
||||
float * endPtr = beginPtr + offset;
|
||||
float * col_end = beginPtr + (i+1)*sincPeak.getDimSize(0);
|
||||
std::copy(beginPtr,endPtr,temp);
|
||||
std::copy(endPtr,col_end,beginPtr);
|
||||
std::copy(temp,temp+offset,col_end-offset);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "Matrix.h"
|
||||
namespace Recon {
|
||||
Aurora::Matrix determineOptimalPulse(double timeInterval,
|
||||
Aurora::Matrix determineOptimalPulse(float timeInterval,
|
||||
size_t expectedAScanLength);
|
||||
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
using namespace Recon;
|
||||
using namespace Aurora;
|
||||
|
||||
double Recon::estimateOffset(const MeasurementInfo aExpInfo, const CEInfo& aCe, const Aurora::Matrix& aMatchedFilter)
|
||||
float Recon::estimateOffset(const MeasurementInfo aExpInfo, const CEInfo& aCe, const Aurora::Matrix& aMatchedFilter)
|
||||
{
|
||||
double offset = 0;
|
||||
float offset = 0;
|
||||
Matrix ce = aCe.ceRef;
|
||||
double ceOffSet = aCe.ceRefOffSet;
|
||||
float ceOffSet = aCe.ceRefOffSet;
|
||||
Matrix ceMeasured;
|
||||
if(aCe.measuredCEAvailable)
|
||||
{
|
||||
@@ -35,7 +35,7 @@ double Recon::estimateOffset(const MeasurementInfo aExpInfo, const CEInfo& aCe,
|
||||
{
|
||||
size_t column = ceMeasured.getDimSize(1);
|
||||
size_t ceRows = ce.getDimSize(0);
|
||||
double* offsetCEMeasuredData = Aurora::malloc(column);
|
||||
float* offsetCEMeasuredData = Aurora::malloc(column);
|
||||
for(int i=0; i<column; ++i)
|
||||
{
|
||||
Matrix corrCE = xcorr(ceMeasured($,i).toMatrix(), ce);
|
||||
@@ -54,9 +54,9 @@ double Recon::estimateOffset(const MeasurementInfo aExpInfo, const CEInfo& aCe,
|
||||
}
|
||||
else
|
||||
{
|
||||
double dacDelay = aExpInfo.dacDelay;
|
||||
double filterDisabled = aExpInfo.filterByPass;
|
||||
double dacDelayInS = dacDelay / 10000000;
|
||||
float dacDelay = aExpInfo.dacDelay;
|
||||
float filterDisabled = aExpInfo.filterByPass;
|
||||
float dacDelayInS = dacDelay / 10000000;
|
||||
if(filterDisabled == 1)
|
||||
{
|
||||
offset += aCe.offsetFilterDisabled + dacDelayInS;
|
||||
@@ -76,7 +76,7 @@ double Recon::estimateOffset(const MeasurementInfo aExpInfo, const CEInfo& aCe,
|
||||
// Digitalfilterdelay=-(4.67e-6 + 0.8e-6);
|
||||
// %seconds
|
||||
// elseif(strcmp(info.Hardware,'USCT3Dv3')==1)
|
||||
double digitalfilterdelay = 0;
|
||||
float digitalfilterdelay = 0;
|
||||
// else
|
||||
// Digitalfilterdelay = 0;
|
||||
// end
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace Recon
|
||||
{
|
||||
double estimateOffset(const MeasurementInfo aExpInfo, const CEInfo& aCe, const Aurora::Matrix& aMatchedFilter);
|
||||
float estimateOffset(const MeasurementInfo aExpInfo, const CEInfo& aCe, const Aurora::Matrix& aMatchedFilter);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -12,11 +12,11 @@ Matrix Recon::imageExtrapolation(const Matrix& aImg, int aDim)
|
||||
if(aDim == 3)
|
||||
{
|
||||
size_t zSize = aImg.getDimSize(2);
|
||||
Matrix zIndexZero = Matrix::fromRawData(new double[zSize], zSize);
|
||||
Matrix zIndexZero = Matrix::fromRawData(new float[zSize], zSize);
|
||||
std::vector<int> indexe;
|
||||
for(int i=0; i<zSize; ++i)
|
||||
{
|
||||
double value = sum(aImg($,$,i).toMatrix(), FunctionDirection::All)[0];
|
||||
float value = sum(aImg($,$,i).toMatrix(), FunctionDirection::All)[0];
|
||||
if(value == 0)
|
||||
{
|
||||
zIndexZero[i] = 1;
|
||||
|
||||
@@ -18,7 +18,7 @@ void Recon::precalcImageParameters(const GeometryInfo& aGeom)
|
||||
minSize.forceReshape(2, 1, 1);
|
||||
reflectParams::imageResolution = max(maxSize - minSize, FunctionDirection::All)[0] / reflectParams::pixelResolutionX;
|
||||
reflectParams::pixelResolutionZ = std::floor((aGeom.maxSize[2] - aGeom.minSize[2]) / reflectParams::imageResolution) + 1;
|
||||
double* imageXYZData = Aurora::malloc(3);
|
||||
float* imageXYZData = Aurora::malloc(3);
|
||||
imageXYZData[0] = ceil(reflectParams::pixelResolutionX * (reflectParams::imageEndpoint[0] - reflectParams::imageStartpoint[0]) /
|
||||
(aGeom.maxSize[0] - aGeom.minSize[0]));
|
||||
imageXYZData[1] = ceil(reflectParams::pixelResolutionY * (reflectParams::imageEndpoint[1] - reflectParams::imageStartpoint[1]) /
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <vector>
|
||||
namespace Recon {
|
||||
|
||||
Aurora::Matrix _createDiffVector(const Aurora::Matrix & aMatrix, double beginValue,double endValue){
|
||||
Aurora::Matrix _createDiffVector(const Aurora::Matrix & aMatrix, float beginValue,float endValue){
|
||||
auto r = Aurora::zeros(1,aMatrix.getDataSize()+1);
|
||||
r[0] = beginValue;
|
||||
for (size_t i = 1; i < aMatrix.getDataSize(); i++)
|
||||
@@ -46,8 +46,8 @@ namespace Recon {
|
||||
{
|
||||
Aurora::Matrix result = Aurora::zeros(aMatrix.getDimSize(0)>1?aMatrix.getDataSize()-1:1,
|
||||
aMatrix.getDimSize(0)>1?1:aMatrix.getDimSize(1)-1);
|
||||
if (op == 1)vdSubI(result.getDataSize(),aMatrix.getData() , 1, aMatrix.getData()+1,1,result.getData(),1);
|
||||
if (op == 0)vdAddI(result.getDataSize(),aMatrix.getData()+1 , 1, aMatrix.getData(),1,result.getData(),1);
|
||||
if (op == 1)vsSubI(result.getDataSize(),aMatrix.getData() , 1, aMatrix.getData()+1,1,result.getData(),1);
|
||||
if (op == 0)vsAddI(result.getDataSize(),aMatrix.getData()+1 , 1, aMatrix.getData(),1,result.getData(),1);
|
||||
return result;
|
||||
}
|
||||
else{
|
||||
@@ -77,7 +77,7 @@ namespace Recon {
|
||||
|
||||
void fakeFree(void*){}
|
||||
Aurora::Matrix getPartMatrixColRef(const Aurora::Matrix & aMatrix,int col){
|
||||
std::shared_ptr<double> ptr{aMatrix.getData()+aMatrix.getDimSize(0)*col*aMatrix.getValueType(),fakeFree};
|
||||
std::shared_ptr<float> ptr{aMatrix.getData()+aMatrix.getDimSize(0)*col*aMatrix.getValueType(),fakeFree};
|
||||
return Aurora::Matrix(ptr,{aMatrix.getDimSize(0),1,1},aMatrix.getValueType());
|
||||
}
|
||||
|
||||
@@ -93,8 +93,8 @@ namespace Recon {
|
||||
Aurora::Matrix offsetSignalFourier(const PreComputes &preComputes, int nfft)
|
||||
{
|
||||
|
||||
double dt = -(preComputes.offset/preComputes.timeInterval);
|
||||
double binStart = floor((double)nfft/2);
|
||||
float dt = -(preComputes.offset/preComputes.timeInterval);
|
||||
float binStart = floor((float)nfft/2);
|
||||
auto temp = Aurora::zeros(1,nfft);
|
||||
for (size_t i = 0; i < temp.getDataSize(); i++)
|
||||
{
|
||||
@@ -105,7 +105,7 @@ namespace Recon {
|
||||
Aurora::ifftshift(temp);
|
||||
auto fftBin = -1*dt*2*M_PI*temp/nfft;
|
||||
auto negCfftbin = Aurora::complex(Aurora::zeros(fftBin.getDimSize(0),fftBin.getDimSize(1),fftBin.getDimSize(2)));
|
||||
cblas_dcopy(fftBin.getDataSize(), fftBin.getData(), 1, negCfftbin.getData()+1, 2);
|
||||
cblas_scopy(fftBin.getDataSize(), fftBin.getData(), 1, negCfftbin.getData()+1, 2);
|
||||
auto exponent = exp(negCfftbin);
|
||||
if (!exponent.isComplex())exponent = complex(exponent);
|
||||
return exponent;
|
||||
@@ -170,7 +170,7 @@ namespace Recon {
|
||||
if (blockedSL[i] == blockedRL[i])
|
||||
{
|
||||
auto begin_ptr = _blockedAScans.getData();
|
||||
int count = reflectParams::suppressSameHeadLength* sizeof(double);
|
||||
int count = reflectParams::suppressSameHeadLength* sizeof(float);
|
||||
std::memset(begin_ptr,0,count);
|
||||
}
|
||||
}
|
||||
@@ -192,23 +192,23 @@ namespace Recon {
|
||||
else{
|
||||
fh = preComputes.matchedFilter(Aurora::$,blockedChannels[i]-1).toMatrix();
|
||||
}
|
||||
double* value1 = Aurora::malloc(fx.getDataSize());
|
||||
vdMulI(fx.getDataSize(), fx.getData(), 2, fh.getData(), 2, value1, 1);
|
||||
double* value2 = Aurora::malloc(fx.getDataSize());
|
||||
vdMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData() + 1, 2, value2, 1);
|
||||
double* realData = Aurora::malloc(fx.getDataSize());
|
||||
vdAdd(fx.getDataSize(), value1, value2, realData);
|
||||
float* value1 = Aurora::malloc(fx.getDataSize());
|
||||
vsMulI(fx.getDataSize(), fx.getData(), 2, fh.getData(), 2, value1, 1);
|
||||
float* value2 = Aurora::malloc(fx.getDataSize());
|
||||
vsMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData() + 1, 2, value2, 1);
|
||||
float* realData = Aurora::malloc(fx.getDataSize());
|
||||
vsAdd(fx.getDataSize(), value1, value2, realData);
|
||||
Aurora::Matrix real = Aurora::Matrix::New(realData, fx.getDimSize(0), fx.getDimSize(1));
|
||||
|
||||
vdMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData(), 2, value1, 1);
|
||||
vdMulI(fx.getDataSize(), fx.getData(), 2, fh.getData() + 1, 2, value2, 1);
|
||||
double* imagData = Aurora::malloc(fx.getDataSize());
|
||||
vdSub(fx.getDataSize(), value1, value2, imagData);
|
||||
vsMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData(), 2, value1, 1);
|
||||
vsMulI(fx.getDataSize(), fx.getData(), 2, fh.getData() + 1, 2, value2, 1);
|
||||
float* imagData = Aurora::malloc(fx.getDataSize());
|
||||
vsSub(fx.getDataSize(), value1, value2, imagData);
|
||||
Aurora::Matrix image = Aurora::Matrix::New(imagData, fx.getDimSize(0), fx.getDimSize(1));
|
||||
|
||||
double* complexData = Aurora::malloc(real.getDataSize(), true);
|
||||
cblas_dcopy(real.getDataSize(), real.getData(), 1 , complexData ,2);
|
||||
cblas_dcopy(image.getDataSize(), image.getData(), 1 , complexData + 1 ,2);
|
||||
float* complexData = Aurora::malloc(real.getDataSize(), true);
|
||||
cblas_scopy(real.getDataSize(), real.getData(), 1 , complexData ,2);
|
||||
cblas_scopy(image.getDataSize(), image.getData(), 1 , complexData + 1 ,2);
|
||||
Aurora::Matrix complex = Aurora::Matrix::New(complexData, real.getDimSize(0), real.getDimSize(1), 1, Aurora::Complex);
|
||||
Aurora::free(value1);
|
||||
Aurora::free(value2);
|
||||
@@ -267,9 +267,9 @@ namespace Recon {
|
||||
auto mean_energySum = Aurora::zeros(l_partData + windowLength,1);
|
||||
for (size_t k = 0; k < windowLength; k++)
|
||||
{
|
||||
double* begin = mean_energySum.getData() + k;
|
||||
float* begin = mean_energySum.getData() + k;
|
||||
int length = l_partData;
|
||||
vdAddI(length, energySum.getData(), 1, begin, 1, begin, 1);
|
||||
vsAddI(length, energySum.getData(), 1, begin, 1, begin, 1);
|
||||
}
|
||||
mean_energySum = mean_energySum.block(0,windowLength/2-1,mean_energySum.getDataSize()-1-round((windowLength-0.001)/2));
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace Recon {
|
||||
auto scheitel = scheitelRow+scheitelCol;
|
||||
max(mean_energySum_f.block(0,0,scheitel),Aurora::Column,indexRow,indexCol);
|
||||
size_t index = indexRow+indexCol;
|
||||
double median_mean_energySum = Aurora::median(mean_energySum).getScalar();
|
||||
float median_mean_energySum = Aurora::median(mean_energySum).getScalar();
|
||||
bool flag = false;
|
||||
if (mean_energySum[index] > median_mean_energySum)
|
||||
{
|
||||
@@ -319,16 +319,16 @@ namespace Recon {
|
||||
int winLength2 = 100;
|
||||
winLength2 = sig_end+winLength2+200-sig_begin+1;
|
||||
auto win = generateGaussWindow(winLength2);
|
||||
double* begin = _blockedAScans.getData() + (size_t)sig_begin-1;
|
||||
float* begin = _blockedAScans.getData() + (size_t)sig_begin-1;
|
||||
int length = winLength2;
|
||||
auto winReverse = Aurora::zeros(1,win.getDataSize());
|
||||
std::reverse_copy(win.getData(), win.getData()+win.getDataSize(), winReverse.getData());
|
||||
vdMulI(length, begin, 1, winReverse.getData(), 1, begin, 1);
|
||||
vsMulI(length, begin, 1, winReverse.getData(), 1, begin, 1);
|
||||
winLength2 = sig_end;
|
||||
win = generateGaussWindow(winLength2);
|
||||
begin = _blockedAScans.getData() ;
|
||||
length = sig_end;
|
||||
vdMulI(length, begin, 1, win.getData(), 1, begin, 1);
|
||||
vsMulI(length, begin, 1, win.getData(), 1, begin, 1);
|
||||
// _blockedAScans = fft(_blockedAScans);
|
||||
// blockedAScans(Aurora::$,i) =_blockedAScans;
|
||||
}
|
||||
@@ -338,14 +338,14 @@ namespace Recon {
|
||||
blockedAScans = fft(blockedAScans);
|
||||
if(reflectParams::useOptPulse==1){
|
||||
auto n = nSamples;
|
||||
auto nHalf = round((double)n/2);
|
||||
auto nHalf = round((float)n/2);
|
||||
#pragma omp parallel for num_threads(32)
|
||||
for (size_t i = 0; i < blockedAScans.getDimSize(1); i++)
|
||||
{
|
||||
Aurora::Matrix _blockedAScans = getPartMatrixColRef(blockedAScans,i);
|
||||
|
||||
_blockedAScans(0,Aurora::$) = std::complex<double>{0,0};
|
||||
_blockedAScans.setBlockComplexValue(0,nHalf,_blockedAScans.getDimSize(0)-1, std::complex<double>{0,0});
|
||||
_blockedAScans(0,Aurora::$) = 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);
|
||||
}
|
||||
|
||||
@@ -487,9 +487,9 @@ namespace Recon {
|
||||
if (valid[i])highNoiseScore[count++] = ascanMapValue[i];
|
||||
}
|
||||
highNoiseScore.forceReshape(1, count, 1);
|
||||
double highNoiseScoreMean = mean(highNoiseScore).getScalar();
|
||||
double highNoiseScoreStd = Aurora::std(highNoiseScore).getScalar();
|
||||
double treshold99= (mean(highNoiseScore)+2.596*Aurora::std(highNoiseScore)).getScalar();
|
||||
float highNoiseScoreMean = mean(highNoiseScore).getScalar();
|
||||
float highNoiseScoreStd = Aurora::std(highNoiseScore).getScalar();
|
||||
float treshold99= (mean(highNoiseScore)+2.596*Aurora::std(highNoiseScore)).getScalar();
|
||||
Aurora::compareSet(valid,ascanMapValue,treshold99,0,Aurora::GT);
|
||||
// debugOutput.blockStatisticValue = ascanMapValue;
|
||||
// debugOutput.blockStatisticUsedData = ascanMapValue > treshold99;
|
||||
|
||||
@@ -24,9 +24,9 @@ PreprocessReflectionData Recon::preprocessTransmissionReconstructionForReflectio
|
||||
Matrix maxPos;
|
||||
if(!aDdims.isNull())
|
||||
{
|
||||
minPos = Matrix::fromRawData(new double[3], 1, 3);
|
||||
minPos = Matrix::fromRawData(new float[3], 1, 3);
|
||||
size_t maxPosSize = aDdims.getDataSize() - 3;
|
||||
maxPos = Matrix::fromRawData(new double[maxPosSize], 1, maxPosSize);
|
||||
maxPos = Matrix::fromRawData(new float[maxPosSize], 1, maxPosSize);
|
||||
std::copy(aDdims.getData(), aDdims.getData() + 3, minPos.getData());
|
||||
std::copy(aDdims.getData() + 3, aDdims.getData() + 3 + maxPosSize, maxPos.getData());
|
||||
}
|
||||
@@ -96,7 +96,7 @@ PreprocessReflectionData Recon::preprocessTransmissionReconstructionForReflectio
|
||||
if(soundSpeedCorrection == 0 && attenuationCorrection == 0)
|
||||
{
|
||||
result.saftMode = 2;
|
||||
double deltaTransMap = reflectParams::resolutionTransmMap;
|
||||
float deltaTransMap = reflectParams::resolutionTransmMap;
|
||||
|
||||
Matrix minTransdPos = min(aGeometryInfo.minEmitter, aGeometryInfo.minReceiver);
|
||||
Matrix maxTransdPos = max(aGeometryInfo.maxEmitter, aGeometryInfo.maxReceiver);
|
||||
|
||||
@@ -12,15 +12,15 @@ namespace Recon
|
||||
Aurora::Matrix speedMap3D;
|
||||
Aurora::Matrix attenuationMap3D;
|
||||
Aurora::Matrix beginTransMap;
|
||||
double deltaTransMap;
|
||||
float deltaTransMap;
|
||||
};
|
||||
|
||||
struct PreprocessReflectionData
|
||||
{
|
||||
TransRecos transRecos;
|
||||
int saftMode;
|
||||
double attenuationCorrection;
|
||||
double soundSpeedCorrection;
|
||||
float attenuationCorrection;
|
||||
float soundSpeedCorrection;
|
||||
};
|
||||
PreprocessReflectionData preprocessTransmissionReconstructionForReflection(const Aurora::Matrix& aSOSMap, const Aurora::Matrix& aATTMap,
|
||||
const Aurora::Matrix& aDdims, const GeometryInfo& aGeometryInfo,
|
||||
|
||||
@@ -17,9 +17,9 @@ TransmissionVolme Recon::resampleTransmissionVolume(const Aurora::Matrix& aTrans
|
||||
const Aurora::Matrix& aMinPos,const GeometryInfo& aGeom)
|
||||
{
|
||||
TransmissionVolme result;
|
||||
double resSOSX = (aMaxPos[0] - aMinPos[0]) / (aTransVol.getDimSize(0) - 1);
|
||||
double resSOSY = (aMaxPos[1] - aMinPos[1]) / (aTransVol.getDimSize(1) - 1);
|
||||
double resSOSZ = (aMaxPos[2] - aMinPos[2]) / (aTransVol.getDimSize(2) - 1);
|
||||
float resSOSX = (aMaxPos[0] - aMinPos[0]) / (aTransVol.getDimSize(0) - 1);
|
||||
float resSOSY = (aMaxPos[1] - aMinPos[1]) / (aTransVol.getDimSize(1) - 1);
|
||||
float resSOSZ = (aMaxPos[2] - aMinPos[2]) / (aTransVol.getDimSize(2) - 1);
|
||||
|
||||
Matrix xSOS = createVectorMatrix(aMinPos[0] + 0.5 * resSOSX, resSOSX, aMaxPos[0] + 0.5 * resSOSX);
|
||||
Matrix ySOS = createVectorMatrix(aMinPos[1] + 0.5 * resSOSY, resSOSY, aMaxPos[1] + 0.5 * resSOSY);
|
||||
@@ -30,7 +30,7 @@ TransmissionVolme Recon::resampleTransmissionVolume(const Aurora::Matrix& aTrans
|
||||
|
||||
Matrix minTransdPos = min(aGeom.minEmitter, aGeom.minReceiver);
|
||||
Matrix maxTransdPos = max(aGeom.maxEmitter, aGeom.maxReceiver);
|
||||
double deltaTransMap = (aMaxPos[0] - aMinPos[0]) / (aTransVol.getDimSize(0) - 1);
|
||||
float deltaTransMap = (aMaxPos[0] - aMinPos[0]) / (aTransVol.getDimSize(0) - 1);
|
||||
Matrix beginTransMap = transpose(min(transpose(reflectParams::imageStartpoint), minTransdPos)) - 3 * reflectParams::resolutionTransmMap;
|
||||
Matrix endSpeedMap = max(transpose(reflectParams::imageEndpoint), maxTransdPos) + 3 * reflectParams::resolutionTransmMap;
|
||||
endSpeedMap[2] = endSpeedMap[2] + 0.025;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Recon
|
||||
struct TransmissionVolme
|
||||
{
|
||||
Aurora::Matrix transMap;
|
||||
double deltaTransMap;
|
||||
float deltaTransMap;
|
||||
Aurora::Matrix beginTransMap;
|
||||
};
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Recon {
|
||||
const Aurora::Matrix &senderIndex,
|
||||
const Aurora::Matrix &receiverPosGeom,
|
||||
const Aurora::Matrix &senderPosGeom,
|
||||
int SAFT_mode, double TimeInterval,
|
||||
int SAFT_mode, float TimeInterval,
|
||||
const TransRecos& transRecos,
|
||||
const Aurora::Matrix &Env)
|
||||
{
|
||||
@@ -228,7 +228,7 @@ namespace Recon {
|
||||
// delete [] fdata4;
|
||||
// delete [] fdata5;
|
||||
// delete [] gdata;
|
||||
// return Aurora::Matrix::fromRawData((double *)result.Data, result.Dims[0],
|
||||
// return Aurora::Matrix::fromRawData((float *)result.Data, result.Dims[0],
|
||||
// result.Dims[1], result.Dims[2]);
|
||||
|
||||
return Aurora::Matrix();
|
||||
@@ -245,7 +245,7 @@ namespace Recon {
|
||||
delete [] fdata4;
|
||||
delete [] fdata5;
|
||||
delete [] gdata;
|
||||
return Aurora::Matrix::fromRawData((double *)result.Data, result.Dims[0],
|
||||
return Aurora::Matrix::fromRawData((float *)result.Data, result.Dims[0],
|
||||
result.Dims[1], result.Dims[2]);
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ namespace Recon {
|
||||
recontructSAFT(const Aurora::Matrix &AScans, const Aurora::Matrix &senderPos,
|
||||
const Aurora::Matrix &receiverPos, const Aurora::Matrix &mpIndex,
|
||||
int SAFT_mode, TransRecos &transRecos, Aurora::Matrix &Env) {
|
||||
double TimeInterval = 1.0 / (reflectParams::aScanReconstructionFrequency);
|
||||
float TimeInterval = 1.0 / (reflectParams::aScanReconstructionFrequency);
|
||||
std::vector<int> motorPosAvailable;
|
||||
std::unique_copy(mpIndex.getData(), mpIndex.getData() + mpIndex.getDataSize(),
|
||||
std::back_inserter(motorPosAvailable));
|
||||
|
||||
@@ -69,13 +69,13 @@ Aurora::Matrix Recon::startReflectionReconstruction( Parser* aParser, int aSAFT_
|
||||
Matrix sn = aSnList.block(0, transParams::senderElementSize*k, transParams::senderElementSize*k+transParams::senderElementSize - 1);
|
||||
auto blockData = getAscanBlockPreprocessed(aParser, mp, sl, sn, aRlList, aRnList, aGeom, aExpInfo, true, false);
|
||||
|
||||
double* channelListSizeData = Aurora::malloc(2);
|
||||
float* channelListSizeData = Aurora::malloc(2);
|
||||
channelListSizeData[0] = channelList.getDimSize(0);
|
||||
channelListSizeData[1] = channelList.getDimSize(1);
|
||||
Matrix channelListSize = Matrix::New(channelListSizeData, 2, 1);
|
||||
Matrix ind = sub2ind(channelListSize, {blockData.rlBlock, blockData.rnBlock});
|
||||
size_t channelBlockSize = ind.getDataSize();
|
||||
double* channelBlockData = Aurora::malloc(channelBlockSize);
|
||||
float* channelBlockData = Aurora::malloc(channelBlockSize);
|
||||
for(size_t i=0; i<channelBlockSize; ++i)
|
||||
{
|
||||
channelBlockData[i] = channelList[ind[i] - 1];
|
||||
|
||||
@@ -83,7 +83,7 @@ int Recon::startReconstructions(const std::string& aDataPath, const std::string&
|
||||
}
|
||||
|
||||
//getMeasurementMetaData
|
||||
double maxNumTAS = max(auroraUnion(slList, rlList)).getData()[0];
|
||||
float maxNumTAS = max(auroraUnion(slList, rlList)).getData()[0];
|
||||
MeasurementInfo expInfo = loadMeasurementInfos(&dataParser);
|
||||
TempInfo temp = getTemperatureInfo(&dataParser, maxNumTAS);
|
||||
CEInfo ce = getCEInfo(&dataParser, expInfo);
|
||||
@@ -107,7 +107,7 @@ int Recon::startReconstructions(const std::string& aDataPath, const std::string&
|
||||
motorPosAvailableRef = transformationInfo.motorPos;
|
||||
if(transformationMatricesRef.isNull())
|
||||
{
|
||||
Matrix motorPos1 = Matrix::fromRawData(new double[1] {1}, 1);
|
||||
Matrix motorPos1 = Matrix::fromRawData(new float[1] {1}, 1);
|
||||
transformationMatricesRef = getTransformationMatrix(&refParser, motorPos1).rotationMatrix;
|
||||
}
|
||||
else
|
||||
@@ -159,7 +159,7 @@ int Recon::startReconstructions(const std::string& aDataPath, const std::string&
|
||||
Recon::notifyProgress(3);
|
||||
if(expInfo.sampleRate != reflectParams::aScanReconstructionFrequency)
|
||||
{
|
||||
reflectParams::expectedAScanDataLength = ceil(expInfo.numberSamples * ((double)reflectParams::aScanReconstructionFrequency / expInfo.sampleRate));
|
||||
reflectParams::expectedAScanDataLength = ceil(expInfo.numberSamples * ((float)reflectParams::aScanReconstructionFrequency / expInfo.sampleRate));
|
||||
}
|
||||
Recon::notifyProgress(4);
|
||||
TransmissionReconstructionResult transmissionResult;
|
||||
@@ -175,7 +175,7 @@ int Recon::startReconstructions(const std::string& aDataPath, const std::string&
|
||||
{
|
||||
preComputes.matchedFilterRef = createMatchedFilter(ceRef.ceRef, ceRef.measuredCEUsed, reflectParams::findDefects, reconParams::removeOutliersFromCEMeasured, expInfo.Hardware);
|
||||
}
|
||||
preComputes.timeInterval = (double)1 / reflectParams::aScanReconstructionFrequency;
|
||||
preComputes.timeInterval = (float)1 / reflectParams::aScanReconstructionFrequency;
|
||||
preComputes.measuredCEUsed = ce.measuredCEUsed;
|
||||
preComputes.measuredCE_TASIndices = ce.tasIndices;
|
||||
preComputes.measuredCE_receiverIndices = ce.receiverIndices;
|
||||
@@ -205,7 +205,7 @@ int Recon::startReconstructions(const std::string& aDataPath, const std::string&
|
||||
transParams::pulseLengthRefSamples = estimatePulseLength(ceEstimatePulseLengthRef, reflectParams::aScanReconstructionFrequency);
|
||||
Matrix iMp;
|
||||
Matrix mp_inter = intersect(motorPosAvailable, transParams::motorPos, iMp);
|
||||
double* mpRef_interData = Aurora::malloc(iMp.getDataSize());
|
||||
float* mpRef_interData = Aurora::malloc(iMp.getDataSize());
|
||||
for(int i=0; i<iMp.getDataSize(); ++i)
|
||||
{
|
||||
mpRef_interData[i] = motorPosAvailableRef[iMp[i] - 1];
|
||||
@@ -224,10 +224,10 @@ int Recon::startReconstructions(const std::string& aDataPath, const std::string&
|
||||
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;
|
||||
exporter.exportDICOM(transmissionResult.recoSOS, DICOMExporter::SOS);
|
||||
exporter.exportDICOM(transmissionResult.recoATT, DICOMExporter::ATT);
|
||||
// writer.setMatrix(transmissionResult.recoSOS, "sos");
|
||||
// writer.setMatrix(transmissionResult.recoATT, "att");
|
||||
//exporter.exportDICOM(transmissionResult.recoSOS, DICOMExporter::SOS);
|
||||
//exporter.exportDICOM(transmissionResult.recoATT, DICOMExporter::ATT);
|
||||
writer.setMatrix(transmissionResult.recoSOS, "sos");
|
||||
writer.setMatrix(transmissionResult.recoATT, "att");
|
||||
}
|
||||
|
||||
if(reflectParams::runReflectionReco)
|
||||
@@ -245,7 +245,7 @@ int Recon::startReconstructions(const std::string& aDataPath, const std::string&
|
||||
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.timeInterval = (float)1 / reflectParams::aScanReconstructionFrequency;
|
||||
preComputes.measuredCEUsed = ce.measuredCEUsed;
|
||||
preComputes.measuredCE_TASIndices = ce.tasIndices;
|
||||
preComputes.measuredCE_receiverIndices = ce.receiverIndices;
|
||||
@@ -255,10 +255,11 @@ int Recon::startReconstructions(const std::string& aDataPath, const std::string&
|
||||
Recon::notifyProgress(25);
|
||||
RECON_INFO("Start reflectionRecostruction.");
|
||||
Matrix env = startReflectionReconstruction(&dataParser, preProcessData.saftMode, mp_inter, slList_inter, snList_inter, rlList_inter, rnList_inter, geom, preProcessData.transRecos, expInfo, preComputes);
|
||||
// writer.setMatrix(env, "reflect");
|
||||
exporter.exportDICOM(env, Recon::DICOMExporter::REFL);
|
||||
writer.setMatrix(env, "reflect");
|
||||
//exporter.exportDICOM(env, Recon::DICOMExporter::REFL);
|
||||
Recon::notifyProgress(99);
|
||||
}
|
||||
writer.write();
|
||||
return 0;
|
||||
// writer.write();
|
||||
|
||||
}
|
||||
@@ -14,14 +14,14 @@
|
||||
using namespace Aurora;
|
||||
namespace Recon {
|
||||
Aurora::Matrix calculateSnr(const Aurora::Matrix &aMDataBlock,
|
||||
double aReferenceNoise) {
|
||||
float aReferenceNoise) {
|
||||
auto maxSignal = max(abs(aMDataBlock));
|
||||
auto snrBlock = 10 * log(maxSignal / aReferenceNoise, 10);
|
||||
return snrBlock;
|
||||
}
|
||||
|
||||
Aurora::Matrix filterTransmissionSensitivityMap(
|
||||
double sensFilter, const Aurora::Matrix &aVslBlock,
|
||||
float sensFilter, const Aurora::Matrix &aVslBlock,
|
||||
const Aurora::Matrix &aVsnBlock, const Aurora::Matrix &aVrlBlock,
|
||||
const Aurora::Matrix &aVrnBlock, std::vector<Aurora::Matrix> &aMSensData) {
|
||||
if (aMSensData.empty()) {
|
||||
@@ -48,7 +48,7 @@ namespace Recon {
|
||||
}
|
||||
|
||||
Aurora::Matrix
|
||||
filterTransmissionAngle(double aAngleLowerLimit, double aAngleUpperLimit,
|
||||
filterTransmissionAngle(float aAngleLowerLimit, float aAngleUpperLimit,
|
||||
const Aurora::Matrix &aMSenderNormalBlock,
|
||||
const Aurora::Matrix &aMReceiverNormalBlock) {
|
||||
// dot(senderNormalBlock, receiverNormalBlock,
|
||||
@@ -76,8 +76,8 @@ namespace Recon {
|
||||
|
||||
checkTofDetectionsResult checkTofDetections(const Aurora::Matrix &aVTofValues, const Aurora::Matrix &aVDists,
|
||||
const Aurora::Matrix &aVSosRef,
|
||||
double minSpeedOfSound,
|
||||
double maxSpeedOfSound)
|
||||
float minSpeedOfSound,
|
||||
float maxSpeedOfSound)
|
||||
{
|
||||
checkTofDetectionsResult result;
|
||||
auto sosValues = aVDists / (aVTofValues + (aVDists / aVSosRef));
|
||||
@@ -110,14 +110,14 @@ namespace Recon {
|
||||
return Aurora::Matrix();
|
||||
}
|
||||
|
||||
Aurora::Matrix findDefectTransmissionData(const Aurora::Matrix &aVSNRList,double aSNRDifference)
|
||||
Aurora::Matrix findDefectTransmissionData(const Aurora::Matrix &aVSNRList,float aSNRDifference)
|
||||
{
|
||||
auto valid = auroraNot(Aurora::isnan(aVSNRList));
|
||||
double meanSNR = 0.0;
|
||||
float meanSNR = 0.0;
|
||||
|
||||
auto finite_SNRList = Aurora::isfinite(aVSNRList);
|
||||
int count = (int)sum(finite_SNRList).getScalar();
|
||||
double* std_SNRListData = Aurora::malloc(count);
|
||||
float* std_SNRListData = Aurora::malloc(count);
|
||||
int j = 0;
|
||||
for (size_t i = 0; i < aVSNRList.getDataSize(); i++)
|
||||
{
|
||||
@@ -126,16 +126,16 @@ namespace Recon {
|
||||
std_SNRListData[j++] = aVSNRList[i];
|
||||
}
|
||||
}
|
||||
meanSNR = meanSNR/(double)j;
|
||||
meanSNR = meanSNR/(float)j;
|
||||
Aurora::Matrix std_SNRList = Aurora::Matrix::New(std_SNRListData,count,1,1);
|
||||
std_SNRList = Aurora::std(std_SNRList);
|
||||
double localSNRDifference = 2 * std_SNRList.getScalar();
|
||||
float localSNRDifference = 2 * std_SNRList.getScalar();
|
||||
aSNRDifference = localSNRDifference < aSNRDifference?localSNRDifference:aSNRDifference;
|
||||
double sub = meanSNR - aSNRDifference;
|
||||
double add = meanSNR + aSNRDifference;
|
||||
float sub = meanSNR - aSNRDifference;
|
||||
float add = meanSNR + aSNRDifference;
|
||||
for (size_t i = 0; i < aVSNRList.getDataSize(); i++)
|
||||
{
|
||||
double value = aVSNRList[i];
|
||||
float value = aVSNRList[i];
|
||||
if (value<sub || value>add){
|
||||
valid[i] = 0;
|
||||
}
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
|
||||
namespace Recon {
|
||||
Aurora::Matrix calculateSnr(const Aurora::Matrix &aMDataBlock,
|
||||
double aReferenceNoise);
|
||||
float aReferenceNoise);
|
||||
|
||||
Aurora::Matrix filterTransmissionSensitivityMap(
|
||||
double sensFilter, const Aurora::Matrix &aVslBlock,
|
||||
float sensFilter, const Aurora::Matrix &aVslBlock,
|
||||
const Aurora::Matrix &aVsnBlock, const Aurora::Matrix &aVrlBlock,
|
||||
const Aurora::Matrix &aVrnBlock, std::vector<Aurora::Matrix> &aMSensData);
|
||||
|
||||
Aurora::Matrix
|
||||
filterTransmissionAngle(double aAngleLowerLimit, double aAngleUpperLimit,
|
||||
filterTransmissionAngle(float aAngleLowerLimit, float aAngleUpperLimit,
|
||||
const Aurora::Matrix &aMSenderNormalBlock,
|
||||
const Aurora::Matrix &aMReceiverNormalBlock);
|
||||
|
||||
@@ -26,8 +26,8 @@ struct checkTofDetectionsResult
|
||||
checkTofDetectionsResult checkTofDetections(const Aurora::Matrix &aVTofValues,
|
||||
const Aurora::Matrix &aVDists,
|
||||
const Aurora::Matrix &aVSosRef,
|
||||
double minSpeedOfSound,
|
||||
double maxSpeedOfSound);
|
||||
float minSpeedOfSound,
|
||||
float maxSpeedOfSound);
|
||||
/**
|
||||
* filterTransmissionData
|
||||
*
|
||||
@@ -48,7 +48,7 @@ Aurora::Matrix filterTransmissionData( const Aurora::Matrix &aVslBlock,
|
||||
const Aurora::Matrix &aMSenderNormalBlock,
|
||||
const Aurora::Matrix &aMReceiverNormalBlock);
|
||||
|
||||
Aurora::Matrix findDefectTransmissionData(const Aurora::Matrix &aVSNRList,double aSNRDifference);
|
||||
Aurora::Matrix findDefectTransmissionData(const Aurora::Matrix &aVSNRList,float aSNRDifference);
|
||||
|
||||
//TODO:estimateNoiseValueFromAScans.m
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <omp.h>
|
||||
|
||||
namespace {
|
||||
inline void cross(double *aVA, double *aVB, double *aVOut, int aIncX = 1) {
|
||||
inline void cross(float *aVA, float *aVB, float *aVOut, int aIncX = 1) {
|
||||
if (!aVA || !aVB || !aVOut)
|
||||
return;
|
||||
aVOut[0 * aIncX] =
|
||||
@@ -101,8 +101,8 @@ Aurora::Matrix getSensitivity(const Aurora::Matrix &aMSensmap,
|
||||
else if (zi.getData()[i] < 0)
|
||||
zi.getData()[i] += 90;
|
||||
}
|
||||
double msensx = std::round(((double)aMSensmap.getDimSize(0) - 1.0) * 0.5);
|
||||
double msensY = std::round(((double)aMSensmap.getDimSize(1) - 1.0) * 0.5);
|
||||
float msensx = std::round(((float)aMSensmap.getDimSize(0) - 1.0) * 0.5);
|
||||
float msensY = std::round(((float)aMSensmap.getDimSize(1) - 1.0) * 0.5);
|
||||
xi = xi + 1 + msensx;
|
||||
zi = zi + 1 + msensY;
|
||||
for (size_t i = 0; i < xi.getDataSize(); ++i) {
|
||||
@@ -152,11 +152,11 @@ combineSensitivity(const Aurora::Matrix &aVSenderTASRange,
|
||||
const Aurora::Matrix &aVReceiverElementRange,
|
||||
const Aurora::Matrix &aMSenderSens,
|
||||
const Aurora::Matrix &aMReceiverSens) {
|
||||
double maxReceiverElementRange =
|
||||
float maxReceiverElementRange =
|
||||
Aurora::max(aVReceiverElementRange).getScalar();
|
||||
double maxReceiverTASRange = Aurora::max(aVReceiverTASRange).getScalar();
|
||||
double maxSenderElementRange = Aurora::max(aVSenderElementRange).getScalar();
|
||||
double maxSenderTASRange = Aurora::max(aVSenderTASRange).getScalar();
|
||||
float maxReceiverTASRange = Aurora::max(aVReceiverTASRange).getScalar();
|
||||
float maxSenderElementRange = Aurora::max(aVSenderElementRange).getScalar();
|
||||
float maxSenderTASRange = Aurora::max(aVSenderTASRange).getScalar();
|
||||
std::vector<Aurora::Matrix> ret;
|
||||
for (size_t i = 0; i < maxSenderTASRange; ++i) {
|
||||
ret.emplace_back(Aurora::zeros(maxReceiverElementRange, maxReceiverTASRange,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -25,59 +25,59 @@ Aurora::Matrix calculateAttenuation(const Aurora::Matrix &ascans,
|
||||
|
||||
SearchPosition
|
||||
calculateStarEndSearchPosition(const Aurora::Matrix &aVDistBlock,
|
||||
double minSpeedOfSound, double maxSpeedOfSound,
|
||||
double sampleRate, double maxSample,
|
||||
float minSpeedOfSound, float maxSpeedOfSound,
|
||||
float sampleRate, float maxSample,
|
||||
const Aurora::Matrix &aVSosOffsetBlock,
|
||||
double startOffset, double segmentLenOffset);
|
||||
float startOffset, float segmentLenOffset);
|
||||
|
||||
TimeWindowResult applyTimeWindowing(
|
||||
const Aurora::Matrix &AscanBlock, double sampleRate,
|
||||
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);
|
||||
|
||||
Aurora::Matrix
|
||||
detectAttVectorized(const Aurora::Matrix &Ascan, const Aurora::Matrix &AscanRef,
|
||||
const Aurora::Matrix &distRef,
|
||||
const Aurora::Matrix &sosWaterRef,
|
||||
const Aurora::Matrix &tof, int aScanReconstructionFrequency,
|
||||
double offsetElectronic, int detectionWindowATT);
|
||||
float offsetElectronic, int detectionWindowATT);
|
||||
|
||||
DetectResult
|
||||
detectTofVectorized(
|
||||
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);
|
||||
|
||||
DetectResult
|
||||
detectTofAndAtt(
|
||||
const Aurora::Matrix &AscanBlock, const Aurora::Matrix &AscanRefBlock,
|
||||
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);
|
||||
int detectionWindowATT, float offsetElectronic, int detectionWindowSOS,
|
||||
float minSpeedOfSound, float maxSpeedOfSound, bool gaussWindow);
|
||||
|
||||
DetectResult
|
||||
detectTofAndAttMex(
|
||||
const Aurora::Matrix &AscanBlock, const Aurora::Matrix &AscanRefBlock,
|
||||
const Aurora::Matrix &distBlock, const Aurora::Matrix &distBlockRef,
|
||||
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);
|
||||
int detectionWindowATT, float offsetElectronic, int detectionWindowSOS,
|
||||
float minSpeedOfSound, float maxSpeedOfSound, bool gaussWindow);
|
||||
|
||||
DetectResult
|
||||
transmissionDetection(
|
||||
const Aurora::Matrix &AscanBlock, const Aurora::Matrix &AscanRefBlock,
|
||||
const Aurora::Matrix &distBlock, const Aurora::Matrix &distRefBlock,
|
||||
const Aurora::Matrix &sosWaterBlock, const Aurora::Matrix &sosWaterRefBlock, double expectedSOSWater);
|
||||
const Aurora::Matrix &sosWaterBlock, const Aurora::Matrix &sosWaterRefBlock, float expectedSOSWater);
|
||||
|
||||
} // namespace Recon
|
||||
|
||||
|
||||
@@ -81,25 +81,25 @@ namespace
|
||||
if(aExpInfo.Hardware == "USCT3dv3")
|
||||
{
|
||||
Matrix channelList = precalculateChannelList(aRlList, aRnList, aExpInfo, aPreComputes);
|
||||
double* channelListSizeData = Aurora::malloc(2);
|
||||
float* channelListSizeData = Aurora::malloc(2);
|
||||
channelListSizeData[0] = channelList.getDimSize(0);
|
||||
channelListSizeData[1] = channelList.getDimSize(1);
|
||||
Matrix channelListSize = Matrix::New(channelListSizeData, 2, 1);
|
||||
Matrix ind = sub2ind(channelListSize, {blockData.rlBlock, blockData.rnBlock});
|
||||
size_t channelListBlockSize = ind.getDataSize();
|
||||
double* channelListBlockData = Aurora::malloc(channelListBlockSize);
|
||||
float* channelListBlockData = Aurora::malloc(channelListBlockSize);
|
||||
for(size_t i=0; i<channelListBlockSize; ++i)
|
||||
{
|
||||
channelListBlockData[i] = channelList[ind[i] - 1];
|
||||
}
|
||||
Matrix channelListBlock = Matrix::New(channelListBlockData, 1, channelListBlockSize);
|
||||
Matrix fx = fft(ascanBlock);
|
||||
double* fhData = Aurora::malloc(aExpInfo.matchedFilter.getDimSize(0) * channelListBlockSize, true);
|
||||
float* fhData = Aurora::malloc(aExpInfo.matchedFilter.getDimSize(0) * channelListBlockSize, true);
|
||||
Matrix fh = Matrix::New(fhData, aExpInfo.matchedFilter.getDimSize(0), channelListBlockSize, 1, Aurora::Complex);
|
||||
size_t matchedFilterRowDataSize = aExpInfo.matchedFilter.getDimSize(0)*2;
|
||||
for(size_t i=0; i<channelListBlockSize; ++i)
|
||||
{
|
||||
cblas_dcopy(matchedFilterRowDataSize, aExpInfo.matchedFilter.getData() + (size_t)(channelListBlock[i] - 1) * matchedFilterRowDataSize, 1 , fhData ,1);
|
||||
cblas_scopy(matchedFilterRowDataSize, aExpInfo.matchedFilter.getData() + (size_t)(channelListBlock[i] - 1) * matchedFilterRowDataSize, 1 , fhData ,1);
|
||||
fhData += matchedFilterRowDataSize;
|
||||
}
|
||||
// Matrix fxReal = Aurora::real(fx);
|
||||
@@ -108,23 +108,23 @@ namespace
|
||||
// Matrix fhImag = Aurora::imag(fh);
|
||||
// Matrix real = fxReal * fhReal + fxImag * fhImag;
|
||||
// Matrix image = fxImag * fhReal - fxReal * fhImag;
|
||||
double* value1 = Aurora::malloc(fx.getDataSize());
|
||||
vdMulI(fx.getDataSize(), fx.getData(), 2, fh.getData(), 2, value1, 1);
|
||||
double* value2 = Aurora::malloc(fx.getDataSize());
|
||||
vdMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData() + 1, 2, value2, 1);
|
||||
double* realData = Aurora::malloc(fx.getDataSize());
|
||||
vdAdd(fx.getDataSize(), value1, value2, realData);
|
||||
float* value1 = Aurora::malloc(fx.getDataSize());
|
||||
vsMulI(fx.getDataSize(), fx.getData(), 2, fh.getData(), 2, value1, 1);
|
||||
float* value2 = Aurora::malloc(fx.getDataSize());
|
||||
vsMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData() + 1, 2, value2, 1);
|
||||
float* realData = Aurora::malloc(fx.getDataSize());
|
||||
vsAdd(fx.getDataSize(), value1, value2, realData);
|
||||
Matrix real = Matrix::New(realData, fx.getDimSize(0), fx.getDimSize(1));
|
||||
|
||||
vdMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData(), 2, value1, 1);
|
||||
vdMulI(fx.getDataSize(), fx.getData(), 2, fh.getData() + 1, 2, value2, 1);
|
||||
double* imagData = Aurora::malloc(fx.getDataSize());
|
||||
vdSub(fx.getDataSize(), value1, value2, imagData);
|
||||
vsMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData(), 2, value1, 1);
|
||||
vsMulI(fx.getDataSize(), fx.getData(), 2, fh.getData() + 1, 2, value2, 1);
|
||||
float* imagData = Aurora::malloc(fx.getDataSize());
|
||||
vsSub(fx.getDataSize(), value1, value2, imagData);
|
||||
Matrix image = Matrix::New(imagData, fx.getDimSize(0), fx.getDimSize(1));
|
||||
|
||||
double* complexData = Aurora::malloc(real.getDataSize(), true);
|
||||
cblas_dcopy(real.getDataSize(), real.getData(), 1 , complexData ,2);
|
||||
cblas_dcopy(image.getDataSize(), image.getData(), 1 , complexData + 1 ,2);
|
||||
float* complexData = Aurora::malloc(real.getDataSize(), true);
|
||||
cblas_scopy(real.getDataSize(), real.getData(), 1 , complexData ,2);
|
||||
cblas_scopy(image.getDataSize(), image.getData(), 1 , complexData + 1 ,2);
|
||||
Matrix complex = Matrix::New(complexData, real.getDimSize(0), real.getDimSize(1), 1, Aurora::Complex);
|
||||
ascanBlock = Aurora::real(ifft(complex));
|
||||
|
||||
@@ -134,28 +134,28 @@ namespace
|
||||
matchedFilterRowDataSize = aExpInfoRef.matchedFilter.getDimSize(0)*2;
|
||||
for(size_t i=0; i<channelListBlockSize; ++i)
|
||||
{
|
||||
cblas_dcopy(matchedFilterRowDataSize, aExpInfoRef.matchedFilter.getData() + (size_t)(channelListBlock[i] - 1) * matchedFilterRowDataSize, 1 , fhData ,1);
|
||||
cblas_scopy(matchedFilterRowDataSize, aExpInfoRef.matchedFilter.getData() + (size_t)(channelListBlock[i] - 1) * matchedFilterRowDataSize, 1 , fhData ,1);
|
||||
fhData += matchedFilterRowDataSize;
|
||||
}
|
||||
// real = Aurora::real(fx) * Aurora::real(fh) + Aurora::imag(fx) * Aurora::imag(fh);
|
||||
// image = Aurora::imag(fx) * Aurora::real(fh) - Aurora::real(fx) * Aurora::imag(fh);
|
||||
vdMulI(fx.getDataSize(), fx.getData(), 2, fh.getData(), 2, value1, 1);
|
||||
vdMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData() + 1, 2, value2, 1);
|
||||
vsMulI(fx.getDataSize(), fx.getData(), 2, fh.getData(), 2, value1, 1);
|
||||
vsMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData() + 1, 2, value2, 1);
|
||||
realData = Aurora::malloc(fx.getDataSize());
|
||||
vdAdd(fx.getDataSize(), value1, value2, realData);
|
||||
vsAdd(fx.getDataSize(), value1, value2, realData);
|
||||
real = Matrix::New(realData, fx.getDimSize(0), fx.getDimSize(1));
|
||||
|
||||
vdMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData(), 2, value1, 1);
|
||||
vdMulI(fx.getDataSize(), fx.getData(), 2, fh.getData() + 1, 2, value2, 1);
|
||||
vsMulI(fx.getDataSize(), fx.getData() + 1, 2, fh.getData(), 2, value1, 1);
|
||||
vsMulI(fx.getDataSize(), fx.getData(), 2, fh.getData() + 1, 2, value2, 1);
|
||||
imagData = Aurora::malloc(fx.getDataSize());
|
||||
vdSub(fx.getDataSize(), value1, value2, imagData);
|
||||
vsSub(fx.getDataSize(), value1, value2, imagData);
|
||||
image = Matrix::New(imagData, fx.getDimSize(0), fx.getDimSize(1));
|
||||
Aurora::free(value1);
|
||||
Aurora::free(value2);
|
||||
|
||||
complexData = Aurora::malloc(real.getDataSize(), true);
|
||||
cblas_dcopy(real.getDataSize(), real.getData(), 1 , complexData ,2);
|
||||
cblas_dcopy(image.getDataSize(), image.getData(), 1 , complexData + 1 ,2);
|
||||
cblas_scopy(real.getDataSize(), real.getData(), 1 , complexData ,2);
|
||||
cblas_scopy(image.getDataSize(), image.getData(), 1 , complexData + 1 ,2);
|
||||
complex = Matrix::New(complexData, real.getDimSize(0), real.getDimSize(1), 1, Aurora::Complex);
|
||||
ascanBlockRef = Aurora::real(ifft(complex));
|
||||
}
|
||||
@@ -286,8 +286,8 @@ TransmissionData Recon::getTransmissionData(const Aurora::Matrix& aMotorPos, con
|
||||
}
|
||||
|
||||
size_t numScans = aMotorPos.getDataSize() * aSlList.getDataSize() * aSnList.getDataSize() * aRlList.getDataSize() * aRnList.getDataSize();
|
||||
Matrix tofDataTotal = Matrix::fromRawData(new double[numScans], 1, numScans) + NAN;
|
||||
Matrix attDataTotal = Matrix::fromRawData(new double[numScans], 1, numScans) + NAN;
|
||||
Matrix tofDataTotal = Matrix::fromRawData(new float[numScans], 1, numScans) + NAN;
|
||||
Matrix attDataTotal = Matrix::fromRawData(new float[numScans], 1, numScans) + NAN;
|
||||
Matrix waterTempList = zeros(1,numScans,1);
|
||||
Matrix senderList = zeros(3,numScans,1);
|
||||
Matrix receiverList = zeros(3,numScans,1);
|
||||
@@ -344,24 +344,24 @@ TransmissionData Recon::getTransmissionData(const Aurora::Matrix& aMotorPos, con
|
||||
size_t numUsedData = transmissionBlock.senderBlock.getDimSize(1);
|
||||
if(transParams::applyCalib)
|
||||
{
|
||||
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.snrValues.getData(), 1, snrValues.getData() + numData, 1);
|
||||
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.snrValuesRef.getData(), 1, snrValuesRef.getData() + numData, 1);
|
||||
cblas_scopy(numUsedData, transmissionBlock.metaInfos.snrValues.getData(), 1, snrValues.getData() + numData, 1);
|
||||
cblas_scopy(numUsedData, transmissionBlock.metaInfos.snrValuesRef.getData(), 1, snrValuesRef.getData() + numData, 1);
|
||||
}
|
||||
|
||||
int rows = transmissionBlock.senderBlock.getDimSize(0);
|
||||
cblas_dcopy(numUsedData * rows, transmissionBlock.senderBlock.getData(), 1, senderList.getData() + numData*rows, 1);
|
||||
cblas_dcopy(numUsedData * rows, transmissionBlock.receiverBlock.getData(), 1, receiverList.getData() + numData*rows, 1);
|
||||
cblas_dcopy(numUsedData, transmissionBlock.tofData.getData(), 1, tofDataTotal.getData() + numData, 1);
|
||||
cblas_dcopy(numUsedData, transmissionBlock.attData.getData(), 1, attDataTotal.getData() + numData, 1);
|
||||
cblas_dcopy(numUsedData, transmissionBlock.waterTempBlock.getData(), 1, waterTempList.getData() + numData, 1);
|
||||
cblas_scopy(numUsedData * rows, transmissionBlock.senderBlock.getData(), 1, senderList.getData() + numData*rows, 1);
|
||||
cblas_scopy(numUsedData * rows, transmissionBlock.receiverBlock.getData(), 1, receiverList.getData() + numData*rows, 1);
|
||||
cblas_scopy(numUsedData, transmissionBlock.tofData.getData(), 1, tofDataTotal.getData() + numData, 1);
|
||||
cblas_scopy(numUsedData, transmissionBlock.attData.getData(), 1, attDataTotal.getData() + numData, 1);
|
||||
cblas_scopy(numUsedData, transmissionBlock.waterTempBlock.getData(), 1, waterTempList.getData() + numData, 1);
|
||||
|
||||
if(transParams::saveDetection || transParams::outlierOnTasDetection || transParams::saveDebugInfomation)
|
||||
{
|
||||
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.mpBlock.getData(), 1, mpBlockTotal.getData() + numData, 1);
|
||||
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.slBlock.getData(), 1, slBlockTotal.getData() + numData, 1);
|
||||
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.snBlock.getData(), 1, snBlockTotal.getData() + numData, 1);
|
||||
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.rlBlock.getData(), 1, rlBlockTotal.getData() + numData, 1);
|
||||
cblas_dcopy(numUsedData, transmissionBlock.metaInfos.rnBlock.getData(), 1, rnBlockTotal.getData() + numData, 1);
|
||||
cblas_scopy(numUsedData, transmissionBlock.metaInfos.mpBlock.getData(), 1, mpBlockTotal.getData() + numData, 1);
|
||||
cblas_scopy(numUsedData, transmissionBlock.metaInfos.slBlock.getData(), 1, slBlockTotal.getData() + numData, 1);
|
||||
cblas_scopy(numUsedData, transmissionBlock.metaInfos.snBlock.getData(), 1, snBlockTotal.getData() + numData, 1);
|
||||
cblas_scopy(numUsedData, transmissionBlock.metaInfos.rlBlock.getData(), 1, rlBlockTotal.getData() + numData, 1);
|
||||
cblas_scopy(numUsedData, transmissionBlock.metaInfos.rnBlock.getData(), 1, rnBlockTotal.getData() + numData, 1);
|
||||
}
|
||||
numData += numUsedData;
|
||||
std::unique_lock<std::mutex> lockBufferCount(CREATE_BUFFER_MUTEX);
|
||||
@@ -376,7 +376,7 @@ TransmissionData Recon::getTransmissionData(const Aurora::Matrix& aMotorPos, con
|
||||
}
|
||||
speedUpThread.join();
|
||||
|
||||
double* filterData = Aurora::malloc(tofDataTotal.getDataSize());
|
||||
float* filterData = Aurora::malloc(tofDataTotal.getDataSize());
|
||||
for(int i=0;i<tofDataTotal.getDataSize();++i)
|
||||
{
|
||||
if(tofDataTotal[i] != tofDataTotal[i])
|
||||
@@ -420,7 +420,7 @@ TransmissionData Recon::getTransmissionData(const Aurora::Matrix& aMotorPos, con
|
||||
}
|
||||
|
||||
DataInfo dataInfno;
|
||||
double* findDefectData = Aurora::malloc(valid.getDataSize());
|
||||
float* findDefectData = Aurora::malloc(valid.getDataSize());
|
||||
int findDefectDataIndex = 0;
|
||||
for(int i=0; i<valid.getDataSize(); ++i)
|
||||
{
|
||||
|
||||
@@ -118,19 +118,19 @@ Aurora::Matrix b3dMexDouble(const Aurora::Matrix& StartPt, const Aurora::Matrix&
|
||||
return Aurora::Matrix::fromRawData(temp, 3, size / 3);
|
||||
}
|
||||
|
||||
double * b3dMexDouble(double *startPoint,double *endPoint, size_t& outputSize) {
|
||||
float * b3dMexDouble(float *startPoint,float *endPoint, size_t& outputSize) {
|
||||
|
||||
std::vector<double> points;
|
||||
std::vector<float> points;
|
||||
|
||||
double i, l, m, n, x_inc, y_inc, z_inc, err_1, err_2, dx2, dy2, dz2, x,y,z;
|
||||
float i, l, m, n, x_inc, y_inc, z_inc, err_1, err_2, dx2, dy2, dz2, x,y,z;
|
||||
|
||||
x = startPoint[0];
|
||||
y = startPoint[1];
|
||||
z = startPoint[2];
|
||||
|
||||
double dx = endPoint[0] - x;
|
||||
double dy = endPoint[1] - y;
|
||||
double dz = endPoint[2] - z;
|
||||
float dx = endPoint[0] - x;
|
||||
float dy = endPoint[1] - y;
|
||||
float dz = endPoint[2] - z;
|
||||
|
||||
x_inc = (dx < 0) ? -1 : 1;
|
||||
l = abs(dx);
|
||||
@@ -210,7 +210,7 @@ double * b3dMexDouble(double *startPoint,double *endPoint, size_t& outputSize) {
|
||||
}
|
||||
}
|
||||
|
||||
double* output = new double[points.size()];
|
||||
float* output = new float[points.size()];
|
||||
std::copy(points.begin(), points.end(), output);
|
||||
outputSize = points.size();
|
||||
return output;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "Matrix.h"
|
||||
namespace Recon {
|
||||
float* b3dMex(float *startPoint, float *endPoint,std::size_t &outputSize );
|
||||
double * b3dMexDouble(double *startPoint,double *endPoint, size_t& outputSize);
|
||||
float * b3dMexDouble(float *startPoint,float *endPoint, size_t& outputSize);
|
||||
Aurora::Matrix b3dMexDouble(const Aurora::Matrix& StartPt, const Aurora::Matrix& endPts);
|
||||
}
|
||||
#endif // __B3DMEX_H__
|
||||
@@ -22,43 +22,43 @@
|
||||
#define ERR_ID "JSimon:DGradient:"
|
||||
|
||||
// Prototypes: -----------------------------------------------------------------
|
||||
void CoreDim1Space1(double *X, const mwSize M, const mwSize nDX, double Space,
|
||||
double *Y);
|
||||
void CoreDimNSpace1(double *X, const mwSize step, const mwSize nX,
|
||||
const mwSize nDX, double Space, double *Y);
|
||||
void CoreDim1Space1(float *X, const mwSize M, const mwSize nDX, float Space,
|
||||
float *Y);
|
||||
void CoreDimNSpace1(float *X, const mwSize step, const mwSize nX,
|
||||
const mwSize nDX, float Space, float *Y);
|
||||
|
||||
void WrapSpaceN(double *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, double *Factor, double *Y);
|
||||
void GetFactor(double *Space, mwSize nDX, double *Factor);
|
||||
void CoreDim1SpaceN(double *X, const mwSize M, const mwSize nDX,
|
||||
double *Space, double *Y);
|
||||
// void CoreDimNSpaceN(double *X, const mwSize step, const mwSize nX,
|
||||
// const mwSize nDX, double *Space, double *Y);
|
||||
void CoreDim1FactorN(double *X, const mwSize M, const mwSize nDX,
|
||||
double *Factor, double *Y);
|
||||
void CoreDimNFactorN(double *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, double *Factor, double *Y);
|
||||
void WrapSpaceN(float *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, float *Factor, float *Y);
|
||||
void GetFactor(float *Space, mwSize nDX, float *Factor);
|
||||
void CoreDim1SpaceN(float *X, const mwSize M, const mwSize nDX,
|
||||
float *Space, float *Y);
|
||||
// void CoreDimNSpaceN(float *X, const mwSize step, const mwSize nX,
|
||||
// const mwSize nDX, float *Space, float *Y);
|
||||
void CoreDim1FactorN(float *X, const mwSize M, const mwSize nDX,
|
||||
float *Factor, float *Y);
|
||||
void CoreDimNFactorN(float *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, float *Factor, float *Y);
|
||||
|
||||
void WrapSpaceNOrder2(double *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, double *Space, double *Y);
|
||||
void GetFactorOrder2(double *Space, const mwSize nDX,
|
||||
double *A, double *B, double *C);
|
||||
void CoreDim1SpaceNOrder2(double *X, const mwSize nX, const mwSize nDX,
|
||||
double *Space, double *Y);
|
||||
void CoreDimNSpaceNOrder2(double *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, double *Space, double *Y);
|
||||
void CoreDim1FactorNOrder2(double *X, const mwSize nX, const mwSize nDX,
|
||||
double *A, double *B, double *C, double *Y);
|
||||
void CoreDimNFactorNOrder2(double *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, double *A, double *B, double *C, double *Y);
|
||||
void WrapSpaceNOrder2(float *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, float *Space, float *Y);
|
||||
void GetFactorOrder2(float *Space, const mwSize nDX,
|
||||
float *A, float *B, float *C);
|
||||
void CoreDim1SpaceNOrder2(float *X, const mwSize nX, const mwSize nDX,
|
||||
float *Space, float *Y);
|
||||
void CoreDimNSpaceNOrder2(float *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, float *Space, float *Y);
|
||||
void CoreDim1FactorNOrder2(float *X, const mwSize nX, const mwSize nDX,
|
||||
float *A, float *B, float *C, float *Y);
|
||||
void CoreDimNFactorNOrder2(float *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, float *A, float *B, float *C, float *Y);
|
||||
|
||||
mwSize FirstNonSingeltonDim(const mwSize Xndim, const mwSize *Xdim);
|
||||
mwSize GetStep(const mwSize *Xdim, const mwSize N);
|
||||
|
||||
// Main function ===============================================================
|
||||
Aurora::Matrix Recon::DGradient(const Aurora::Matrix aX,double aSpacing,double aDim)
|
||||
Aurora::Matrix Recon::DGradient(const Aurora::Matrix aX,float aSpacing,float aDim)
|
||||
{
|
||||
double *X, *Y, Nd, *Space, UnitSpace = 1.0;
|
||||
float *X, *Y, Nd, *Space, UnitSpace = 1.0;
|
||||
mwSize nX, nDX, ndimX, N, Step, nSpace = 1;
|
||||
const mwSize *dimX;
|
||||
int Order2 = 0;
|
||||
@@ -178,12 +178,12 @@ mwSize GetStep(const mwSize *Xdim, const mwSize N)
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void CoreDim1Space1(double *X, const mwSize nX, const mwSize nDX, double Space,
|
||||
double *Y)
|
||||
void CoreDim1Space1(float *X, const mwSize nX, const mwSize nDX, float Space,
|
||||
float *Y)
|
||||
{
|
||||
// Operate on first dimension, scalar spacing, 1st order method.
|
||||
|
||||
double x0, x1, x2, *Xf, *Xc, fac1, fac2;
|
||||
float x0, x1, x2, *Xf, *Xc, fac1, fac2;
|
||||
|
||||
// Multiplication is faster than division:
|
||||
fac1 = 1.0 / Space;
|
||||
@@ -215,14 +215,14 @@ void CoreDim1Space1(double *X, const mwSize nX, const mwSize nDX, double Space,
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void CoreDimNSpace1(double *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, double Space, double *Y)
|
||||
void CoreDimNSpace1(float *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, float Space, float *Y)
|
||||
{
|
||||
// Operate on any dimension, scalar spacing, 1st order method.
|
||||
// Column oriented approach: Process contiguous memory blocks of input and
|
||||
// output.
|
||||
|
||||
double *Xf, *X0, *X1, *X2, *X3, *Xc, fac1, fac2;
|
||||
float *Xf, *X0, *X1, *X2, *X3, *Xc, fac1, fac2;
|
||||
mwSize nDXStep;
|
||||
|
||||
// Multiplication is faster than division:
|
||||
@@ -261,14 +261,14 @@ void CoreDimNSpace1(double *X, const mwSize Step, const mwSize nX,
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void WrapSpaceN(double *X, const mwSize Step, const mwSize nX, const mwSize nDX,
|
||||
double *Space, double *Y)
|
||||
void WrapSpaceN(float *X, const mwSize Step, const mwSize nX, const mwSize nDX,
|
||||
float *Space, float *Y)
|
||||
{
|
||||
// Call different methods depending of the dimensions ofthe input.
|
||||
// X has more than 1 vector. Therefore precalculating the spacing factors is
|
||||
// cheaper.
|
||||
|
||||
double *Factor;
|
||||
float *Factor;
|
||||
|
||||
// Precalculate spacing factors:
|
||||
if ((Factor =Aurora::malloc(nDX )) == NULL) {
|
||||
@@ -288,14 +288,14 @@ void WrapSpaceN(double *X, const mwSize Step, const mwSize nX, const mwSize nDX,
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void CoreDim1SpaceN(double *X, const mwSize nX, const mwSize nDX,
|
||||
double *Space, double *Y)
|
||||
void CoreDim1SpaceN(float *X, const mwSize nX, const mwSize nDX,
|
||||
float *Space, float *Y)
|
||||
{
|
||||
// Operate on the first dimension, spacing is a vector, order 1 method.
|
||||
// The spacing factors are calculated dynamically. This is efficient for
|
||||
// a single vector, but slower for matrices. No temporary vector is needed.
|
||||
|
||||
double x0, x1, x2, *Xf, *Xg, *Sp, s0, s1, s2;
|
||||
float x0, x1, x2, *Xf, *Xg, *Sp, s0, s1, s2;
|
||||
|
||||
Xf = X + nX;
|
||||
while (X < Xf) {
|
||||
@@ -324,7 +324,7 @@ void CoreDim1SpaceN(double *X, const mwSize nX, const mwSize nDX,
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void GetFactor(double *Space, mwSize nDX, double *F)
|
||||
void GetFactor(float *Space, mwSize nDX, float *F)
|
||||
{
|
||||
// If more than one vector is processed, it is cheaper to calculate the spacing
|
||||
// factors once. This needs the memory for a temporary vector.
|
||||
@@ -335,7 +335,7 @@ void GetFactor(double *Space, mwSize nDX, double *F)
|
||||
// F: Factors, pointer to DOUBLE vector:
|
||||
// [ 1/(S[1]-S[0]), 1/(S[i+1]-S[i-1]), 1/(S[nDX-1]-S[nDX-2]) ]
|
||||
|
||||
double s0, s1, s2, *Ff;
|
||||
float s0, s1, s2, *Ff;
|
||||
|
||||
Ff = F + nDX - 1;
|
||||
s0 = *Space++;
|
||||
@@ -355,15 +355,15 @@ void GetFactor(double *Space, mwSize nDX, double *F)
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void CoreDim1FactorN(double *X, const mwSize nX, const mwSize nDX,
|
||||
double *Factor, double *Y)
|
||||
void CoreDim1FactorN(float *X, const mwSize nX, const mwSize nDX,
|
||||
float *Factor, float *Y)
|
||||
{
|
||||
// Operate on first dimension, spacing is a vector, 1st order method.
|
||||
// The spacing factors are calculated before. This needs a temporary vector
|
||||
// of nDX elements. It is faster than the dynamically calculated spacing
|
||||
// factors.
|
||||
|
||||
double x0, x1, x2, *Xf, *Xc, *Fp;
|
||||
float x0, x1, x2, *Xf, *Xc, *Fp;
|
||||
|
||||
Xf = X + nX;
|
||||
while (X < Xf) {
|
||||
@@ -387,15 +387,15 @@ void CoreDim1FactorN(double *X, const mwSize nX, const mwSize nDX,
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void CoreDimNFactorN(double *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, double *Factor, double *Y)
|
||||
void CoreDimNFactorN(float *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, float *Factor, float *Y)
|
||||
{
|
||||
// Operate on any dimension, spacing is a vector, 1st order method.
|
||||
// The spacing factors are calculated before. This needs a temporary vector
|
||||
// of nDX elements. This is faster than the dynamically calculated spacing
|
||||
// factors, if more than one vector is processed.
|
||||
|
||||
double *Xf, *X1, *X2, *Xc, *Fp, *Ff;
|
||||
float *Xf, *X1, *X2, *Xc, *Fp, *Ff;
|
||||
|
||||
Ff = Factor + nDX - 1; // Zero-based indexing!
|
||||
|
||||
@@ -430,14 +430,14 @@ void CoreDimNFactorN(double *X, const mwSize Step, const mwSize nX,
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void WrapSpaceNOrder2(double *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, double *Space, double *Y)
|
||||
void WrapSpaceNOrder2(float *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, float *Space, float *Y)
|
||||
{
|
||||
// Call different methods depending of the dimensions ofthe input.
|
||||
// X has more than one vector. Therefore it is cheaper to calculate the
|
||||
// spacing factors once only.
|
||||
|
||||
double *A, *B, *C;
|
||||
float *A, *B, *C;
|
||||
|
||||
// Precalculate spacing factors:
|
||||
A = Aurora::malloc(nDX);
|
||||
@@ -466,12 +466,12 @@ void WrapSpaceNOrder2(double *X, const mwSize Step, const mwSize nX,
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void GetFactorOrder2(double *Space, const mwSize nDX,
|
||||
double *A, double *B, double *C)
|
||||
void GetFactorOrder2(float *Space, const mwSize nDX,
|
||||
float *A, float *B, float *C)
|
||||
{
|
||||
// Calculate spacing factors for 2nd order method.
|
||||
|
||||
double s0, s1, s2, s10, s21, *Sf;
|
||||
float s0, s1, s2, s10, s21, *Sf;
|
||||
|
||||
Sf = Space + nDX;
|
||||
|
||||
@@ -499,15 +499,15 @@ void GetFactorOrder2(double *Space, const mwSize nDX,
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void CoreDim1SpaceNOrder2(double *X, const mwSize nX, const mwSize nDX,
|
||||
double *Space, double *Y)
|
||||
void CoreDim1SpaceNOrder2(float *X, const mwSize nX, const mwSize nDX,
|
||||
float *Space, float *Y)
|
||||
{
|
||||
// Operate on first dimension, spacing is a vector, 2nd order method.
|
||||
// For unevenly spaced data this algorithm is 2nd order accurate.
|
||||
// This is fast for a single vector, while for arrays with more dimensions
|
||||
// is is cheaper to calculate the spacing factors once externally.
|
||||
|
||||
double x0, x1, x2, *Xf, *Xc, *Sp, s0, s1, s2, s10, s21;
|
||||
float x0, x1, x2, *Xf, *Xc, *Sp, s0, s1, s2, s10, s21;
|
||||
|
||||
Xf = X + nX;
|
||||
while (X < Xf) {
|
||||
@@ -540,8 +540,8 @@ void CoreDim1SpaceNOrder2(double *X, const mwSize nX, const mwSize nDX,
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void CoreDimNSpaceNOrder2(double *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, double *Space, double *Y)
|
||||
void CoreDimNSpaceNOrder2(float *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, float *Space, float *Y)
|
||||
{
|
||||
// Operate on any dimension, spacing is a vector, 2nd order method.
|
||||
// The spacing factors are calculated dynamically. This is about 50% slower
|
||||
@@ -549,9 +549,9 @@ void CoreDimNSpaceNOrder2(double *X, const mwSize Step, const mwSize nX,
|
||||
// registers are exhausted. Therefore this method is useful only, if the
|
||||
// memory is nearly full.
|
||||
|
||||
double *Xf, *X0, *X1, *X2, *Xc, *Sp, *Sb;
|
||||
register double a, b, c;
|
||||
double s0, s1, s2;
|
||||
float *Xf, *X0, *X1, *X2, *Xc, *Sp, *Sb;
|
||||
register float a, b, c;
|
||||
float s0, s1, s2;
|
||||
|
||||
Sb = Space + nDX;
|
||||
|
||||
@@ -595,15 +595,15 @@ void CoreDimNSpaceNOrder2(double *X, const mwSize Step, const mwSize nX,
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void CoreDim1FactorNOrder2(double *X, const mwSize nX, const mwSize nDX,
|
||||
double *A, double *B, double *C, double *Y)
|
||||
void CoreDim1FactorNOrder2(float *X, const mwSize nX, const mwSize nDX,
|
||||
float *A, float *B, float *C, float *Y)
|
||||
{
|
||||
// Operate on first dimension, spacing is a vector, 2nd order method.
|
||||
// For unevenly spaced data this algorithm is 2nd order accurate.
|
||||
// This is fast for a single vector, while for arrays with more dimensions
|
||||
// is is cheaper to calculate the spacing factors once externally.
|
||||
|
||||
double x0, x1, x2, *Xf, *Xc, *a, *b, *c;
|
||||
float x0, x1, x2, *Xf, *Xc, *a, *b, *c;
|
||||
|
||||
Xf = X + nX;
|
||||
while (X < Xf) {
|
||||
@@ -629,15 +629,15 @@ void CoreDim1FactorNOrder2(double *X, const mwSize nX, const mwSize nDX,
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
void CoreDimNFactorNOrder2(double *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, double *A, double *B, double *C,
|
||||
double *Y)
|
||||
void CoreDimNFactorNOrder2(float *X, const mwSize Step, const mwSize nX,
|
||||
const mwSize nDX, float *A, float *B, float *C,
|
||||
float *Y)
|
||||
{
|
||||
// Operate on any dimension, spacing is a vector, 2nd order method.
|
||||
// The spacing factors are calculated externally once only.
|
||||
|
||||
double *Xf, *X0, *X1, *X2, *Xc, *Af, *a, *b, *c;
|
||||
register double a_, b_, c_;
|
||||
float *Xf, *X0, *X1, *X2, *Xc, *Af, *a, *b, *c;
|
||||
register float a_, b_, c_;
|
||||
|
||||
Af = A + nDX - 1;
|
||||
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
#define __DGRADIENT_H__
|
||||
#include "Matrix.h"
|
||||
namespace Recon {
|
||||
Aurora::Matrix DGradient(const Aurora::Matrix aX,double aSpacing,double aDim);
|
||||
Aurora::Matrix DGradient(const Aurora::Matrix aX,float aSpacing,float aDim);
|
||||
}
|
||||
#endif // __DGRADIENT_H__
|
||||
@@ -82,8 +82,8 @@ namespace Recon
|
||||
|
||||
Aurora::Matrix eikonalMex(const Aurora::Matrix& volume, const Aurora::Matrix& point, int gpuSelection){
|
||||
int dims[3]{volume.getDimSize(0), volume.getDimSize(1), volume.getDimSize(2)};
|
||||
// double * result = eikonal(volume.getData(),dims,point.getData(),gpuSelection);
|
||||
double* result=nullptr;
|
||||
// float * result = eikonal(volume.getData(),dims,point.getData(),gpuSelection);
|
||||
float* result=nullptr;
|
||||
return Matrix::fromRawData(result, dims[0], dims[1], dims[2]);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Recon
|
||||
return result;
|
||||
}
|
||||
|
||||
int sign(double v){
|
||||
int sign(float v){
|
||||
return v==0.0?0:(v<0.0?-1:1);
|
||||
}
|
||||
|
||||
@@ -63,28 +63,28 @@ namespace Recon
|
||||
{
|
||||
TraceLineResult result;
|
||||
uint MAX_PATH_LEN = 1500;
|
||||
double EPS = 1e-5;
|
||||
double INFTY = 999999;
|
||||
float EPS = 1e-5;
|
||||
float INFTY = 999999;
|
||||
|
||||
if (discretization.isNull())
|
||||
{
|
||||
discretization = Matrix::fromRawData(new double[3]{1,1,1},1,3);
|
||||
discretization = Matrix::fromRawData(new float[3]{1,1,1},1,3);
|
||||
}
|
||||
|
||||
auto dir = p2 - p1;
|
||||
dir = dir/norm(dir,Aurora::Norm2);
|
||||
|
||||
double ta = dir[1] / dir[0];
|
||||
float ta = dir[1] / dir[0];
|
||||
|
||||
double tb = dir[2] / dir[0];
|
||||
float tb = dir[2] / dir[0];
|
||||
|
||||
double tc = dir[1] / dir[2];
|
||||
float tc = dir[1] / dir[2];
|
||||
|
||||
auto pts = zeros( MAX_PATH_LEN, 3);
|
||||
auto ds = zeros( 1, MAX_PATH_LEN);
|
||||
pts( 0, $) = p1;
|
||||
ds[0] = 0;
|
||||
double cnt = 1;
|
||||
float cnt = 1;
|
||||
|
||||
auto curpt = p1;
|
||||
int sgx = sign( dir[0]);
|
||||
@@ -142,7 +142,7 @@ namespace Recon
|
||||
{
|
||||
a = floor( curpt[0] - EPS) - curpt[0];
|
||||
}
|
||||
double b = INFTY;
|
||||
float b = INFTY;
|
||||
if (sgy > 0)
|
||||
{
|
||||
b = ceil( curpt[1]+ EPS) - curpt[1];
|
||||
@@ -161,16 +161,16 @@ namespace Recon
|
||||
c = floor( curpt[2] - EPS) - curpt[2];
|
||||
}
|
||||
|
||||
double y1 = a * ta;
|
||||
double z1 = a * tb;
|
||||
float y1 = a * ta;
|
||||
float z1 = a * tb;
|
||||
|
||||
double x2 = b / ta;
|
||||
double z2 = b / tc;
|
||||
float x2 = b / ta;
|
||||
float z2 = b / tc;
|
||||
|
||||
double x3 = c / tb;
|
||||
double y3 = c * tc;
|
||||
float x3 = c / tb;
|
||||
float y3 = c * tc;
|
||||
|
||||
auto v = transpose(abs(Matrix::fromRawData(new double[9]{a, y1, z1, x2, b, z2, x3, y3, c},3,3)));
|
||||
auto v = transpose(abs(Matrix::fromRawData(new float[9]{a, y1, z1, x2, b, z2, x3, y3, c},3,3)));
|
||||
Matrix idx;
|
||||
sortrows(v,&idx);
|
||||
int ix = (int)idx[0];
|
||||
@@ -307,7 +307,7 @@ namespace Recon
|
||||
result.hitmap[linearIndices[i]]+=1;
|
||||
}
|
||||
}
|
||||
// printf("Progress: %f (%zu of %zu)\r\n",(double)rayCount*100/(double)nTotalRays,rayCount,nTotalRays);
|
||||
// printf("Progress: %f (%zu of %zu)\r\n",(float)rayCount*100/(float)nTotalRays,rayCount,nTotalRays);
|
||||
cnt = cnt + pathLenDisc;
|
||||
|
||||
if (cnt < safesize)
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Recon {
|
||||
return res;
|
||||
}
|
||||
|
||||
Aurora::Matrix getDimensions(double aNumPixelXY, const Aurora::Matrix& aVDdims)
|
||||
Aurora::Matrix getDimensions(float aNumPixelXY, const Aurora::Matrix& aVDdims)
|
||||
{
|
||||
int numDim = aVDdims.getDataSize()/2;
|
||||
|
||||
@@ -79,12 +79,12 @@ namespace Recon {
|
||||
return dims;
|
||||
}
|
||||
|
||||
Matrix slownessToSOS(Aurora::Matrix & aVF1, double aSOS_IN_WATER)
|
||||
Matrix slownessToSOS(Aurora::Matrix & aVF1, float aSOS_IN_WATER)
|
||||
{
|
||||
return 1 / (aVF1 + 1 / aSOS_IN_WATER);
|
||||
}
|
||||
|
||||
DiscretizePositionValues discretizePositions(Aurora::Matrix &aVSenderCoordList, Aurora::Matrix &aVReceiverCoordList, double aNumPixelXY)
|
||||
DiscretizePositionValues discretizePositions(Aurora::Matrix &aVSenderCoordList, Aurora::Matrix &aVReceiverCoordList, float aNumPixelXY)
|
||||
{
|
||||
DiscretizePositionValues result;
|
||||
result.ddims = calculateMinimalMaximalTransducerPositions(aVSenderCoordList, aVReceiverCoordList);
|
||||
@@ -117,7 +117,7 @@ namespace Recon {
|
||||
Aurora::Matrix &dims,
|
||||
Aurora::Matrix &senderList,
|
||||
Aurora::Matrix &receiverList, Aurora::Matrix &res,
|
||||
double SOS_IN_WATER)
|
||||
float SOS_IN_WATER)
|
||||
{
|
||||
ArtResult result;
|
||||
int nTotalRays = size(senderList, 2);
|
||||
|
||||
@@ -20,17 +20,17 @@ Aurora::Matrix calculateMinimalMaximalTransducerPositions(
|
||||
|
||||
Aurora::Matrix calculateResolution(const Aurora::Matrix &aVDdims, const Aurora::Matrix &aVDims);
|
||||
|
||||
Aurora::Matrix getDimensions(double aNumPixelXY, const Aurora::Matrix& ddims);
|
||||
Aurora::Matrix getDimensions(float aNumPixelXY, const Aurora::Matrix& ddims);
|
||||
|
||||
Aurora::Matrix slownessToSOS(Aurora::Matrix & aVF1, double aSOS_IN_WATER);
|
||||
Aurora::Matrix slownessToSOS(Aurora::Matrix & aVF1, float aSOS_IN_WATER);
|
||||
|
||||
DiscretizePositionValues discretizePositions(Aurora::Matrix &aVSenderCoordList, Aurora::Matrix &aVReceiverCoordList, double aNumPixelXY);
|
||||
DiscretizePositionValues discretizePositions(Aurora::Matrix &aVSenderCoordList, Aurora::Matrix &aVReceiverCoordList, float aNumPixelXY);
|
||||
|
||||
ArtResult reconstructArt(Aurora::Matrix &data, Aurora::Matrix &dataAtt,
|
||||
Aurora::Matrix &dims,
|
||||
Aurora::Matrix &senderList,
|
||||
Aurora::Matrix &receiverList, Aurora::Matrix &res,
|
||||
double SOS_IN_WATER);
|
||||
float SOS_IN_WATER);
|
||||
|
||||
//TODO: exitBent, reconstructArt, saveTransmissionReconstruction.m
|
||||
|
||||
|
||||
@@ -75,13 +75,13 @@ namespace Recon
|
||||
int nz = std::max(M.getColVector().getDataSize(),std::max(M.getRowVector().getDataSize(),M.getValVector().getDataSize()));
|
||||
sparse_matrix_t A;
|
||||
sparse_matrix_t csrA;
|
||||
mkl_sparse_d_create_coo(&A, sparse_index_base_t::SPARSE_INDEX_BASE_ZERO, rows, cols, nz, yIdxs, xIdxs,values.getData());
|
||||
mkl_sparse_s_create_coo(&A, sparse_index_base_t::SPARSE_INDEX_BASE_ZERO, rows, cols, nz, yIdxs, xIdxs,values.getData());
|
||||
mkl_sparse_convert_csr(A, sparse_operation_t::SPARSE_OPERATION_NON_TRANSPOSE, &csrA);
|
||||
int n_rows,n_cols;
|
||||
int *rows_start,*rows_end,*col_indx;
|
||||
double * csrValues;
|
||||
float * csrValues;
|
||||
sparse_index_base_t index;
|
||||
mkl_sparse_d_export_csr(csrA, &index, &n_rows, &n_cols, &rows_start, &rows_end, &col_indx, &csrValues);
|
||||
mkl_sparse_s_export_csr(csrA, &index, &n_rows, &n_cols, &rows_start, &rows_end, &col_indx, &csrValues);
|
||||
mkl_sparse_destroy(A);
|
||||
delete [] xIdxs;
|
||||
delete [] yIdxs;
|
||||
@@ -89,15 +89,15 @@ namespace Recon
|
||||
int *row_idx = new int[n_rows+1];
|
||||
std::copy(rows_start,rows_start+n_rows,row_idx);
|
||||
row_idx[n_rows] = rows_end[n_rows-1];
|
||||
float* bData = new float[b.getDataSize()];
|
||||
std::copy(b.getData(),b.getData()+b.getDataSize(),bData);
|
||||
float* bData = b.getData();
|
||||
// std::copy(b.getData(),b.getData()+b.getDataSize(),bData);
|
||||
size_t bDims[3]={(size_t)b.getDimSize(0),(size_t)b.getDimSize(1),(size_t)b.getDimSize(2)};
|
||||
size_t rdims[3] = {(size_t)dims[0], (size_t)dims[1], (size_t)dims[2]};
|
||||
bool pagelocked = false;
|
||||
auto result = TVALGPU( col_indx, row_idx, csrValues, M.getM(), M.getN(), nz, bData, bDims, rdims, opt, device, false);
|
||||
mkl_sparse_destroy(csrA);
|
||||
delete [] row_idx;
|
||||
delete [] bData;
|
||||
//delete [] bData;
|
||||
return Aurora::Matrix::fromRawData(result.data, result.dims[0],result.dims[1],result.dims[2]);
|
||||
// return Aurora::Matrix();
|
||||
}
|
||||
|
||||
@@ -14,10 +14,10 @@ namespace Recon
|
||||
{
|
||||
struct TVAL3SolverOptions{
|
||||
Aurora::Matrix gpuSelectionList;
|
||||
double TVAL3MU;
|
||||
double TVAL3MU0;
|
||||
double TVAL3Beta;
|
||||
double TVAL3Beta0;
|
||||
float TVAL3MU;
|
||||
float TVAL3MU0;
|
||||
float TVAL3Beta;
|
||||
float TVAL3Beta0;
|
||||
bool nonNeg = false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user