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

Three-dimensional ellipsoid. More...

#include "stir/Shape/Ellipsoid.h"

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

Public Member Functions

 Ellipsoid (const CartesianCoordinate3D< float > &radii, const CartesianCoordinate3D< float > &centre, const Array< 2, float > &direction_vectors=diagonal_matrix(3, 1.F))
 
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...
 
Shape3Dclone () const override
 Allocate a new Shape3D object which is a copy of the current one.
 
bool operator== (const Ellipsoid &) const
 Compare cylinders. More...
 
bool operator== (const Shape3D &shape) const override
 Compare shapes. More...
 
float get_radius_x () const
 
float get_radius_y () const
 
float get_radius_z () const
 
CartesianCoordinate3D< float > get_radii () const
 
void set_radii (const CartesianCoordinate3D< float > &new_radii)
 
- Public Member Functions inherited from stir::RegisteredParsingObject< Ellipsoid, 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 = "Ellipsoid"
 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

CartesianCoordinate3D< float > radii
 Radii in 3 directions (before using the direction vectors)
 
- Protected Attributes inherited from stir::ParsingObject
KeyParser parser
 

Additional Inherited Members

- Static Public Member Functions inherited from stir::RegisteredParsingObject< Ellipsoid, 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 ellipsoid.

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

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

where $dir_x, dir_y, dir_z$ are described in the documentation for class stir::Shape3DWithOrientation.
Parameters
    Ellipsoid Parameters:=
   radius-x (in mm):= <float>
   radius-y (in mm):= <float>
   radius-z (in mm):= <float>
   ; any parameters of Shape3DWithOrientation
   End:=

Member Function Documentation

◆ is_inside_shape()

bool stir::Ellipsoid::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 stir::norm_squared().

◆ operator==() [1/2]

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

Compare cylinders.

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

◆ operator==() [2/2]

bool stir::Ellipsoid::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.

◆ set_defaults()

void stir::Ellipsoid::set_defaults ( )
overrideprotectedvirtual

set defaults before parsing

sets radii to 0 and calls Shape3DWithOrientation::set_defaults()

Reimplemented from stir::ParsingObject.

◆ post_processing()

bool stir::Ellipsoid::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::error(), and stir::warning().


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