STIR 6.4.0
Shape3D.h
Go to the documentation of this file.
1//
2//
3/*
4 Copyright (C) 2000- 2007, Hammersmith Imanet Ltd
5 This file is part of STIR.
6
7 SPDX-License-Identifier: Apache-2.0
8
9 See STIR/LICENSE.txt for details
10*/
20
21#ifndef __stir_Shape_Shape3D_h__
22#define __stir_Shape_Shape3D_h__
23
25#include "stir/ParsingObject.h"
27
28START_NAMESPACE_STIR
29
30template <typename elemT>
31class VoxelsOnCartesianGrid;
32
65class Shape3D : public RegisteredObject<Shape3D>
66{
67public:
68 ~Shape3D() override {}
69
71
78 virtual inline bool operator==(const Shape3D&) const = 0;
79
81 inline bool operator!=(const Shape3D&) const;
82
100 virtual float get_voxel_weight(const CartesianCoordinate3D<float>& voxel_centre,
101 const CartesianCoordinate3D<float>& voxel_size,
102 const CartesianCoordinate3D<int>& num_samples) const;
103
105
113 virtual bool is_inside_shape(const CartesianCoordinate3D<float>& coord) const = 0;
114
116
120 virtual void translate(const CartesianCoordinate3D<float>& direction);
122
135 virtual void scale(const CartesianCoordinate3D<float>& scale3D) = 0;
136
138 inline void scale_around_origin(const CartesianCoordinate3D<float>& scale3D);
139
154 virtual void construct_volume(VoxelsOnCartesianGrid<float>& image, const CartesianCoordinate3D<int>& num_samples) const;
155 // virtual void construct_slice(PixelsOnCartesianGrid<float> &plane, const CartesianCoordinate3D<int>& num_samples) const;
156
158
162 virtual float get_geometric_volume() const;
163#if 0
165
169 virtual float get_geometric_area() const;
170#endif
171
172 // TODO get_bounding_box() const;
173
177 virtual void set_origin(const CartesianCoordinate3D<float>&);
178
180 virtual Shape3D* clone() const = 0;
181
182 // need to overload this to avoid ambiguity between Object::parameter_info and ParsingObject::parameter_info()
183 std::string parameter_info() override;
184
185protected:
186 inline Shape3D();
187 inline explicit Shape3D(const CartesianCoordinate3D<float>& origin);
188
190
191 void set_defaults() override;
192 void initialise_keymap() override;
194private:
197};
198
199END_NAMESPACE_STIR
200
201#include "stir/Shape/Shape3D.inl"
202
203#endif
defines the stir::CartesianCoordinate3D<coordT> class
Declaration of class stir::ParsingObject.
Declaration of class stiir::RegisteredObject.
Inline-implementations of class stir::Shape3D.
a templated class for 3-dimensional coordinates.
Definition CartesianCoordinate3D.h:53
virtual float get_geometric_volume() const
Compute approximate volume.
Definition Shape3D.cxx:55
void set_defaults() override
Set defaults before parsing.
Definition Shape3D.cxx:197
virtual void translate(const CartesianCoordinate3D< float > &direction)
translate the whole shape by shifting its origin
Definition Shape3D.cxx:49
virtual bool operator==(const Shape3D &) const =0
Compare shapes.
Definition Shape3D.inl:32
void initialise_keymap() override
Initialise all keywords.
Definition Shape3D.cxx:203
bool operator!=(const Shape3D &) const
Compare shapes.
Definition Shape3D.inl:38
void scale_around_origin(const CartesianCoordinate3D< float > &scale3D)
scale the whole shape, keeping the centre at the same place
Definition Shape3D.inl:44
virtual void scale(const CartesianCoordinate3D< float > &scale3D)=0
scale the whole shape
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)
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.
Definition Shape3D.cxx:70
CartesianCoordinate3D< float > get_origin() const
get the origin of the shape-coordinate system
Definition Shape3D.inl:54
virtual void construct_volume(VoxelsOnCartesianGrid< float > &image, const CartesianCoordinate3D< int > &num_samples) const
construct an image representation the shape in a discretised manner
Definition Shape3D.cxx:101
virtual void set_origin(const CartesianCoordinate3D< float > &)
set the origin of the shape-coordinate system
Definition Shape3D.cxx:43
virtual Shape3D * clone() const =0
Allocate a new Shape3D object which is a copy of the current one.
This class is used to represent voxelised densities on a cuboid grid (3D).
Definition VoxelsOnCartesianGrid.h:46