Add convertToLinearIndices to common
This commit is contained in:
@@ -52,4 +52,32 @@ namespace Recon
|
||||
// Data2 = ifft(Data2, [], 1);
|
||||
return Aurora::Matrix();
|
||||
}
|
||||
}
|
||||
|
||||
Aurora::Matrix convertToLinearIndices(Aurora::Matrix aVMatrixSize, Aurora::Matrix aMCoordinates)
|
||||
{
|
||||
if (aVMatrixSize.getDataSize() != aMCoordinates.getDimSize(1)){
|
||||
std::cerr<<"convertToLinearIndices fail, Dimension of coordinates and matrix do not fit."<<std::endl;
|
||||
return Aurora::Matrix();
|
||||
}
|
||||
size_t columns = aMCoordinates.getDimSize(1);
|
||||
auto coord_col1= aMCoordinates(Aurora::$,0).toMatrix();
|
||||
auto coord_col2Sub1= aMCoordinates(Aurora::$,1).toMatrix()-1;
|
||||
auto matrixSize_1 = aVMatrixSize.getData()[0];
|
||||
switch (columns) {
|
||||
case 3:
|
||||
{
|
||||
auto matrixSize_2 = aVMatrixSize.getData()[1];
|
||||
auto coord_col3Sub1= aMCoordinates(Aurora::$,2).toMatrix()-1;
|
||||
return coord_col1 + coord_col2Sub1 * matrixSize_1 + coord_col3Sub1 * matrixSize_1 * matrixSize_2;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
return coord_col1 + coord_col2Sub1 * matrixSize_1;
|
||||
}
|
||||
default:
|
||||
std::cerr<<"convertToLinearIndices fail,NotImplemented, Converting into linear indices only implemented for 2D and 3D matrices."<<std::endl;
|
||||
return Aurora::Matrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,6 @@ namespace Recon {
|
||||
*/
|
||||
Aurora::Matrix reconstructBandpasssubsampling(Aurora::Matrix aMatrix, double aAScanReconstructionFreq, double SampleRate);
|
||||
|
||||
|
||||
Aurora::Matrix convertToLinearIndices(Aurora::Matrix aVMatrixSize, Aurora::Matrix aMCoordinates);
|
||||
}
|
||||
#endif //RECON_COMMON_H
|
||||
|
||||
Reference in New Issue
Block a user