STIR 6.4.0
CudaRelativeDifferencePrior.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2024, University College London
3 This file is part of STIR.
4
5 SPDX-License-Identifier: Apache-2.0
6
7 See STIR/LICENSE.txt for details
8*/
9#ifndef __stir_recon_buildblock_CudaRelativeDifferencePrior_h__
10#define __stir_recon_buildblock_CudaRelativeDifferencePrior_h__
11
21
23
24START_NAMESPACE_STIR
25
36template <typename elemT>
37class CudaRelativeDifferencePrior : public RegisteredParsingObject<CudaRelativeDifferencePrior<elemT>,
38 GeneralisedPrior<DiscretisedDensity<3, elemT>>,
39 RelativeDifferencePrior<elemT>>
40{
41#ifdef SWIG
42public:
43#endif
47 base_type;
48
49public:
50 // Name which will be used when parsing a GeneralisedPrior object
51 inline static const char* const registered_name = "Cuda Relative Difference Prior";
52#ifndef SWIG
53 // import constructors from base_type
54 // Note: currently disabled for SWIG as that needs SWIG 4.2
55 using base_type::base_type;
56#endif
57
59
60 // Overridden methods
61 void set_defaults() override;
62 double compute_value(const DiscretisedDensity<3, elemT>& current_image_estimate) override;
64 const DiscretisedDensity<3, elemT>& current_image_estimate) override;
65
66 Succeeded set_up(shared_ptr<const DiscretisedDensity<3, elemT>> const& target_sptr) override;
67
68protected:
69 struct cppdim3
70 {
71 int x;
72 int y;
73 int z;
74 };
75
76 int z_dim, y_dim, x_dim;
77 cppdim3 block_dim;
78 cppdim3 grid_dim;
79
81 float* d_weights_data = 0;
83 float* d_kappa_data = 0;
84};
85
86END_NAMESPACE_STIR
87
88#endif // __stir_recon_buildblock_CudaRelativeDifferencePrior_h__
Declaration of class stir::RelativeDifferencePrior.
CUDA implementation of the Relative Difference prior.
Definition CudaRelativeDifferencePrior.h:40
float * d_kappa_data
Device copy of kappa.
Definition CudaRelativeDifferencePrior.h:83
void compute_gradient(DiscretisedDensity< 3, elemT > &prior_gradient, const DiscretisedDensity< 3, elemT > &current_image_estimate) override
This should compute the gradient of the log of the prior function at the current_estimate.
Succeeded set_up(shared_ptr< const DiscretisedDensity< 3, elemT > > const &target_sptr) override
Has to be called before using this object.
void set_defaults() override
Set defaults before parsing.
float * d_weights_data
Device copy of weights.
Definition CudaRelativeDifferencePrior.h:81
double compute_value(const DiscretisedDensity< 3, elemT > &current_image_estimate) override
compute the value of the function
This abstract class is the basis for all image representations.
Definition DiscretisedDensity.h:99
A base class for 'generalised' priors, i.e. priors for which at least a 'gradient' is defined.
Definition GeneralisedPrior.h:44
Parent class for all leaves in a RegisteredObject hierarchy that do parsing of parameter files.
Definition RegisteredParsingObject.h:78
A class in the GeneralisedPrior hierarchy. This implements a Relative Difference prior.
Definition RelativeDifferencePrior.h:100
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition Succeeded.h:44