Skip to content
GitLab
Menu
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
Show whitespace changes
Inline
Side-by-side
src/ReflectionsInRangeFinder.cpp
View file @
17f4230b
...
@@ -8,9 +8,9 @@ using namespace Eigen;
...
@@ -8,9 +8,9 @@ using namespace Eigen;
ReflectionsInRangeFinder
::
ReflectionsInRangeFinder
(
const
Lattice
&
lattice
)
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
();
maxRadius
=
maxMillerIndex
*
lattice
.
getBasisVectorNorms
().
minCoeff
();
int
millerIndicesPerDirection
=
2
*
maxMillerIndex
+
1
;
int
millerIndicesPerDirection
=
2
*
maxMillerIndex
+
1
;
Matrix3Xf
reflections
(
3
,
(
int
)
pow
(
millerIndicesPerDirection
,
3
));
Matrix3Xf
reflections
(
3
,
(
int
)
pow
(
millerIndicesPerDirection
,
3
));
...
@@ -33,13 +33,13 @@ ReflectionsInRangeFinder::ReflectionsInRangeFinder(const Lattice& lattice)
...
@@ -33,13 +33,13 @@ ReflectionsInRangeFinder::ReflectionsInRangeFinder(const Lattice& lattice)
iota
(
sortIndices
.
begin
(),
sortIndices
.
end
(),
0
);
iota
(
sortIndices
.
begin
(),
sortIndices
.
end
(),
0
);
sort
(
sortIndices
.
begin
(),
sortIndices
.
end
(),
[
&
norms
](
uint32_t
i
,
uint32_t
j
)
{
return
norms
[
i
]
<
norms
[
j
];
});
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
());
norms_sorted
.
resize
(
reflections
.
cols
());
for
(
int
i
=
1
;
i
<
reflections
.
cols
();
++
i
)
for
(
int
i
=
1
;
i
<
reflections
.
cols
();
++
i
)
{
{
uint32_t
sortIndex
=
sortIndices
[
i
];
uint32_t
sortIndex
=
sortIndices
[
i
];
norms_sorted
[
i
]
=
norms
(
sortIndex
);
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,12 +48,19 @@ void ReflectionsInRangeFinder::getReflectionsInRanges(EigenSTL::vector_Matrix3Xf
...
@@ -48,12 +48,19 @@ void ReflectionsInRangeFinder::getReflectionsInRanges(EigenSTL::vector_Matrix3Xf
{
{
if
(
ranges
.
row
(
1
).
maxCoeff
()
>
maxRadius
)
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
());
candidateReflectionsDirections
.
resize
(
ranges
.
cols
());
for
(
int
i
=
0
;
i
<
ranges
.
cols
();
i
++
)
for
(
int
i
=
0
;
i
<
ranges
.
cols
();
i
++
)
{
if
(
ranges
(
1
,
i
)
>
maxRadius
)
{
candidateReflectionsDirections
[
i
]
=
Matrix3Xf
(
3
,
0
);
}
else
{
{
vector
<
float
>::
iterator
low
,
up
;
vector
<
float
>::
iterator
low
,
up
;
low
=
lower_bound
(
norms_sorted
.
begin
(),
norms_sorted
.
end
(),
ranges
(
0
,
i
));
low
=
lower_bound
(
norms_sorted
.
begin
(),
norms_sorted
.
end
(),
ranges
(
0
,
i
));
...
@@ -61,4 +68,5 @@ void ReflectionsInRangeFinder::getReflectionsInRanges(EigenSTL::vector_Matrix3Xf
...
@@ -61,4 +68,5 @@ void ReflectionsInRangeFinder::getReflectionsInRanges(EigenSTL::vector_Matrix3Xf
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
...
@@ -97,6 +97,8 @@ void Sinogram::computeSinogram(const Eigen::Matrix3Xf& ucsDirections, const Eige
...
@@ -97,6 +97,8 @@ void Sinogram::computeSinogram(const Eigen::Matrix3Xf& ucsDirections, const Eige
Vector3f
l
=
ucsDirections
.
col
(
measuredPeakNumber
);
// rotation axis
Vector3f
l
=
ucsDirections
.
col
(
measuredPeakNumber
);
// rotation axis
Matrix3Xf
&
candidateReflectionDirections
=
candidateReflectionsDirections
[
measuredPeakNumber
];
Matrix3Xf
&
candidateReflectionDirections
=
candidateReflectionsDirections
[
measuredPeakNumber
];
if
(
candidateReflectionDirections
.
cols
()
==
0
)
continue
;
fill
(
sinogram_oneMeasuredPeak
.
begin
(),
sinogram_oneMeasuredPeak
.
end
(),
0
);
fill
(
sinogram_oneMeasuredPeak
.
begin
(),
sinogram_oneMeasuredPeak
.
end
(),
0
);
int
candidatePeaksCount
=
candidateReflectionDirections
.
cols
();
int
candidatePeaksCount
=
candidateReflectionDirections
.
cols
();
...
@@ -204,6 +206,8 @@ void Sinogram::computeSinogramParallel(const Eigen::Matrix3Xf& ucsDirections, co
...
@@ -204,6 +206,8 @@ void Sinogram::computeSinogramParallel(const Eigen::Matrix3Xf& ucsDirections, co
Vector3f
l
=
ucsDirections
.
col
(
measuredPeakNumber
);
// rotation axis
Vector3f
l
=
ucsDirections
.
col
(
measuredPeakNumber
);
// rotation axis
Matrix3Xf
&
candidateReflectionDirections
=
candidateReflectionsDirections
[
measuredPeakNumber
];
Matrix3Xf
&
candidateReflectionDirections
=
candidateReflectionsDirections
[
measuredPeakNumber
];
if
(
candidateReflectionDirections
.
cols
()
==
0
)
continue
;
fill
(
sinogram_oneMeasuredPeak
.
begin
(),
sinogram_oneMeasuredPeak
.
end
(),
0
);
fill
(
sinogram_oneMeasuredPeak
.
begin
(),
sinogram_oneMeasuredPeak
.
end
(),
0
);
...
@@ -250,6 +254,8 @@ void Sinogram::computeSinogramParallel2(const Eigen::Matrix3Xf& ucsDirections, c
...
@@ -250,6 +254,8 @@ void Sinogram::computeSinogramParallel2(const Eigen::Matrix3Xf& ucsDirections, c
Vector3f
l
=
ucsDirections
.
col
(
measuredPeakNumber
);
// rotation axis
Vector3f
l
=
ucsDirections
.
col
(
measuredPeakNumber
);
// rotation axis
Matrix3Xf
&
candidateReflectionDirections
=
candidateReflectionsDirections
[
measuredPeakNumber
];
Matrix3Xf
&
candidateReflectionDirections
=
candidateReflectionsDirections
[
measuredPeakNumber
];
if
(
candidateReflectionDirections
.
cols
()
==
0
)
continue
;
fill
(
sinogram_oneMeasuredPeak
.
begin
(),
sinogram_oneMeasuredPeak
.
end
(),
0
);
fill
(
sinogram_oneMeasuredPeak
.
begin
(),
sinogram_oneMeasuredPeak
.
end
(),
0
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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