Commit e955ee90 authored by Yaroslav Gevorkov's avatar Yaroslav Gevorkov
Browse files

renaming variables to match naming scheme in publication

parent 47c99f8a
...@@ -77,8 +77,8 @@ namespace pinkIndexer ...@@ -77,8 +77,8 @@ namespace pinkIndexer
EigenSTL::vector_Matrix3Xf candidateReflectionsDirections; //unit vectors to all candidate reflections EigenSTL::vector_Matrix3Xf candidateReflectionsDirections; //unit vectors to all candidate reflections
reflectionsInRangeFinder.getReflectionsInRanges(candidateReflectionsDirections, ucsBorderNorms); //get candidate reflections reflectionsInRangeFinder.getReflectionsInRanges(candidateReflectionsDirections, ucsBorderNorms); //get candidate reflections
Matrix3Xf n(3, anglesCount); //resulting rotation axes Matrix3Xf e(3, anglesCount); //resulting rotation axes
Array<float, 1, Eigen::Dynamic> gammah(anglesCount); // gamma half - resulting rotation angle (around n) Array<float, 1, Eigen::Dynamic> thetah(anglesCount); // theta half - resulting rotation angle (around e)
Matrix<uint32_t, 3, Eigen::Dynamic> validSinogramPoints_matrix(3, anglesCount); // coordinates (3D) of sampled curve in sinogram Matrix<uint32_t, 3, Eigen::Dynamic> validSinogramPoints_matrix(3, anglesCount); // coordinates (3D) of sampled curve in sinogram
Matrix<uint32_t, 1, Eigen::Dynamic> validSinogramPoints_matrix_lin(1, anglesCount); //linear indices (1D) of validSinogramPoints_matrix Matrix<uint32_t, 1, Eigen::Dynamic> validSinogramPoints_matrix_lin(1, anglesCount); //linear indices (1D) of validSinogramPoints_matrix
...@@ -93,7 +93,7 @@ namespace pinkIndexer ...@@ -93,7 +93,7 @@ namespace pinkIndexer
cout << "computed " << 100 * (float)measuredPeakNumber / measuredPeaksCount << "%" << endl; cout << "computed " << 100 * (float)measuredPeakNumber / measuredPeaksCount << "%" << endl;
} }
Vector3f l = ucsDirections.col(measuredPeakNumber); // rotation axis Vector3f q = ucsDirections.col(measuredPeakNumber);
Matrix3Xf& candidateReflectionDirections = candidateReflectionsDirections[measuredPeakNumber]; Matrix3Xf& candidateReflectionDirections = candidateReflectionsDirections[measuredPeakNumber];
if (candidateReflectionDirections.cols() == 0) if (candidateReflectionDirections.cols() == 0)
...@@ -103,15 +103,15 @@ namespace pinkIndexer ...@@ -103,15 +103,15 @@ namespace pinkIndexer
int candidatePeaksCount = candidateReflectionDirections.cols(); int candidatePeaksCount = candidateReflectionDirections.cols();
for (int candidatePeakNumber = 0; candidatePeakNumber < candidatePeaksCount; candidatePeakNumber++) //calculation of curves for each candidate peak for (int candidatePeakNumber = 0; candidatePeakNumber < candidatePeaksCount; candidatePeakNumber++) //calculation of curves for each candidate peak
{ {
const auto& candidateReflectionDirection = candidateReflectionDirections.col(candidatePeakNumber); const auto& h = candidateReflectionDirections.col(candidatePeakNumber);
Vector3f m = (candidateReflectionDirection + l).normalized(); Vector3f m = (h + q).normalized();
gammah = acos(sinah * (-l.dot(m))); thetah = acos(sinah * (-q.dot(m)));
n = (m * cosah.matrix() + l.cross(m) * sinah.matrix()).array().rowwise() / sin(gammah); e = (m * cosah.matrix() + q.cross(m) * sinah.matrix()).array().rowwise() / sin(thetah);
Matrix3Xf& validSinogramPoints = n; // memory reuse Matrix3Xf& validSinogramPoints = e; // memory reuse
validSinogramPoints = (n.array().rowwise() * atan(gammah / 2)).matrix(); validSinogramPoints = (e.array().rowwise() * atan(thetah / 2)).matrix();
validSinogramPoints_matrix = ((validSinogramPoints * realToMatrixScaling).array() + realToMatrixOffset).matrix().cast<uint32_t>(); validSinogramPoints_matrix = ((validSinogramPoints * realToMatrixScaling).array() + realToMatrixOffset).matrix().cast<uint32_t>();
validSinogramPoints_matrix_lin = validSinogramPoints_matrix.row(0) + strides * validSinogramPoints_matrix.bottomRows(2); validSinogramPoints_matrix_lin = validSinogramPoints_matrix.row(0) + strides * validSinogramPoints_matrix.bottomRows(2);
...@@ -134,10 +134,10 @@ namespace pinkIndexer ...@@ -134,10 +134,10 @@ namespace pinkIndexer
} }
} }
void Sinogram::computePartOfSinogramOnePeak(Matrix3Xf* candidateReflectionDirections, Vector3f* l, int threadCount, int threadNumber) void Sinogram::computePartOfSinogramOnePeak(Matrix3Xf* candidateReflectionDirections, Vector3f* q, int threadCount, int threadNumber)
{ {
Matrix3Xf n(3, anglesCount); Matrix3Xf e(3, anglesCount);
Array<float, 1, Eigen::Dynamic> gammah(anglesCount); // gamma half Array<float, 1, Eigen::Dynamic> thetah(anglesCount); //theta half
Matrix<uint32_t, 3, Eigen::Dynamic> validSinogramPoints_matrix(3, anglesCount); Matrix<uint32_t, 3, Eigen::Dynamic> validSinogramPoints_matrix(3, anglesCount);
Matrix<uint32_t, 1, Eigen::Dynamic> validSinogramPoints_matrix_lin(1, anglesCount); Matrix<uint32_t, 1, Eigen::Dynamic> validSinogramPoints_matrix_lin(1, anglesCount);
...@@ -149,20 +149,20 @@ namespace pinkIndexer ...@@ -149,20 +149,20 @@ namespace pinkIndexer
int candidatePeaksCount = candidateReflectionDirections->cols(); int candidatePeaksCount = candidateReflectionDirections->cols();
for (int candidatePeakNumber = threadNumber; candidatePeakNumber < candidatePeaksCount; candidatePeakNumber += threadCount) for (int candidatePeakNumber = threadNumber; candidatePeakNumber < candidatePeaksCount; candidatePeakNumber += threadCount)
{ {
const auto& candidateReflectionDirection = candidateReflectionDirections->col(candidatePeakNumber); const auto& h = candidateReflectionDirections->col(candidatePeakNumber);
Vector3f m = (candidateReflectionDirection + *l).normalized(); Vector3f m = (h + *q).normalized();
temp2 = sinah * (-l->dot(m)); temp2 = sinah * (-q->dot(m));
gammah = acos(temp2); thetah = acos(temp2);
temp1.noalias() = m * cosah.matrix(); temp1.noalias() = m * cosah.matrix();
temp1.noalias() += l->cross(m) * sinah.matrix(); temp1.noalias() += q->cross(m) * sinah.matrix();
n = temp1.array().rowwise() * rsqrt(1 - temp2.square()); e = temp1.array().rowwise() * rsqrt(1 - temp2.square());
// gammah = acos(sinah * (-l->dot(m))); // thetah = acos(sinah * (-q->dot(m)));
// n = (m * cosah.matrix() + l->cross(m) * sinah.matrix()).array().rowwise() / sin(gammah); // e = (m * cosah.matrix() + q->cross(m) * sinah.matrix()).array().rowwise() / sin(thetah);
Matrix3Xf& validSinogramPoints = n; // memory reuse Matrix3Xf& validSinogramPoints = e; // memory reuse
validSinogramPoints = (n.array().rowwise() * atan(gammah / 2)).matrix(); validSinogramPoints = (e.array().rowwise() * atan(thetah / 2)).matrix();
validSinogramPoints_matrix = ((validSinogramPoints * realToMatrixScaling).array() + realToMatrixOffset).matrix().cast<uint32_t>(); validSinogramPoints_matrix = ((validSinogramPoints * realToMatrixScaling).array() + realToMatrixOffset).matrix().cast<uint32_t>();
validSinogramPoints_matrix_lin = validSinogramPoints_matrix.row(0); validSinogramPoints_matrix_lin = validSinogramPoints_matrix.row(0);
...@@ -201,7 +201,7 @@ namespace pinkIndexer ...@@ -201,7 +201,7 @@ namespace pinkIndexer
cout << "computed " << 100 * (float)measuredPeakNumber / measuredPeaksCount << "%" << endl; cout << "computed " << 100 * (float)measuredPeakNumber / measuredPeaksCount << "%" << endl;
} }
Vector3f l = ucsDirections.col(measuredPeakNumber); // rotation axis Vector3f q = ucsDirections.col(measuredPeakNumber); // rotation axis
Matrix3Xf& candidateReflectionDirections = candidateReflectionsDirections[measuredPeakNumber]; Matrix3Xf& candidateReflectionDirections = candidateReflectionsDirections[measuredPeakNumber];
if (candidateReflectionDirections.cols() == 0) if (candidateReflectionDirections.cols() == 0)
...@@ -211,7 +211,7 @@ namespace pinkIndexer ...@@ -211,7 +211,7 @@ namespace pinkIndexer
for (int threadNumber = 0; threadNumber < slaveThreadCount; threadNumber++) for (int threadNumber = 0; threadNumber < slaveThreadCount; threadNumber++)
{ {
threads.push_back(thread(&Sinogram::computePartOfSinogramOnePeak, this, &candidateReflectionDirections, &l, slaveThreadCount, threadNumber)); threads.push_back(thread(&Sinogram::computePartOfSinogramOnePeak, this, &candidateReflectionDirections, &q, slaveThreadCount, threadNumber));
} }
for (int threadNumber = 0; threadNumber < slaveThreadCount; threadNumber++) for (int threadNumber = 0; threadNumber < slaveThreadCount; threadNumber++)
{ {
...@@ -247,7 +247,7 @@ namespace pinkIndexer ...@@ -247,7 +247,7 @@ namespace pinkIndexer
cout << "computed " << 100 * (float)measuredPeakNumber / measuredPeaksCount << "%" << endl; cout << "computed " << 100 * (float)measuredPeakNumber / measuredPeaksCount << "%" << endl;
} }
Vector3f l = ucsDirections.col(measuredPeakNumber); // rotation axis Vector3f q = ucsDirections.col(measuredPeakNumber);
Matrix3Xf& candidateReflectionDirections = candidateReflectionsDirections[measuredPeakNumber]; Matrix3Xf& candidateReflectionDirections = candidateReflectionsDirections[measuredPeakNumber];
if (candidateReflectionDirections.cols() == 0) if (candidateReflectionDirections.cols() == 0)
...@@ -257,7 +257,7 @@ namespace pinkIndexer ...@@ -257,7 +257,7 @@ namespace pinkIndexer
for (int threadNumber = 0; threadNumber < slaveThreadCount; threadNumber++) for (int threadNumber = 0; threadNumber < slaveThreadCount; threadNumber++)
{ {
threads.push_back(thread(&Sinogram::computePartOfSinogramOnePeak, this, &candidateReflectionDirections, &l, slaveThreadCount, threadNumber)); threads.push_back(thread(&Sinogram::computePartOfSinogramOnePeak, this, &candidateReflectionDirections, &q, slaveThreadCount, threadNumber));
} }
if (measuredPeakNumber > 0) if (measuredPeakNumber > 0)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment