Fix discretizePositions
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<senderListResult.getDataSize(); ++i)
|
||||
|
||||
Reference in New Issue
Block a user