diff --git a/src/reflectionReconstruction/preprocessData/preprocessAScanBlockForReflection.cpp b/src/reflectionReconstruction/preprocessData/preprocessAScanBlockForReflection.cpp index 3b23429..c9a9e2d 100644 --- a/src/reflectionReconstruction/preprocessData/preprocessAScanBlockForReflection.cpp +++ b/src/reflectionReconstruction/preprocessData/preprocessAScanBlockForReflection.cpp @@ -112,7 +112,7 @@ namespace Recon { const Aurora::Matrix &blockedSenderPosition, const Aurora::Matrix &blockedReceiverPosition, const Aurora::Matrix &blockedGain, const Aurora::Matrix &blockedChannels, - ExpInfo &info, const PreComputes &preComputes) { + MeasurementInfo &info, const PreComputes &preComputes) { std::vector result; auto t = size(blockedAScans); size_t nSamples = (int)t[0]; @@ -371,7 +371,7 @@ namespace Recon { const Aurora::Matrix &blockedSenderPosition, const Aurora::Matrix &blockedReceiverPosition, const Aurora::Matrix &blockedGain, const Aurora::Matrix &blockedChannels, - ExpInfo &info, const PreComputes &preComputes) + MeasurementInfo &info, const PreComputes &preComputes) { preprocessAScanRResult result; auto valid = Aurora::zeros(1, blockedMP.getDataSize()) ; diff --git a/src/reflectionReconstruction/preprocessData/preprocessAScanBlockForReflection.h b/src/reflectionReconstruction/preprocessData/preprocessAScanBlockForReflection.h index d3ae9ce..2283d79 100644 --- a/src/reflectionReconstruction/preprocessData/preprocessAScanBlockForReflection.h +++ b/src/reflectionReconstruction/preprocessData/preprocessAScanBlockForReflection.h @@ -8,10 +8,6 @@ namespace Recon { Aurora::Matrix AscanBlock; Aurora::Matrix usedData; }; - struct ExpInfo{ - size_t Wavelength; - size_t expectedAScanLength; - }; preprocessAScanRResult preprocessAScanBlockForReflection( Aurora::Matrix &AscanBlock, const Aurora::Matrix &mpBlock, @@ -20,7 +16,7 @@ namespace Recon { const Aurora::Matrix &senderPositionBlock, const Aurora::Matrix &receiverPositionBlock, const Aurora::Matrix &gainBlock, const Aurora::Matrix &channelBlock, - ExpInfo& info, const PreComputes &preComputes); + MeasurementInfo& info, const PreComputes &preComputes); } #endif // __PREPROCESSASCANBLOCKFORREFLECTION_H__ \ No newline at end of file diff --git a/src/reflectionReconstruction/preprocessData/preprocessTransmissionReconstructionForReflection.cpp b/src/reflectionReconstruction/preprocessData/preprocessTransmissionReconstructionForReflection.cpp new file mode 100644 index 0000000..1fcdb76 --- /dev/null +++ b/src/reflectionReconstruction/preprocessData/preprocessTransmissionReconstructionForReflection.cpp @@ -0,0 +1,155 @@ +#include "preprocessTransmissionReconstructionForReflection.h" +#include "Function3D.h" +#include "Matrix.h" +#include "reflectionReconstruction/preprocessData/resampleTransmissionVolume.h" +#include "src/config/config.h" + +#include +#include +#include + +using namespace Aurora; +using namespace Recon; + +PreprocessReflectionData Recon::preprocessTransmissionReconstructionForReflection(const Aurora::Matrix& aSOSMap, const Aurora::Matrix& aATTMap, + const Aurora::Matrix& aDdims, const GeometryInfo& aGeometryInfo, + const TempInfo& aTemp) +{ + PreprocessReflectionData result; + int soundSpeedCorrection = reflectParams::soundSpeedCorrection; + int attenuationCorrection = reflectParams::attenuationCorrection; + Matrix minPos; + Matrix maxPos; + if(!aDdims.isNull()) + { + minPos = Matrix::fromRawData(new double[3], 1, 3); + size_t maxPosSize = aDdims.getDataSize() - 3; + maxPos = Matrix::fromRawData(new double[maxPosSize], 1, maxPosSize); + std::copy(aDdims.getData(), aDdims.getData() + 3, minPos.getData()); + std::copy(aDdims.getData() + 3, aDdims.getData() + 3 + maxPosSize, maxPos.getData()); + } + + if(soundSpeedCorrection == 1) + { + auto sosResampleVolume = resampleTransmissionVolume(aSOSMap, maxPos, minPos, aGeometryInfo); + result.transRecos.deltaTransMap = sosResampleVolume.deltaTransMap; + result.transRecos.beginTransMap = sosResampleVolume.beginTransMap; + // TemperatureModel4D暂无 + // try % use temp model 4D + // speedmapx=transRecos.begin_TransMap(1):transRecos.delta_TransMap:(size(transRecos.SpeedMap3D,1)-1)*transRecos.delta_TransMap + transRecos.begin_TransMap(1); + // speedmapy=transRecos.begin_TransMap(2):transRecos.delta_TransMap:(size(transRecos.SpeedMap3D,2)-1)*transRecos.delta_TransMap + transRecos.begin_TransMap(2); + // speedmapz=transRecos.begin_TransMap(3):transRecos.delta_TransMap:(size(transRecos.SpeedMap3D,3)-1)*transRecos.delta_TransMap + transRecos.begin_TransMap(3); + // tidx=abs(transRecos.SpeedMap3D(:))<1; % voxels to fill + // [ix,iy,iz]=ind2sub(size(transRecos.SpeedMap3D),find(tidx)); + + // %fill with model + // if(~isempty(ix) && ~isempty(iy) && ~isempty(iz)) + // transRecos.SpeedMap3D(tidx) = temperatureToSoundSpeed(polyvaln(temp.TemperatureModel4D.p,[speedmapx(ix)',speedmapy(iy)', speedmapz(iz)', zeros(size(ix))])); %surf(xg,yg,zg,reshape(tg,size(xg))) + // end + // catch + Matrix sppedMap3d = sosResampleVolume.transMap; + for(size_t i=0; i using a water temperature based sound speed map and zero attenuation map.', 1); + + // SAFT_mode = 2; % 0:(-SOS -ATT); 1:(+SOS -ATT); 2:(+SOS +ATT); + + // delta_TransMap = flags.transmissionCorrection.resolutionTransmMap; + + // minTransdPos = min(geometry.minEmitter,geometry.minReceiver); + // maxTransdPos =max(geometry.maxEmitter,geometry.maxReceiver); + // begin_TransMap = (min(flags.imageInfos.imageStartpoint',minTransdPos))' - 3*flags.transmissionCorrection.resolutionTransmMap; %elongate to cope for aperture movements + // end_SpeedMap = max(flags.imageInfos.imageEndpoint',maxTransdPos) + 3*flags.transmissionCorrection.resolutionTransmMap; + // end_SpeedMap(3) = end_SpeedMap(3) +0.025; + + // x = (begin_TransMap(1):delta_TransMap:end_SpeedMap(1))+0.5*delta_TransMap; + // y = (begin_TransMap(2):delta_TransMap:end_SpeedMap(2))+0.5*delta_TransMap; + // z = (begin_TransMap(3):delta_TransMap:end_SpeedMap(3))+0.5*delta_TransMap; + + // [XNEW, YNEW, ZNEW] = ndgrid(x,y,z); + + // try + // transRecos.SpeedMap3D = reshape(temperatureToSoundSpeed(polyvaln(temp.TemperatureModel4D.p,[XNEW(:),YNEW(:), ZNEW(:), zeros(size(XNEW(:)))])),size(XNEW)); + // catch + // try + // transRecos.SpeedMap3D = zeros([length(x), length(y), length(z)]) + temp.expectedSOSWater; + // catch + // writeReconstructionLog('No temperature data available. Can''t create an artificial sound speed map', 4); + // error([mfilename, ':noTemperatureData'],'No temperature data available. Can''t create an artificial sound speed map'); + // end + // end + + // transRecos.begin_TransMap = begin_TransMap; + // transRecos.delta_TransMap = delta_TransMap; + // transRecos.AttenuationMap3D = zeros(size(transRecos.SpeedMap3D)); + // soundSpeedCorrection = 1; % setting sound speed correction to true for SAFT calls + } + else if (soundSpeedCorrection > 0 && attenuationCorrection == 0) + { + result.saftMode = 1; + result.transRecos.attenuationMap3D = zeros(result.transRecos.speedMap3D.getDimSize(0), result.transRecos.speedMap3D.getDimSize(1), result.transRecos.speedMap3D.getDimSize(2)); + } + else if (soundSpeedCorrection > 0 && attenuationCorrection > 0) + { + if (result.transRecos.attenuationMap3D.getDimSize(0) != result.transRecos.speedMap3D.getDimSize(0) || + result.transRecos.attenuationMap3D.getDimSize(1) != result.transRecos.speedMap3D.getDimSize(1) || + result.transRecos.attenuationMap3D.getDimSize(2) != result.transRecos.speedMap3D.getDimSize(2)) + { + std::cout<<"Size of SpeedMap3D ~= Size of AttenuationMap3D."< 0) + { + std::cout<<"Only attenuation correction not allowed."<