diff --git a/src/transmissionReconstruction/reconstruction/reconstruction.cpp b/src/transmissionReconstruction/reconstruction/reconstruction.cpp index c0747d9..2aa1667 100644 --- a/src/transmissionReconstruction/reconstruction/reconstruction.cpp +++ b/src/transmissionReconstruction/reconstruction/reconstruction.cpp @@ -83,10 +83,22 @@ namespace Recon { result.res = calculateResolution(result.ddims, result.dims); int numDim = aVSenderCoordList.getDimSize(0); auto tempDdims = result.ddims.block(0,0,numDim-1); - auto tempTransRes = repmat(transpose(result.res),1,2); - auto tempDivRes = repmat(transpose(tempDdims / result.res),1,2); + auto tempTransRes = repmat(transpose(result.res),1,aVSenderCoordList.getDimSize(1)); + auto tempDivRes = repmat(transpose(tempDdims / result.res),1,aVSenderCoordList.getDimSize(1)); aVSenderCoordList = (aVSenderCoordList / tempTransRes) - tempDivRes + 1; aVReceiverCoordList = (aVReceiverCoordList / tempTransRes) - tempDivRes + 1; + { + float* temp = new float[aVReceiverCoordList.getDataSize()]{0}; + std::copy(aVReceiverCoordList.getData(),aVReceiverCoordList.getData()+aVReceiverCoordList.getDataSize(),temp); + std::copy(temp,temp+aVReceiverCoordList.getDataSize(),aVReceiverCoordList.getData()); + delete [] temp; + } + { + float* temp = new float[aVSenderCoordList.getDataSize()]{0}; + std::copy(aVSenderCoordList.getData(),aVSenderCoordList.getData()+aVSenderCoordList.getDataSize(),temp); + std::copy(temp,temp+aVSenderCoordList.getDataSize(),aVSenderCoordList.getData()); + delete [] temp; + } result.receiverCoordList = aVReceiverCoordList; result.senderCoordList = aVSenderCoordList; return result; diff --git a/src/transmissionReconstruction/reconstruction/reconstruction.h b/src/transmissionReconstruction/reconstruction/reconstruction.h index 24378c8..b4d1ae0 100644 --- a/src/transmissionReconstruction/reconstruction/reconstruction.h +++ b/src/transmissionReconstruction/reconstruction/reconstruction.h @@ -4,7 +4,7 @@ namespace Recon { struct DiscretizePositionValues{ Aurora::Matrix senderCoordList; - Aurora::Matrix receiverCoordList; + Aurora::Matrix receiverCoordList; Aurora::Matrix ddims; Aurora::Matrix dims; Aurora::Matrix res; diff --git a/test/Reconstruction_Test.cpp b/test/Reconstruction_Test.cpp index 6181ef0..a5c9d5c 100644 --- a/test/Reconstruction_Test.cpp +++ b/test/Reconstruction_Test.cpp @@ -71,12 +71,13 @@ TEST_F(Reconstruction_Test, discretizePositions) { MatlabReader m("/home/sun/testData/discretizePositions.mat"); auto senderList = m.read("senderList"); auto receiverList = m.read("receiverList"); - auto result = Recon::discretizePositions(senderList,receiverList,Recon::transParams::numPixelXY); auto senderListResult = m.read("senderListResult"); auto receiverListResult = m.read("receiverListResult"); auto dims = m.read("dims"); auto ddims = m.read("ddims"); auto res = m.read("res"); + auto result = Recon::discretizePositions(senderList,receiverList,Recon::transParams::numPixelXY); + EXPECT_DOUBLE_AE(senderListResult.getDataSize(), result.senderCoordList.getDataSize()); for(size_t i=0; i