elsa generators

PhantomGenerator

template<typename data_t = real_t>
class elsa::PhantomGenerator

This class generates 2d/3d phantoms, like the Shepp-Logan phantom.

Author

Maximilian Hornung - initial code

Author

David Frank - fixes and modifications

Author

Tobias Lasser - rewrite

Template Parameters

Public Static Functions

DataContainer<data_t> createModifiedSheppLogan(IndexVector_t sizes)

Create a modified Shepp-Logan phantom in 2d or 3d (with enhanced contrast).

The phantom specifications are adapted from Matlab (which in turn references A.K. Jain, “Fundamentals of Digital Image Processing”, p. 439, and P.A. Toft, “The Radon Transform,

Theory and Implementation”, p. 199).

Return

DataContainer of specified size containing the phantom.

Parameters
  • [in] sizes: a 2d/3d vector indicating the requested size (has to be square!)

Warning: the 3D version is currently very inefficient to compute (cubic algorithm).

Private Static Functions

index_t scale(const DataDescriptor &dd, data_t value)

scale sizes from [0,1] to the (square) phantom size, producing indices (integers)

index_t scaleShift(const DataDescriptor &dd, data_t value)

scale and shift center coordinates to the (square) phantom size, producing indices (integers)

CircleTrajectoryGenerator

class elsa::CircleTrajectoryGenerator

Generator for traditional circular trajectories as used in X-ray Computed Tomography (for 2d/3d).

Author

Maximilan Hornung - initial code

Author

Tobias Lasser - modernization, fixes

Public Static Functions

std::unique_ptr<DetectorDescriptor> createTrajectory(index_t numberOfPoses, const DataDescriptor &volumeDescriptor, index_t arcDegrees, real_t sourceToCenter, real_t centerToDetector)

Generate a list of geometries corresponding to a circular trajectory around a volume.

Please note: the first pose will be at 0 degrees, the last pose will be at arcDegrees For example: 3 poses over a 180 arc will yield: 0, 90, 180 degrees.

Return

a pair containing the list of geometries with a circular trajectory, and the sinogram data descriptor

Parameters
  • numberOfPoses: the number of (equally spaced) acquisition poses to be generated

  • volumeDescriptor: the volume around which the trajectory should go

  • arcDegrees: the size of the arc of the circle covered by the trajectory (in degrees, 360 for full circle)

  • sourceToCenter: the distance of the X-ray source to the center of the volume

  • centerToDetector: the distance of the center of the volume to the X-ray detector

Please note: the sinogram size/spacing will match the volume size/spacing.

TODO: Make it possible to return either PlanarDetectorDescriptor, or CurvedDetectorDescriptor

Implementation Details

EllipseGenerator

template<typename data_t = real_t>
class elsa::EllipseGenerator

This class draws 2d and 3d rotated ellipses into DataContainers.

Drawing is done by adding a given constant to the appropriate places in the 2d/3d image.

Author

Tobias Lasser - initial code

Template Parameters

Public Types

using Vec2 = Eigen::Matrix<index_t, 2, 1>

short-hand for 2d vector

using Vec3 = Eigen::Matrix<index_t, 3, 1>

short-hand for 3d vector

Public Static Functions

void drawFilledEllipse2d(DataContainer<data_t> &dc, data_t amplitude, Vec2 const &center, Vec2 sizes, data_t angle)

Draw a rotated, filled 2d ellipse.

Parameters
  • [inout] dc: the DataContainer where the ellipse should be drawn in

  • [in] amplitude: the “color” of the ellipse and its filling

  • [in] center: the 2d index of where to place the center of the ellipse in dc

  • [in] sizes: the radii (horizontal/vertical) of the ellipse

  • [in] angle: rotation angle of the ellipse in degrees (with respect to y axis)

void drawFilledEllipsoid3d(DataContainer<data_t> &dc, data_t amplitude, Vec3 center, Vec3 sizes, data_t phi, data_t theta, data_t psi)

Draw a rotated, filled 3d ellipsoid.

Warning: this method is currently using an inefficient, cubic algorithm. Thus it’s very slow for big volumes!

Parameters
  • [inout] dc: the DataContainer where the ellipsoid should be drawn in

  • [in] amplitude: the “color” of the ellipsoid and its filling

  • [in] center: the 3d index of where to place the center of the ellipsoid in dc

  • [in] sizes: the radii (in x/y/z) of the ellipsoid

  • [in] phi: euler angle of rotation of the ellipsoid

  • [in] theta: euler angle of rotation of the ellipsoid

  • [in] psi: euler angle of rotation of the ellipsoid

Private Static Functions

void drawShearedFilledEllipse2d(DataContainer<data_t> &dc, data_t amplitude, Vec2 const &center, Vec2 sizes, Vec2 const &shear)

Draw a sheared filled 2d ellipse using a Bresenham-type algorithm.

This method uses an adapted algorithm from John Kennedy, “A Fast Bresenham Type Algorithm

For Drawing Ellipses”.

Parameters
  • [inout] dc: the DataContainer where the ellipse should be drawn in

  • [in] amplitude: the “color” of the ellipse and its filling

  • [in] center: the 2d index of where to place the center of the ellipse in dc

  • [in] sizes: the radii (horizontal/vertical) of the ellipse

  • [in] shear: the amount of shearing to apply in x/y direction

void drawShearedLinePairs2d(DataContainer<data_t> &dc, data_t amplitude, Vec2 center, index_t xOffset, index_t yOffset, Vec2 shear)

draw sheared 2d line pairs for ellipses

Using ellipse symmetry, this draws four points with the coordinates center[0] +- xOffset / center[1] +- yOffset, as well as the connecting lines between them (proceeding along the x axis).

Parameters
  • [inout] dc: the DataContainer where the lines should be drawn in

  • [in] amplitude: the “color” of the line

  • [in] center: the 2d index of where to center the line in dc

  • [in] xOffset: the x offset from the center

  • [in] yOffset: the y offset from the center

  • [in] shear: the amonut of shearing to apply in x/y direction