|
STIR
6.3.0
|
A base class with CUDA-accelerated implementation of the GibbsPenalty class. More...
#include "stir/recon_buildblock/CUDA/CudaGibbsPenalty.h"

Public Member Functions | |
| CudaGibbsPenalty (const bool only_2D, float penalization_factor) | |
| Succeeded | set_up (shared_ptr< const DiscretisedDensity< 3, elemT >> const &target_sptr) override |
| Override CPU version to set up CUDA resources on GPU and call parent set_up. | |
| void | set_weights (const Array< 3, float > &w) override |
| Set the weights array for the prior on the GPU. | |
| void | set_kappa_sptr (const shared_ptr< const DiscretisedDensity< 3, elemT >> &k) override |
| Set the kappa image (spatially-varying penalty factors) on the GPU. | |
| double | compute_value (const DiscretisedDensity< 3, elemT > ¤t_image_estimate) override |
| CUDA-accelerated value computation. | |
| void | compute_gradient (DiscretisedDensity< 3, elemT > &prior_gradient, const DiscretisedDensity< 3, elemT > ¤t_image_estimate) override |
| CUDA-accelerated gradient computation. | |
| double | compute_gradient_times_input (const DiscretisedDensity< 3, elemT > &input, const DiscretisedDensity< 3, elemT > ¤t_image_estimate) override |
| CUDA-accelerated gradient dot input computation. | |
| void | compute_Hessian_diagonal (DiscretisedDensity< 3, elemT > &Hessian_diagonal, const DiscretisedDensity< 3, elemT > ¤t_estimate) const override |
| CUDA-accelerated Hessian diagonal computation. | |
| void | accumulate_Hessian_times_input (DiscretisedDensity< 3, elemT > &output, const DiscretisedDensity< 3, elemT > ¤t_image_estimate, const DiscretisedDensity< 3, elemT > &input) const override |
| CUDA-accelerated Hessian times input computation. | |
Public Member Functions inherited from stir::GibbsPenalty< elemT, PotentialT > | |
| GibbsPenalty () | |
| Default constructor. | |
| GibbsPenalty (const bool only_2D, float penalization_factor) | |
| Explicit Constructor with 2D/3D option and penalization factor. | |
| double | compute_value (const DiscretisedDensity< 3, elemT > ¤t_image_estimate) override |
| Compute the value of the prior for the current image estimate. | |
| void | compute_gradient (DiscretisedDensity< 3, elemT > &prior_gradient, const DiscretisedDensity< 3, elemT > ¤t_image_estimate) override |
| Compute the gradient of the prior for the current image estimate. | |
| double | compute_gradient_times_input (const DiscretisedDensity< 3, elemT > &input, const DiscretisedDensity< 3, elemT > ¤t_image_estimate) override |
| Compute the dot product of the prior gradient and an input image. | |
| void | compute_Hessian (DiscretisedDensity< 3, elemT > &prior_Hessian_for_single_densel, const BasicCoordinate< 3, int > &coords, const DiscretisedDensity< 3, elemT > ¤t_image_estimate) const override |
| Compute the Hessian row of the prior at (coords). | |
| void | compute_Hessian_diagonal (DiscretisedDensity< 3, elemT > &Hessian_diagonal, const DiscretisedDensity< 3, elemT > ¤t_estimate) const override |
| Compute the diagonal of the Hessian matrix. | |
| void | accumulate_Hessian_times_input (DiscretisedDensity< 3, elemT > &output, const DiscretisedDensity< 3, elemT > ¤t_estimate, const DiscretisedDensity< 3, elemT > &input) const override |
| Accumulate Hessian times input image into output. | |
| const Array< 3, float > & | get_weights () const |
| Get the current weights array. More... | |
| shared_ptr< const DiscretisedDensity< 3, elemT > > | get_kappa_sptr () const |
| get current kappa image More... | |
| Succeeded | set_up (shared_ptr< const DiscretisedDensity< 3, elemT >> const &target_sptr) override |
| Set up the prior for a target image. Must be called before use. | |
| virtual std::string | get_parsing_name () const |
| Getter method to retrieve the parsing name. More... | |
| bool | is_convex () const override |
| Return whether the prior is convex or not. | |
Public Member Functions inherited from stir::GeneralisedPrior< DiscretisedDensity< 3, elemT > > | |
| virtual double | compute_gradient_times_input (const DiscretisedDensity< 3, elemT > &input, const DiscretisedDensity< 3, elemT > ¤t_estimate) |
| compute the dot product of the gradient of the log of the prior function at the current_estimate with input More... | |
| virtual void | compute_Hessian (DiscretisedDensity< 3, elemT > &prior_Hessian_for_single_densel, const BasicCoordinate< 3, int > &coords, const DiscretisedDensity< 3, elemT > ¤t_image_estimate) const |
| This computes a single row of the Hessian. More... | |
| virtual void | compute_Hessian_diagonal (DiscretisedDensity< 3, elemT > &Hessian_diagonal, const DiscretisedDensity< 3, elemT > ¤t_estimate) const |
| This computes the diagonal of the Hessian of the log of the prior function at the current_estimate and stores it in Hessian_diagonal. More... | |
| virtual void | add_multiplication_with_approximate_Hessian (DiscretisedDensity< 3, elemT > &output, const DiscretisedDensity< 3, elemT > &input) const |
| This should compute the multiplication of the Hessian with a vector and add it to output. More... | |
| virtual void | accumulate_Hessian_times_input (DiscretisedDensity< 3, elemT > &output, const DiscretisedDensity< 3, elemT > ¤t_estimate, const DiscretisedDensity< 3, elemT > &input) const |
| This should compute the multiplication of the Hessian with a vector and add it to output. More... | |
| float | get_penalisation_factor () const |
| void | set_penalisation_factor (float new_penalisation_factor) |
| virtual Succeeded | set_up (shared_ptr< const DiscretisedDensity< 3, elemT > > const &target_sptr) |
| Has to be called before using this object. | |
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 () |
| virtual std::string | parameter_info () |
| bool | parse (std::istream &f) |
| bool | parse (const char *const filename) |
Protected Attributes | |
| cuda_dim3 | block_dim |
| cuda_dim3 | grid_dim |
| int | threads_per_block |
| size_t | shared_mem_bytes |
| elemT * | d_image_data = nullptr |
| cuda_int3 | d_image_dim |
| cuda_int3 | d_image_max_indices |
| cuda_int3 | d_image_min_indices |
| cuda_int3 | d_weight_max_indices |
| cuda_int3 | d_weight_min_indices |
| float * | d_weights_data = nullptr |
| elemT * | d_kappa_data = nullptr |
| double * | d_scalar = nullptr |
| elemT * | d_input_data = nullptr |
| elemT * | d_output_data = nullptr |
Protected Attributes inherited from stir::GibbsPenalty< elemT, PotentialT > | |
| Array< 3, float > | weights |
| The weights for the neighbourhood. | |
| bool | only_2D |
| can be set during parsing to restrict the weights to the 2D case | |
| std::string | gradient_filename_prefix |
| filename prefix for outputing the gradient whenever compute_gradient() is called. More... | |
| std::string | kappa_filename |
Filename for the image that will be read by post_processing() | |
| PotentialT | potential |
| Gibbs Potential Function. | |
| shared_ptr< const DiscretisedDensity< 3, elemT > > | kappa_ptr |
| The kappa image (spatially-varying penalty factors). | |
| CartesianCoordinate3D< int > | image_dim |
| Image dimensions. | |
| CartesianCoordinate3D< int > | image_max_indices |
| Maximum image indices. | |
| CartesianCoordinate3D< int > | image_min_indices |
| Minimum image indices. | |
Protected Attributes inherited from stir::GeneralisedPrior< DiscretisedDensity< 3, elemT > > | |
| float | penalisation_factor |
| bool | _already_set_up |
Protected Attributes inherited from stir::ParsingObject | |
| KeyParser | parser |
Additional Inherited Members | |
Static Public Member Functions inherited from stir::RegisteredObject< GeneralisedPrior< DiscretisedDensity< 3, elemT > > > | |
| static GeneralisedPrior< DiscretisedDensity< 3, elemT > > * | 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 GeneralisedPrior< DiscretisedDensity< 3, elemT > > * | 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< GeneralisedPrior< DiscretisedDensity< 3, elemT > > > | |
| typedef GeneralisedPrior< DiscretisedDensity< 3, elemT > > *(* | 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::GibbsPenalty< elemT, PotentialT > | |
| void | compute_default_weights (const CartesianCoordinate3D< float > &grid_spacing, bool only_2D) |
| Compute default weights for the prior. | |
| void | check (DiscretisedDensity< 3, elemT > const ¤t_image_estimate) const override |
| Check that the prior is ready to be used. | |
| void | set_defaults () override |
| Set defaults before parsing. | |
| void | initialise_keymap () override |
| Initialise all keywords. | |
| bool | post_processing () override |
| This will be called at the end of the parsing. More... | |
Protected Member Functions inherited from stir::GeneralisedPrior< DiscretisedDensity< 3, elemT > > | |
| virtual void | check (DiscretisedDensity< 3, elemT > const ¤t_estimate) const |
| Check that the prior is ready to be used. | |
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< GeneralisedPrior< DiscretisedDensity< 3, elemT > > > | |
| static RegistryType & | registry () |
| Static function returning the registry. More... | |
A base class with CUDA-accelerated implementation of the GibbsPenalty class.
This class provides CUDA-accelerated implementations of compute_value, compute_gradient, accumulate_Hessian_times_input, compute_Hessian_diagonal and compute_gradient_times_input while inheriting all parsing and setting functionality from the base CPU GibbsPenalty class.
Check the documentation of the GibbsPenalty class for details on how the prior is defined and how to use it.
1.8.13