Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas White
pinkindexer
Commits
17f4230b
Commit
17f4230b
authored
Dec 21, 2018
by
Yaroslav Gevorkov
Browse files
better handling of too high-q peaks
parent
83fd095f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/ReflectionsInRangeFinder.cpp
View file @
17f4230b
...
...
@@ -8,9 +8,9 @@ using namespace Eigen;
ReflectionsInRangeFinder
::
ReflectionsInRangeFinder
(
const
Lattice
&
lattice
)
{
Matrix3f
basis
=
lattice
.
getBasis
();
const
Matrix3f
basis
=
lattice
.
getBasis
();
int
maxMillerIndex
=
1
00
;
int
maxMillerIndex
=
1
75
;
maxRadius
=
maxMillerIndex
*
lattice
.
getBasisVectorNorms
().
minCoeff
();
int
millerIndicesPerDirection
=
2
*
maxMillerIndex
+
1
;
Matrix3Xf
reflections
(
3
,
(
int
)
pow
(
millerIndicesPerDirection
,
3
));
...
...
@@ -33,13 +33,13 @@ ReflectionsInRangeFinder::ReflectionsInRangeFinder(const Lattice& lattice)
iota
(
sortIndices
.
begin
(),
sortIndices
.
end
(),
0
);
sort
(
sortIndices
.
begin
(),
sortIndices
.
end
(),
[
&
norms
](
uint32_t
i
,
uint32_t
j
)
{
return
norms
[
i
]
<
norms
[
j
];
});
reflectionsDirections_sorted
.
resize
(
3
,
reflections
.
cols
()
-
1
);
//leave out reflection (0,0,0)
reflectionsDirections_sorted
.
resize
(
3
,
reflections
.
cols
()
-
1
);
//
leave out reflection (0,0,0)
norms_sorted
.
resize
(
reflections
.
cols
());
for
(
int
i
=
1
;
i
<
reflections
.
cols
();
++
i
)
{
uint32_t
sortIndex
=
sortIndices
[
i
];
norms_sorted
[
i
]
=
norms
(
sortIndex
);
reflectionsDirections_sorted
.
col
(
i
-
1
)
=
reflections
.
col
(
sortIndex
)
/
norms_sorted
[
i
];
reflectionsDirections_sorted
.
col
(
i
-
1
)
=
reflections
.
col
(
sortIndex
)
/
norms_sorted
[
i
];
}
}
...
...
@@ -48,17 +48,25 @@ void ReflectionsInRangeFinder::getReflectionsInRanges(EigenSTL::vector_Matrix3Xf
{
if
(
ranges
.
row
(
1
).
maxCoeff
()
>
maxRadius
)
{
throw
BadInputException
(
"getReflectionsInRanges is called with too large ranges! Limit the maximum resolution of the Bragg peaks!"
);
cerr
<<
"the maximum resolution of Bragg spots exceeds the hardcoded limit of "
<<
maxRadius
<<
"A^-1. These Bragg spots will not be used for indexing, but they will be used for refinement!"
<<
endl
;
}
candidateReflectionsDirections
.
resize
(
ranges
.
cols
());
for
(
int
i
=
0
;
i
<
ranges
.
cols
();
i
++
)
{
vector
<
float
>::
iterator
low
,
up
;
low
=
lower_bound
(
norms_sorted
.
begin
(),
norms_sorted
.
end
(),
ranges
(
0
,
i
));
up
=
upper_bound
(
norms_sorted
.
begin
(),
norms_sorted
.
end
(),
ranges
(
1
,
i
));
if
(
ranges
(
1
,
i
)
>
maxRadius
)
{
candidateReflectionsDirections
[
i
]
=
Matrix3Xf
(
3
,
0
);
}
else
{
vector
<
float
>::
iterator
low
,
up
;
low
=
lower_bound
(
norms_sorted
.
begin
(),
norms_sorted
.
end
(),
ranges
(
0
,
i
));
up
=
upper_bound
(
norms_sorted
.
begin
(),
norms_sorted
.
end
(),
ranges
(
1
,
i
));
candidateReflectionsDirections
[
i
]
=
reflectionsDirections_sorted
.
block
(
0
,
low
-
norms_sorted
.
begin
(),
3
,
up
-
low
);
candidateReflectionsDirections
[
i
]
=
reflectionsDirections_sorted
.
block
(
0
,
low
-
norms_sorted
.
begin
(),
3
,
up
-
low
);
}
}
}
\ No newline at end of file
src/Sinogram.cpp
View file @
17f4230b
...
...
@@ -86,7 +86,7 @@ void Sinogram::computeSinogram(const Eigen::Matrix3Xf& ucsDirections, const Eige
Matrix
<
uint32_t
,
28
,
1
>
validSinogramPoints_matrix_lin_dilated
;
int
measuredPeaksCount
=
ucsDirections
.
cols
();
cout
<<
"peak count used for indexing: "
<<
measuredPeaksCount
<<
endl
;
cout
<<
"peak count used for indexing: "
<<
measuredPeaksCount
<<
endl
;
for
(
int
measuredPeakNumber
=
0
;
measuredPeakNumber
<
measuredPeaksCount
;
measuredPeakNumber
++
)
{
if
(
measuredPeakNumber
%
16
==
0
)
...
...
@@ -97,6 +97,8 @@ void Sinogram::computeSinogram(const Eigen::Matrix3Xf& ucsDirections, const Eige
Vector3f
l
=
ucsDirections
.
col
(
measuredPeakNumber
);
// rotation axis
Matrix3Xf
&
candidateReflectionDirections
=
candidateReflectionsDirections
[
measuredPeakNumber
];
if
(
candidateReflectionDirections
.
cols
()
==
0
)
continue
;
fill
(
sinogram_oneMeasuredPeak
.
begin
(),
sinogram_oneMeasuredPeak
.
end
(),
0
);
int
candidatePeaksCount
=
candidateReflectionDirections
.
cols
();
...
...
@@ -193,17 +195,19 @@ void Sinogram::computeSinogramParallel(const Eigen::Matrix3Xf& ucsDirections, co
sinogram_oneMeasuredPeak_matrixMapped
(
sinogram_oneMeasuredPeak
.
data
(),
sinogram_oneMeasuredPeak
.
size
());
int
measuredPeaksCount
=
ucsDirections
.
cols
();
cout
<<
"peak count used for indexing: "
<<
measuredPeaksCount
<<
endl
;
cout
<<
"peak count used for indexing: "
<<
measuredPeaksCount
<<
endl
;
for
(
int
measuredPeakNumber
=
0
;
measuredPeakNumber
<
measuredPeaksCount
;
measuredPeakNumber
++
)
{
if
(
measuredPeakNumber
%
16
==
0
)
{
cout
<<
"computed "
<<
100
*
(
float
)
measuredPeakNumber
/
measuredPeaksCount
<<
"%"
<<
endl
;
}
if
(
measuredPeakNumber
%
16
==
0
)
{
cout
<<
"computed "
<<
100
*
(
float
)
measuredPeakNumber
/
measuredPeaksCount
<<
"%"
<<
endl
;
}
Vector3f
l
=
ucsDirections
.
col
(
measuredPeakNumber
);
// rotation axis
Matrix3Xf
&
candidateReflectionDirections
=
candidateReflectionsDirections
[
measuredPeakNumber
];
if
(
candidateReflectionDirections
.
cols
()
==
0
)
continue
;
fill
(
sinogram_oneMeasuredPeak
.
begin
(),
sinogram_oneMeasuredPeak
.
end
(),
0
);
...
...
@@ -241,15 +245,17 @@ void Sinogram::computeSinogramParallel2(const Eigen::Matrix3Xf& ucsDirections, c
cout
<<
"peak count used for indexing: "
<<
measuredPeaksCount
<<
endl
;
for
(
int
measuredPeakNumber
=
0
;
measuredPeakNumber
<
measuredPeaksCount
;
measuredPeakNumber
++
)
{
if
(
measuredPeakNumber
%
16
==
0
)
{
cout
<<
"computed "
<<
100
*
(
float
)
measuredPeakNumber
/
measuredPeaksCount
<<
"%"
<<
endl
;
}
if
(
measuredPeakNumber
%
16
==
0
)
{
cout
<<
"computed "
<<
100
*
(
float
)
measuredPeakNumber
/
measuredPeaksCount
<<
"%"
<<
endl
;
}
Vector3f
l
=
ucsDirections
.
col
(
measuredPeakNumber
);
// rotation axis
Matrix3Xf
&
candidateReflectionDirections
=
candidateReflectionsDirections
[
measuredPeakNumber
];
if
(
candidateReflectionDirections
.
cols
()
==
0
)
continue
;
fill
(
sinogram_oneMeasuredPeak
.
begin
(),
sinogram_oneMeasuredPeak
.
end
(),
0
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment