Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 ( If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 5daf0062 authored by Theodor local's avatar Theodor local
Browse files

Added custom geometry generator

parent e2378a19
Pipeline #441407 failed with stages
in 58 seconds
......@@ -139,4 +139,62 @@ namespace elsa
return std::make_unique<PlanarDetectorDescriptor>(coeffs, spacing, geometryList);
std::unique_ptr<DetectorDescriptor> CircleTrajectoryGenerator::createTrajectoryCustom(
index_t detectorSize, const DataDescriptor& volumeDescriptor,
real_t sourceToCenter, real_t centerToDetector, std::vector<float> angles)
// pull in geometry namespace, to reduce cluttering
using namespace geometry;
// sanity check
const auto dim = volumeDescriptor.getNumberOfDimensions();
if (dim < 2 || dim > 3)
throw std::invalid_argument("CircleTrajectoryGenerator: can only handle 2d/3d");
size_t numberOfPoses = angles.size();
->info("creating custom {}D trajectory with {} poses", dim, numberOfPoses);
IndexVector_t coeffs(dim);
RealVector_t spacing(dim);
if (dim == 2) {
// int next_power_of_two = std::pow(2, int(std::log2(volumeDescriptor.getNumberOfCoefficientsPerDimension()[0]))+1);
coeffs << detectorSize, numberOfPoses;
spacing << volumeDescriptor.getSpacingPerDimension()[0], 1;
} else {
coeffs << detectorSize, detectorSize, numberOfPoses;
spacing << volumeDescriptor.getSpacingPerDimension()[0],
volumeDescriptor.getSpacingPerDimension()[1], 1;
// Create vector and reserve the necessary size, minor optimization such that no new
// allocations are necessary in the loop
std::vector<Geometry> geometryList;
for (index_t i = 0; i < numberOfPoses; ++i) {
if (dim == 2) {
// Use emplace_back, then no copy is created
SinogramData2D{Size2D{coeffs}, Spacing2D{spacing}});
} else {
SinogramData3D{Size3D{coeffs}, Spacing3D{spacing}},
RotationAngles3D{Radian{Degree{}}, Radian{0}, Radian{0}});
return std::make_unique<PlanarDetectorDescriptor>(coeffs, spacing, geometryList);
} // namespace elsa
......@@ -48,6 +48,10 @@ namespace elsa
static std::unique_ptr<DetectorDescriptor>
createTrajectoryFromSize(index_t numberOfPoses, index_t detectorSize, const DataDescriptor& volumeDescriptor, index_t arcDegrees,
real_t sourceToCenter, real_t centerToDetector);
static std::unique_ptr<DetectorDescriptor>
createTrajectoryCustom(index_t detectorSize, const DataDescriptor& volumeDescriptor,
real_t sourceToCenter, real_t centerToDetector, std::vector<float> angles);
} // namespace elsa
Markdown is supported
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