STIR
6.2.0
|
A class for shapes that have been discretised as a volume. More...
#include "stir/Shape/DiscretisedShape3D.h"
Public Member Functions | |
DiscretisedShape3D (const VoxelsOnCartesianGrid< float > &image) | |
Constructor that will copy the image to an internal member. More... | |
DiscretisedShape3D (const shared_ptr< const DiscretisedDensity< 3, float >> &density_sptr) | |
Constructor that will copy the shared_ptr image. More... | |
bool | operator== (const Shape3D &) const override |
Compare shapes. More... | |
void | set_origin (const CartesianCoordinate3D< float > &) override |
set origin of the shape | |
void | scale (const CartesianCoordinate3D< float > &scale3D) override |
Scale shape. More... | |
bool | is_inside_shape (const CartesianCoordinate3D< float > &index) const override |
determine if a point is inside a non-zero voxel or not More... | |
float | get_voxel_weight (const CartesianCoordinate3D< float > &coord, const CartesianCoordinate3D< float > &voxel_size, const CartesianCoordinate3D< int > &num_samples) const override |
get weight for a voxel centred around coord More... | |
void | construct_volume (VoxelsOnCartesianGrid< float > &image, const CartesianCoordinate3D< int > &num_samples) const override |
Construct a new image from the underlying density. More... | |
Shape3D * | clone () const override |
Allocate a new Shape3D object which is a copy of the current one. | |
DiscretisedDensity< 3, float > & | get_discretised_density () |
provide access to the underlying density | |
const DiscretisedDensity< 3, float > & | get_discretised_density () const |
provide (const) access to the underlying density | |
int | get_label_index () const |
Return label index. | |
void | set_label_index (int label_index) |
Set label index. | |
Public Member Functions inherited from stir::RegisteredParsingObject< DiscretisedShape3D, 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 | |
bool | operator!= (const Shape3D &) const |
Compare shapes. | |
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 float | get_geometric_volume () const |
Compute approximate volume. More... | |
CartesianCoordinate3D< float > | get_origin () const |
get the origin of the shape-coordinate system | |
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) |
Static Public Attributes | |
static const char *const | registered_name = "Discretised Shape3D" |
Name which will be used when parsing a Shape3D object. | |
Additional Inherited Members | |
Static Public Member Functions inherited from stir::RegisteredParsingObject< DiscretisedShape3D, Shape3D, Shape3D > | |
static Shape3D * | read_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 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. | |
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. | |
Protected Member Functions inherited from stir::ParsingObject | |
virtual void | set_key_values () |
This will be called before parsing or parameter_info is called. More... | |
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 |
A class for shapes that have been discretised as a volume.
Currently only supports discretisation via VoxelsOnCartesianGrid.
This class supports 2 options:
Discretised Shape3D Parameters:= input filename := <filename> label index := -1 ; if less than 1 (default), we will use "weights" END:=where filename needs to specify a volume that can be read by STIR.
stir::DiscretisedShape3D::DiscretisedShape3D | ( | const VoxelsOnCartesianGrid< float > & | image | ) |
Constructor that will copy the image to an internal member.
The filename
member is set to "FROM MEMORY" such that parameter_info() returns somewhat useful info. This has a consequence that the object cannot be constructed from its own parameter_info(). This is in contrast with most other shapes.
References stir::DiscretisedDensity< num_dimensions, elemT >::get_origin(), and set_origin().
stir::DiscretisedShape3D::DiscretisedShape3D | ( | const shared_ptr< const DiscretisedDensity< 3, float >> & | density_sptr | ) |
Constructor that will copy the shared_ptr image.
The filename
member is set to "FROM MEMORY" such that parameter_info() returns somewhat useful info. This has a consequence that the object cannot be constructed from its own parameter_info(). This is in contrast with most other shapes.
References stir::KeyParser::add_key(), stir::KeyParser::add_start_key(), stir::KeyParser::add_stop_key(), stir::error(), stir::Shape3D::get_origin(), stir::Shape3D::initialise_keymap(), stir::ParsingObject::post_processing(), registered_name, stir::Shape3D::set_defaults(), set_origin(), and stir::warning().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
overridevirtual |
determine if a point is inside a non-zero voxel or not
Implements stir::Shape3D.
|
overridevirtual |
get weight for a voxel centred around coord
The argument num_samples is ignored.
If get_label_index() >= 0, the weight will be 1 for those voxels whose value is equal to the label_index and zero otherwise. If get_label_index() < 0 (default), the weight will be the actual voxel value.
Reimplemented from stir::Shape3D.
References stir::round().
|
overridevirtual |
Construct a new image from the underlying density.
If get_label_index() >= 0, the imags need to have the same characteristics, but in the other case, zoom_image is called for interpolation. The result is then scaled such that mean ROI values remain the same (at least for ROIs which avoid edges).
The argument num_samples is ignored.
Reimplemented from stir::Shape3D.
References stir::Array< num_dimensions, elemT >::begin_all(), stir::Array< num_dimensions, elemT >::end_all(), stir::error(), stir::round(), and stir::zoom_image().