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

Three-dimensional cuboid box. More...

#include "stir/Shape/Box3D.h"

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

Public Member Functions

 Box3D (const float length_x, const float length_y, const float length_z, const CartesianCoordinate3D< float > &centre, const Array< 2, float > &direction_vectors=diagonal_matrix(3, 1.F))
 
float get_geometric_volume () const override
 Compute approximate volume. More...
 
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 Box3D &) const
 Compare boxes. More...
 
bool operator== (const Shape3D &shape) const override
 Compare shapes. More...
 
- Public Member Functions inherited from stir::RegisteredParsingObject< Box3D, 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 = "Box3D"
 Name which will be used when parsing a Shape3D object.
 

Protected Attributes

float length_x
 Length in x-direction if the shape is not rotated.
 
float length_y
 Length in y-direction if the shape is not rotated.
 
float length_z
 Length in z-direction if the shape is not rotated.
 
- Protected Attributes inherited from stir::ParsingObject
KeyParser parser
 

Additional Inherited Members

- Static Public Member Functions inherited from stir::RegisteredParsingObject< Box3D, 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.
 
- 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)
 
- Static Protected Member Functions inherited from stir::RegisteredObject< Shape3D >
static RegistryTyperegistry ()
 Static function returning the registry. More...
 

Detailed Description

Three-dimensional cuboid box.

Description
A point with coordinates coord is inside the shape if for x,y,z given by Shape3DWithOrientation::transform_to_shape_coords(coord)

\[ abs(x), abs(y), abs(z) <= length_x/2, length_y/2, length_z/2 \]

Parameters
  Box3D Parameters:=
     length-x (in mm):= <float>
     length-y (in mm):= <float>
     length-z (in mm):= <float>
     ; any parameters of Shape3DWithOrientation
  End:=

Member Function Documentation

◆ get_geometric_volume()

float stir::Box3D::get_geometric_volume ( ) const
overridevirtual

Compute approximate volume.

As this is not possible/easy for all shapes, the default implementation returns a negative number. The user should check this to see if the returned value makes sense.

Reimplemented from stir::Shape3D.

◆ is_inside_shape()

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

◆ operator==() [1/2]

bool stir::Box3D::operator== ( const Box3D box) const

Compare boxes.

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

References length_x, length_y, and length_z.

◆ operator==() [2/2]

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


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