STIR  6.2.0
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members

Three-dimensional ellipsoidal cylinder. More...

#include "stir/Shape/EllipsoidalCylinder.h"

Inheritance diagram for stir::EllipsoidalCylinder:
Inheritance graph
[legend]

Public Member Functions

 EllipsoidalCylinder ()
 Default constructor (calls set_defaults())
 
 EllipsoidalCylinder (const float length_z, const float radius_y, const float radius_x, const CartesianCoordinate3D< float > &centre, const Array< 2, float > &direction_vectors=diagonal_matrix(3, 1.F))
 Constructor. More...
 
 EllipsoidalCylinder (const float length_z, const float radius_y, const float radius_x, const float theta_1, const float theta_2, const CartesianCoordinate3D< float > &centre, const Array< 2, float > &direction_vectors=diagonal_matrix(3, 1.F))
 Constructor. More...
 
Shape3Dclone () const override
 Allocate a new Shape3D object which is a copy of the current one.
 
bool operator== (const EllipsoidalCylinder &cylinder) const
 Compare cylinders. More...
 
bool operator== (const Shape3D &shape) const override
 Compare shapes. More...
 
float get_geometric_volume () const override
 get volume
 
bool is_inside_shape (const CartesianCoordinate3D< float > &coord) const override
 determine if a point is inside the shape or not (up to floating point errors) More...
 
float get_length () const
 
float get_radius_x () const
 
float get_radius_y () const
 
void set_length (const float)
 
void set_radius_x (const float)
 
void set_radius_y (const float)
 
- Public Member Functions inherited from stir::RegisteredParsingObject< EllipsoidalCylinder, Shape3D, Shape3DWithOrientation >
std::string get_registered_name () const override
 Returns Derived::registered_name.
 
std::string parameter_info () override
 Returns a string with all parameters and their values, in a form suitable for parsing again.
 
- Public Member Functions inherited from stir::Shape3DWithOrientation
bool operator== (const Shape3DWithOrientation &s) const
 
void scale (const CartesianCoordinate3D< float > &scale3D) override
 scale the whole shape More...
 
const Array< 2, float > & get_direction_vectors () const
 get direction vectors currently in use More...
 
Succeeded set_direction_vectors (const Array< 2, float > &)
 set direction vectors More...
 
- Public Member Functions inherited from stir::Shape3D
bool operator!= (const Shape3D &) const
 Compare shapes.
 
virtual float get_voxel_weight (const CartesianCoordinate3D< float > &voxel_centre, const CartesianCoordinate3D< float > &voxel_size, const CartesianCoordinate3D< int > &num_samples) const
 Determine (approximately) the intersection volume of a voxel with the shape. More...
 
virtual void translate (const CartesianCoordinate3D< float > &direction)
 translate the whole shape by shifting its origin More...
 
void scale_around_origin (const CartesianCoordinate3D< float > &scale3D)
 scale the whole shape, keeping the centre at the same place
 
virtual void construct_volume (VoxelsOnCartesianGrid< float > &image, const CartesianCoordinate3D< int > &num_samples) const
 construct an image representation the shape in a discretised manner More...
 
CartesianCoordinate3D< float > get_origin () const
 get the origin of the shape-coordinate system
 
virtual void set_origin (const CartesianCoordinate3D< float > &)
 set the origin of the shape-coordinate system
 
- Public Member Functions inherited from stir::ParsingObject
 ParsingObject (const ParsingObject &)
 
ParsingObjectoperator= (const ParsingObject &)
 
void ask_parameters ()
 
bool parse (std::istream &f)
 
bool parse (const char *const filename)
 

Static Public Attributes

static const char *const registered_name = "Ellipsoidal Cylinder"
 Name which will be used when parsing a Shape3D object.
 

Protected Member Functions

void set_defaults () override
 set defaults before parsing More...
 
void initialise_keymap () override
 Initialise all keywords.
 
bool post_processing () override
 This will be called at the end of the parsing. More...
 
- Protected Member Functions inherited from stir::Shape3DWithOrientation
 Shape3DWithOrientation ()
 default constructor (NO initialisation of values)
 
 Shape3DWithOrientation (const CartesianCoordinate3D< float > &origin, const Array< 2, float > &directions=diagonal_matrix(3, 1.F))
 
float get_volume_of_unit_cell () const
 gets the volume of the cell spanned by the direction vectors More...
 
CartesianCoordinate3D< float > transform_to_shape_coords (const CartesianCoordinate3D< float > &) const
 Transform a 'real-world' coordinate to the coordinate system used by the shape.
 
void set_defaults () override
 sets defaults for parsing More...
 
void initialise_keymap () override
 Initialise all keywords.
 
bool post_processing () override
 This will be called at the end of the parsing. More...
 
void set_key_values () override
 This will be called before parsing or parameter_info is called. More...
 
- Protected Member Functions inherited from stir::Shape3D
 Shape3D (const CartesianCoordinate3D< float > &origin)
 

Protected Attributes

float length
 Length of the cylinder.
 
float radius_x
 Radius in x-direction if the shape is not rotated.
 
float radius_y
 Radius in y-direction if the shape is not rotated.
 
float theta_1
 initial theta if the shape is not rotated (in degrees)
 
float theta_2
 final theta if the shape is not rotated (in degrees)
 
- Protected Attributes inherited from stir::ParsingObject
KeyParser parser
 

Additional Inherited Members

- Static Public Member Functions inherited from stir::RegisteredParsingObject< EllipsoidalCylinder, Shape3D, Shape3DWithOrientation >
static Shape3Dread_from_stream (std::istream *)
 Construct a new object (of type Derived) by parsing the istream. More...
 
- Static Public Member Functions inherited from stir::RegisteredObject< Shape3D >
static Shape3Dread_registered_object (std::istream *in, const std::string &registered_name)
 Construct a new object (of a type derived from Root, its actual type determined by the registered_name parameter) by parsing the istream. More...
 
static Shape3Dask_type_and_parameters ()
 ask the user for the type, and then calls read_registered_object(0, type) More...
 
static void list_registered_names (std::ostream &stream)
 List all possible registered names to the stream. More...
 
- Protected Types inherited from stir::RegisteredObject< Shape3D >
typedef Shape3D *(* RootFactory) (std::istream *)
 The type of a root factory is a function, taking an istream* as argument, and returning a Root*.
 
typedef FactoryRegistry< std::string, RootFactory, interfile_lessRegistryType
 The type of the registry.
 
- Static Protected Member Functions inherited from stir::RegisteredObject< Shape3D >
static RegistryTyperegistry ()
 Static function returning the registry. More...
 

Detailed Description

Three-dimensional ellipsoidal cylinder.

Description
A point with coordinates coord is inside the shape if for $r = coord - origin$:

\[ |r.dir_z|<L/2 \]

and

\[ {(r.dir_x)^2 \over R_x^2} + {(r.dir_y)^2 \over R_y^2} <= 1 \]

and

\[ \theta_1 <= atan2(r.dir_y,r.dir_x) <= \theta_2 \]

where $dir_x, dir_y, dir_z$ are described in the documentation for class Shape3DWithOrientation.

Parameters
To specify an ellipsoidal cylinder with the dimensions (radius_x,radius_y,length, theta_1, theta_2), where radius_x is in x direction, radius_y in y direction, length in z-direction, theta_1 and theta_2 are defined counter clockwise from the positive x-axis about the z-axis (before any rotations), use:
   Ellipsoidal Cylinder Parameters:=
   radius-x (in mm):= <float>
   radius-y (in mm):= <float>
   length-z (in mm):= <float>
   initial angle (in deg):= <float> ; (defaults to 0)
   final_angle (in deg):= <float>   ; (defaults to 360)
   ; any parameters of Shape3DWithOrientation
   End:=

Constructor & Destructor Documentation

◆ EllipsoidalCylinder() [1/2]

stir::EllipsoidalCylinder::EllipsoidalCylinder ( const float  length_z,
const float  radius_y,
const float  radius_x,
const CartesianCoordinate3D< float > &  centre,
const Array< 2, float > &  direction_vectors = diagonal_matrix(3, 1.F) 
)

Constructor.

Warning
: note order of arguments

◆ EllipsoidalCylinder() [2/2]

stir::EllipsoidalCylinder::EllipsoidalCylinder ( const float  length_z,
const float  radius_y,
const float  radius_x,
const float  theta_1,
const float  theta_2,
const CartesianCoordinate3D< float > &  centre,
const Array< 2, float > &  direction_vectors = diagonal_matrix(3, 1.F) 
)

Constructor.

Warning
: note order of arguments.
Bug:
angles theta_1 and theta_2 are currently in degrees, while STIR conventions dictate radians.

References stir::error(), length, radius_x, radius_y, stir::Shape3DWithOrientation::set_direction_vectors(), and stir::Shape3D::set_origin().

Member Function Documentation

◆ operator==() [1/2]

bool stir::EllipsoidalCylinder::operator== ( const EllipsoidalCylinder cylinder) const

Compare cylinders.

Uses a tolerance determined by the smallest dimension of the object divided by 1000.

References length, radius_x, radius_y, theta_1, and theta_2.

◆ operator==() [2/2]

bool stir::EllipsoidalCylinder::operator== ( const Shape3D s) const
overridevirtual

Compare shapes.

Implementation note

This virtual function has to be implemented in each final class of the hierarchy. However, Shape3D::operator== has an implementation that checks equality of the origin (up-to a tolerance of .001). Derived classes can call this implementation.

Implements stir::Shape3D.

◆ is_inside_shape()

bool stir::EllipsoidalCylinder::is_inside_shape ( const CartesianCoordinate3D< float > &  coord) const
overridevirtual

determine if a point is inside the shape or not (up to floating point errors)

Parameters
coordis a cartesian coordinate in 'absolute' coordinates, i.e. in mm and not relative to the origin member.

This is really only well defined for shapes with sharp boundaries.

See also
DiscretisedShape3D::is_inside_shape for some discussion.
Todo:
replace by floating point return value?

Implements stir::Shape3D.

References _PI, clone(), EllipsoidalCylinder(), get_geometric_volume(), stir::Shape3DWithOrientation::get_volume_of_unit_cell(), length, radius_x, radius_y, stir::square(), theta_1, theta_2, and stir::Shape3DWithOrientation::transform_to_shape_coords().

◆ set_defaults()

void stir::EllipsoidalCylinder::set_defaults ( )
overrideprotectedvirtual

set defaults before parsing

sets radii and length to 0, theta_1=0, theta_2=360 and calls Shape3DWithOrientation::set_defaults()

Reimplemented from stir::ParsingObject.

◆ post_processing()

bool stir::EllipsoidalCylinder::post_processing ( )
overrideprotectedvirtual

This will be called at the end of the parsing.

Returns
false if everything OK, true if not

Reimplemented from stir::ParsingObject.

References stir::warning().


The documentation for this class was generated from the following files: