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

Commit 31fc08ee authored by Bianca-Maria Borza's avatar Bianca-Maria Borza

my modifications added

parent 19d733a0
Pipeline #289821 failed with stages
in 47 seconds
......@@ -59,8 +59,9 @@ namespace elsa
// enables small optimizations
bool hasRotation = (std::abs(phi) + std::abs(theta) + std::abs(psi)) > 0;
// convert to radians
if(hasRotation || !hasRotation)
EllipsoidGenerator<data_t>::drawFilledEllipsoid(dc,amplitude,center,sizes);
else{// convert to radians
auto phiRad = phi * pi<double> / 180.0;
auto thetaRad = theta * pi<double> / 180.0;
auto psiRad = psi * pi<double> / 180.0;
......@@ -145,6 +146,7 @@ namespace elsa
}
}
}
}
}
template <typename data_t>
......
......@@ -2,6 +2,7 @@
#include "elsaDefines.h"
#include "DataContainer.h"
#include "EllipsoidGenerator.h"
namespace elsa
{
......
This diff is collapsed.
#pragma once
#include "elsaDefines.h"
#include "DataContainer.h"
namespace elsa
{
/**
* \brief This class draws 3d spheres into DataContainers
*
* \tparam data_t data type for the DataContainer, defaulting to real_t
*
* Drawing is done by adding a given constant to the appropriate places in the 3d image.
*/
template <typename data_t = real_t>
class EllipsoidGenerator
{
public:
/// short-hand for 3d vector
using Vec3 = Eigen::Matrix<index_t, 3, 1>;
/**
* \brief Draw a filled 3d sphere
*
* \param[in,out] dc the DataContainer where the ellipsoid should be drawn in
* \param[in] amplitude the "color" of the sphere and its filling
* \param[in] center the 3d index of where to place the center of the sphere in dc
* \param[in] sizes of the radius (in x/y/z) of the sphere
*
*/
static void drawFilledEllipsoid(DataContainer<data_t>& dc, data_t amplitude, Vec3 center, Vec3 sizes);
static void drawFilledEllipse(DataContainer<data_t>& dc, data_t amplitude, Vec3 center, data_t radiusX, data_t radiusY, index_t z);
private:
static void drawLine(DataContainer<data_t>&dc, data_t amplitude, Vec3 center, index_t x, index_t y, index_t z);
};
}
\ No newline at end of file
......@@ -9,13 +9,13 @@ using namespace elsa;
void example2d()
{
// generate 2d phantom
IndexVector_t size(2);
size << 128, 128;
IndexVector_t size(3);
size << 128, 128, 128;
auto phantom = PhantomGenerator<real_t>::createModifiedSheppLogan(size);
auto& volumeDescriptor = phantom.getDataDescriptor();
// write the phantom out
EDF::write(phantom, "2dphantom.edf");
MHD::write(phantom, "23dphantom.mhd", "23dphantom.raw");
// generate circular trajectory
index_t numAngles{180}, arc{360};
......@@ -34,7 +34,7 @@ void example2d()
auto sinogram = projector.apply(phantom);
// write the sinogram out
EDF::write(sinogram, "2dsinogram.edf");
MHD::write(sinogram, "23dsinogram.mhd", "23dsinogram.raw");
// setup reconstruction problem
WLSProblem problem(projector, sinogram);
......@@ -48,7 +48,7 @@ void example2d()
auto reconstruction = solver.solve(noIterations);
// write the reconstruction out
EDF::write(reconstruction, "2dreconstruction.edf");
MHD::write(reconstruction, "23dreconstruction.mhd", "23dreconstruction.raw");
}
int main()
......
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