From 6ab314d4260835c5d1ac0f0ad418986aec71f78a Mon Sep 17 00:00:00 2001 From: kradchen Date: Thu, 15 Jun 2023 15:43:18 +0800 Subject: [PATCH] Detach ATT from UR --- CMakeLists.txt | 8 +-- .../reconstructionSAFT/reconstructionSAFT.cpp | 54 ++++++++++--------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de8dbd4..6055851 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.16) project(UR) + set(CMAKE_CXX_STANDARD 14) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -19,13 +20,11 @@ target_include_directories(UR PUBLIC ${URDepends_INCLUDES_DIRS}) target_link_libraries(UR PUBLIC ${Aurora_Libraries}) target_link_libraries(UR PUBLIC matio) target_link_libraries(UR PUBLIC ${Parser_Libraries}) - 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 URDepends::SaftATT) - +# target_link_libraries(UR PUBLIC URDepends::SaftATT) find_package(GTest REQUIRED) INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS}) @@ -46,5 +45,6 @@ target_link_libraries(UR_Test PUBLIC URDepends::TransDetection) target_link_libraries(UR_Test PUBLIC URDepends::eikonal) target_link_libraries(UR_Test PUBLIC URDepends::TVALGPU) target_link_libraries(UR_Test PUBLIC URDepends::SaftTofi) -target_link_libraries(UR_Test PUBLIC URDepends::SaftATT) +# target_link_libraries(UR_Test PUBLIC URDepends::SaftATT) + gtest_discover_tests(UR_Test) \ No newline at end of file diff --git a/src/reflectionReconstruction/reconstructionSAFT/reconstructionSAFT.cpp b/src/reflectionReconstruction/reconstructionSAFT/reconstructionSAFT.cpp index e386cee..f2d7b42 100644 --- a/src/reflectionReconstruction/reconstructionSAFT/reconstructionSAFT.cpp +++ b/src/reflectionReconstruction/reconstructionSAFT/reconstructionSAFT.cpp @@ -5,7 +5,7 @@ #include "Function3D.h" #include "Matrix.h" #include "SAFTStructs.h" -#include "SAFT_ATT.h" +// #include "SAFT_ATT.h" #include "SAFT_TOFI.h" #include "common/dataBlockCreation/removeDataFromArrays.h" #include "config/config.h" @@ -95,8 +95,8 @@ namespace Recon { Matrix_t receiverGeom{nullptr, (size_t)receiverPosGeom.getDims(), - {(size_t)receiverPosGeom.getDimSize(1), - (size_t)receiverPosGeom.getDimSize(0), + {(size_t)receiverPosGeom.getDimSize(0), + (size_t)receiverPosGeom.getDimSize(1), (size_t)receiverPosGeom.getDimSize(2)}, receiverPosGeom.getDataSize()}; float *fdata = new float[receiverPosGeom.getDataSize()]{0}; @@ -107,7 +107,7 @@ namespace Recon { Matrix_t senderGeom{nullptr, (size_t)senderPosGeom.getDims(), - {(size_t)senderPosGeom.getDimSize(1), + {(size_t)senderPosGeom.getDimSize(0), (size_t)senderPosGeom.getDimSize(1), (size_t)senderPosGeom.getDimSize(2)}, senderPosGeom.getDataSize()}; @@ -122,7 +122,7 @@ namespace Recon { int saftVariant_v[6]{(int)reflectParams::saftVariant[0],(int)reflectParams::saftVariant[1],(int)reflectParams::saftVariant[2], (int)reflectParams::saftVariant[3],(int)reflectParams::saftVariant[4],(int)reflectParams::saftVariant[5]}; - Matrix_t saftVariant{saftVariant_v,2,{1,6,1},3}; + Matrix_t saftVariant{saftVariant_v,2,{1,6,1},6}; params.push_back(saftVariant); Matrix_t SpeedMap3D{nullptr, @@ -216,20 +216,22 @@ namespace Recon { Matrix_t otherP{other,2,{1,2,1},2}; params.push_back(otherP); if (reflectParams::useAscanIndex == 0) { - auto result = SAFT_ATT(params); - delete [] ASdata; - delete [] (float*)imageStartpoint.Data; - delete [] temp1; - delete [] temp2; - delete [] fdata; - delete [] fdata1; - delete [] fdata2; - delete [] fdata3; - delete [] fdata4; - delete [] fdata5; - delete [] gdata; - return Aurora::Matrix::fromRawData((double *)result.Data, result.Dims[0], - result.Dims[1], result.Dims[2]); + // auto result = SAFT_ATT(params); + // delete [] ASdata; + // delete [] (float*)imageStartpoint.Data; + // delete [] temp1; + // delete [] temp2; + // delete [] fdata; + // delete [] fdata1; + // delete [] fdata2; + // delete [] fdata3; + // delete [] fdata4; + // delete [] fdata5; + // delete [] gdata; + // return Aurora::Matrix::fromRawData((double *)result.Data, result.Dims[0], + // result.Dims[1], result.Dims[2]); + + return Aurora::Matrix(); } else { auto result = SAFT_TOFI(params); delete [] ASdata; @@ -263,10 +265,10 @@ namespace Recon { auto senderPos_s = Aurora::transpose(removeDataFromArrays(senderPos, mpIdxs)); auto receiverPos_s = Aurora::transpose(removeDataFromArrays(receiverPos, mpIdxs)); Aurora::Matrix idsSender ; - auto senderPosGeom = Aurora::uniqueByRows(receiverPos_s, idsSender); + auto senderPosGeom = Aurora::transpose(Aurora::uniqueByRows(senderPos_s, idsSender)); idsSender = Aurora::transpose(idsSender); Aurora::Matrix idsReceiver ; - auto receiverPosGeom = Aurora::uniqueByRows(receiverPos_s, idsReceiver); + auto receiverPosGeom = Aurora::transpose(Aurora::uniqueByRows(receiverPos_s, idsReceiver)); idsReceiver = Aurora::transpose(idsReceiver); auto numUsedData = countMp; @@ -280,14 +282,16 @@ namespace Recon { size_t length = blockIdxs[i + 1] - blockIdxs[i]; size_t begin = blockIdxs[i]; size_t end = blockIdxs[i + 1]; - auto _AScans = Aurora::zeros(AScans.getDimSize(0), length); + auto receiverIndex = Aurora::zeros(1, length); auto senderIndex = Aurora::zeros(1, length); + auto mpIdxs_d = Aurora::zeros(1,mpIdxs.getDataSize()); for (size_t j = begin, k = 0; j < end; j++, k++) { - _AScans(Aurora::$, k) = AScans(Aurora::$, mpIdxs[j]); - receiverIndex[k] = idsReceiver[j]; - senderIndex[k] = idsSender[j]; + mpIdxs_d[j] =mpIdxs[j]; + receiverIndex[k] = idsReceiver[j]+1; + senderIndex[k] = idsSender[j]+1; } + auto _AScans = removeDataFromArrays(AScans, mpIdxs_d); Env = callSAFT(_AScans, receiverIndex, senderIndex, receiverPosGeom, senderPosGeom, SAFT_mode, TimeInterval, transRecos, Env); }