PinkIndexer.h 2.42 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once


#include "Backprojection.h"
#include "ExperimentSettings.h"
#include "Lattice.h"
#include "Refinement.h"
#include "SimpleDiffractionPatternPrediction.h"
#include "SimpleProjection.h"
#include "Sinogram.h"
#include <Eigen/Dense>
#include <stdint.h>


class PinkIndexer
{
  public:
    enum class ConsideredPeaksCount
    {
        veryFew,
        few,
        standard,
        many,
        manyMany
    };

    enum class AngleResolution
    {
        extremelyLoose,
        loose,
        standard,
        dense,
        extremelyDense
    };

    enum class RefinementType
    {
        none,
        fixedLatticeParameters,
        variableLatticeParameters,
Yaroslav Gevorkov's avatar
Yaroslav Gevorkov committed
41
        firstFixedThenVariableLatticeParameters,
42
        firstFixedThenVariableLatticeParametersMultiSeedLengths,
43
44
        firstFixedThenVariableLatticeParametersMultiSeed,
        variableLatticeParametersCenterAdjustmentMultiSeed
45
46
47
    };

    PinkIndexer(const ExperimentSettings& experimentSettings, ConsideredPeaksCount consideredPeaksCount, AngleResolution angleResolution,
48
                RefinementType refinementType, float maxResolutionForIndexing_1_per_A);
49

50
    int indexPattern(Lattice& indexedLattice, Eigen::Vector2f& centerShift, Eigen::Array<bool, Eigen::Dynamic, 1>& fittedPeaks, Eigen::RowVectorXf& intensities,
51
                     const Eigen::Matrix2Xf& detectorPeaks_m, int threadCount);
52
    int indexPattern(Lattice& indexedLattice, Eigen::Vector2f& centerShift, Eigen::Array<bool, Eigen::Dynamic, 1>& fittedPeaks, Eigen::RowVectorXf& intensities,
53
                     const Eigen::Matrix3Xf& meanReciprocalPeaks_1_per_A, int threadCount);
54
55

  private:
Yaroslav Gevorkov's avatar
Yaroslav Gevorkov committed
56
    void reducePeakCount(Eigen::Matrix3Xf& ucsDirections, Eigen::Array2Xf& ucsBorderNorms, Eigen::RowVectorXf& intensities,
57
                         const Eigen::Matrix2Xf& detectorPeaks_m);
58
59
    void refine(Lattice& indexedLattice, Eigen::Vector2f& centerShift, const Eigen::Matrix3Xf& ucsDirections, const Eigen::Array2Xf& ucsBorderNorms,
                const Eigen::Matrix2Xf& detectorPeaks_m);
60
61
62
63
64
65
66
67
68
69
70
71
72

    float getAngleResolution();
    int getConsideredPeaksCount();

    SimpleProjection reciprocalToRealProjection;
    Backprojection backprojection;
    Sinogram sinogram;
    Refinement refinement;
    Lattice sampleLattice;

    ConsideredPeaksCount consideredPeaksCount;
    AngleResolution angleResolution;
    RefinementType refinementType;
73
    float maxResolutionForIndexing_1_per_A;
74
    float finalRefinementTolerance;
75
};