Backprojection.cpp 1.6 KB
Newer Older
1

2
#include <pinkIndexer/Backprojection.h>
3
4
5
6
7


using namespace std;
using namespace Eigen;

8
namespace pinkIndexer
9
10
{

11
12
13
14
15
16

    Backprojection::Backprojection(const ExperimentSettings& experimentSettings)
        : experimentSettings(experimentSettings)
    {
    }

17
    void Backprojection::backProject(const Matrix2Xf& detectorPeaks_m, Matrix3Xf& ulsDirections, Array2Xf& ulsBorderNorms) const
18
19
20
21
22
23
24
25
26
27
28
    {
        Matrix3Xf projectionDirections(3, detectorPeaks_m.cols());
        projectionDirections << RowVectorXf::Constant(1, detectorPeaks_m.cols(), experimentSettings.getDetectorDistance_m()), detectorPeaks_m.row(0),
            detectorPeaks_m.row(1);
        projectionDirections.colwise().normalize();

        Matrix3Xf backprojectedPointsClose = projectionDirections * experimentSettings.getReciprocalLambdaLong_1A();
        backprojectedPointsClose.row(0) -= RowVectorXf::Constant(backprojectedPointsClose.cols(), experimentSettings.getReciprocalLambdaLong_1A());
        Matrix3Xf backprojectedPointsFar = projectionDirections * experimentSettings.getReciprocalLambdaShort_1A();
        backprojectedPointsFar.row(0) -= RowVectorXf::Constant(backprojectedPointsFar.cols(), experimentSettings.getReciprocalLambdaShort_1A());

29
30
31
        ulsBorderNorms.resize(2, detectorPeaks_m.cols());
        ulsBorderNorms.row(0) = backprojectedPointsClose.colwise().norm().array() - experimentSettings.getReflectionRadius();
        ulsBorderNorms.row(1) = backprojectedPointsFar.colwise().norm().array() + experimentSettings.getReflectionRadius();
32

33
        ulsDirections = backprojectedPointsFar.colwise().normalized();
34
35
    }

36
} // namespace pinkIndexer