STIR
6.2.0
|
Class for shapes with orientation. More...
#include "stir/Shape/Shape3DWithOrientation.h"
Public Member Functions | |
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 | |
virtual bool | operator== (const Shape3D &) const =0 |
Compare shapes. More... | |
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 bool | is_inside_shape (const CartesianCoordinate3D< float > &coord) const =0 |
determine if a point is inside the shape or not (up to floating point errors) 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... | |
virtual float | get_geometric_volume () const |
Compute approximate volume. 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 | |
virtual Shape3D * | clone () const =0 |
Allocate a new Shape3D object which is a copy of the current one. | |
std::string | parameter_info () override |
Public Member Functions inherited from stir::RegisteredObjectBase | |
virtual std::string | get_registered_name () const =0 |
Returns the name of the type of the object. More... | |
Public Member Functions inherited from stir::ParsingObject | |
ParsingObject (const ParsingObject &) | |
ParsingObject & | operator= (const ParsingObject &) |
void | ask_parameters () |
bool | parse (std::istream &f) |
bool | parse (const char *const filename) |
Protected Member Functions | |
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) | |
Additional Inherited Members | |
Static Public Member Functions inherited from stir::RegisteredObject< Shape3D > | |
static Shape3D * | read_registered_object (std::istream *in, const std::string ®istered_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 Shape3D * | ask_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_less > | RegistryType |
The type of the registry. | |
Static Protected Member Functions inherited from stir::RegisteredObject< Shape3D > | |
static RegistryType & | registry () |
Static function returning the registry. More... | |
Protected Attributes inherited from stir::ParsingObject | |
KeyParser | parser |
Class for shapes with orientation.
Orientation is specified by giving a 3x3 matrix specifying 3 direction vectors. Note that these vectors do not necessarily have to be orthogonal nor have unit-norm (in fact, scale() will rescale these direction vectors). Of course, they should not be parallel, but this is not checked.
Functions like is_inside_shape(coord)
should compute the coordinate to be used in the calculation as matrix_multiply(direction_vectors, coord-origin)
, or best practice is to call transform_to_shape_coords(coords)
.
; any parameters of Shape3D ; parameters that enable to use non-default axes ; values below are give a rotation around y for 90 degrees (swapping x and z) ; Warning: this uses the STIR convention {z,y,x} direction vectors (in mm) := { {0,0,1}, {0,1,0}, {-1,0,0}} End:=
|
overridevirtual |
scale the whole shape
Scaling the shape also shifts the origin of the shape: new_origin = old_origin * scale3D. This is necessary such that combined shapes keep their correct relative positions. This means that scaling and translating is non-commutative.
Implements stir::Shape3D.
References stir::square().
|
inline |
get direction vectors currently in use
Index offsets will always be 1
References stir::diagonal_matrix().
Succeeded stir::Shape3DWithOrientation::set_direction_vectors | ( | const Array< 2, float > & | directions | ) |
set direction vectors
Any index offset will be accepted.
Note that scaling the direction vectors is equivalent to a call to scale_around_origin()
References stir::VectorWithOffset< T >::set_min_index().
Referenced by stir::EllipsoidalCylinder::EllipsoidalCylinder().
|
protected |
gets the volume of the cell spanned by the direction vectors
this should be used when computing volumes etc
References stir::determinant().
Referenced by stir::EllipsoidalCylinder::is_inside_shape().
|
overrideprotectedvirtual |
sets defaults for parsing
sets direction vectors to the normal unit vectors.
Reimplemented from stir::Shape3D.
References stir::diagonal_matrix().
|
overrideprotectedvirtual |
This will be called at the end of the parsing.
Reimplemented from stir::ParsingObject.
References _PI, and stir::warning().
|
overrideprotectedvirtual |
This will be called before parsing or parameter_info is called.
This virtual function should be overloaded when the values for the keywords depend on other variables in the derived class that can be set independently of the parsing.
A derived class has a public member angle_in_radians, while a keyword sets a private member angle_in_degrees.
Reimplemented from stir::ParsingObject.
References _PI.