Sinogram.h 1.82 KB
Newer Older
1
2
3
4
#pragma once

#define EIGEN_DONT_PARALLELIZE

5
6
7
#include <pinkIndexer/Lattice.h>
#include <pinkIndexer/ReflectionsInRangeFinder.h>
#include <pinkIndexer/eigenSTLContainers.h>
8
9
10
11
#include <Eigen/Dense>
#include <string>
#include <vector>

12
namespace pinkIndexer
13
{
14
15
16
17
    class Sinogram
    {
      public:
        Sinogram(const Lattice& lattice);
18

19
        void setSinogramAngleResolution(float angleResolution_deg);
20

21
22
23
        void computeSinogram(const Eigen::Matrix3Xf& ulsDirections, const Eigen::Matrix2Xf ulsBorderNorms);
        void computeSinogramParallel(const Eigen::Matrix3Xf& ulsDirections, const Eigen::Matrix2Xf ulsBorderNorms, int slaveThreadCount);
        void computeSinogramParallel2(const Eigen::Matrix3Xf& ulsDirections, const Eigen::Matrix2Xf ulsBorderNorms, int slaveThreadCount);
24

25
        void getBestRotation(Eigen::AngleAxisf& bestRotation);
26

27
        void saveToFile(std::string fileName);
28

29
30
31
      private:
        void computePartOfSinogramOnePeak(Eigen::Matrix3Xf* candidateReflectionDirections, Eigen::Vector3f* l, int threadCount, int threadNumber);
        void getLocalCenterOfMass(Eigen::Vector3f& centerOfMassSub, const Eigen::Matrix<uint32_t, 3, 1>& centerElementSub);
32

33
        ReflectionsInRangeFinder reflectionsInRangeFinder;
34

35
36
37
38
39
40
41
42
43
        float angleResolution_deg;
        uint32_t sinogramSize_exact, sinogramSize, sinogramCenter;
        float sinogramScale;
        uint32_t anglesCount;
        Eigen::Matrix<uint32_t, 1, 2> strides;
        Eigen::Matrix<uint32_t, 28, 1> dilationOffsets; // actually 27, but padded to be fixed-size-vectorizeable
        Eigen::Array<float, 1, Eigen::Dynamic> sinah, cosah;
        float realToMatrixScaling, realToMatrixOffset;
        Eigen::Matrix<uint8_t, Eigen::Dynamic, 1> sinogram, sinogram_oneMeasuredPeak;
44

45
46
47
      public:
        EIGEN_MAKE_ALIGNED_OPERATOR_NEW
    };
48
} // namespace pinkIndexer