STIR 6.4.0
stir::CombinedShape3D< operation > Class Template Reference

A class that allows combining several shapes using logical operations. More...

#include "stir/Shape/CombinedShape3D.h"

Inheritance diagram for stir::CombinedShape3D< operation >:

Public Member Functions

 CombinedShape3D (shared_ptr< Shape3D > object1_v, shared_ptr< Shape3D > object2_v)
 
bool is_inside_shape (const CartesianCoordinate3D< float > &coord) const
 determine if a point is inside the shape or not (up to floating point errors)
 
void translate (const CartesianCoordinate3D< float > &direction)
 translate the whole shape by shifting its origin
 
void scale (const CartesianCoordinate3D< float > &scale3D)
 scale the whole shape
 
Shape3Dclone () const
 Allocate a new Shape3D object which is a copy of the current one.
 
- Public Member Functions inherited from stir::RegisteredParsingObject< CombinedShape3D, Shape3D, Shape3D >
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::Shape3D
virtual bool operator== (const Shape3D &) const =0
 Compare shapes.
 
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.
 
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
 
virtual float get_geometric_volume () const
 Compute approximate volume.
 
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
 
std::string parameter_info () override
 
- Public Member Functions inherited from stir::ParsingObject
 ParsingObject (const ParsingObject &)
 
ParsingObjectoperator= (const ParsingObject &)
 
bool parse (std::istream &f)
 
bool parse (const char *const filename)
 
void ask_parameters ()
 

Additional Inherited Members

- Static Public Member Functions inherited from stir::RegisteredParsingObject< CombinedShape3D, Shape3D, Shape3D >
static Shape3Dread_from_stream (std::istream *)
 Construct a new object (of type Derived) by parsing the istream.
 
- 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.
 
static Shape3Dask_type_and_parameters ()
 ask the user for the type, and then calls read_registered_object(0, type)
 
static void list_registered_names (std::ostream &stream)
 List all possible registered names to the stream.
 
- 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.
 
- Protected Member Functions inherited from stir::Shape3D
 Shape3D (const CartesianCoordinate3D< float > &origin)
 
void set_defaults () override
 Set defaults before parsing.
 
void initialise_keymap () override
 Initialise all keywords.
 
virtual bool post_processing ()
 This will be called at the end of the parsing.
 
virtual void set_key_values ()
 This will be called before parsing or parameter_info is called.
 
- Static Protected Member Functions inherited from stir::RegisteredObject< Shape3D >
static RegistryTyperegistry ()
 Static function returning the registry.
 
KeyParser parser
 

Detailed Description

template<class operation = logical_and<bool>>
class stir::CombinedShape3D< operation >

A class that allows combining several shapes using logical operations.

Todo

document more

Parsing cannot work yet because of template (can be solved by explicit instantiation)

Member Function Documentation

◆ is_inside_shape()

template<class operation>
bool stir::CombinedShape3D< operation >::is_inside_shape ( const CartesianCoordinate3D< float > & coord) const
inlinevirtual

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 is_inside_shape().

Referenced by is_inside_shape().

◆ translate()

template<class operation>
void stir::CombinedShape3D< operation >::translate ( const CartesianCoordinate3D< float > & direction)
inlinevirtual

translate the whole shape by shifting its origin

Uses set_origin().

See also
scale()

Reimplemented from stir::Shape3D.

References translate().

Referenced by translate().

◆ scale()

template<class operation>
void stir::CombinedShape3D< operation >::scale ( const CartesianCoordinate3D< float > & scale3D)
inlinevirtual

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.

shape1=shape;
shape1.translate(offset); shape1.scale(scale);
shape2=shape;
shape2.scale(scale); shape2.translate(offset*scale);
assert(shape1==shape2);
void scale(const CartesianCoordinate3D< float > &scale3D)
scale the whole shape
Definition CombinedShape3D.inl:65

Implements stir::Shape3D.

References scale().

Referenced by scale().

◆ clone()

template<class operation>
Shape3D * stir::CombinedShape3D< operation >::clone ( ) const
inlinevirtual

Allocate a new Shape3D object which is a copy of the current one.

Implements stir::Shape3D.

References clone().

Referenced by clone().


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