24 #ifndef __stir_recon_buildblock_GeneralisedObjectiveFunction_H__ 25 #define __stir_recon_buildblock_GeneralisedObjectiveFunction_H__ 82 template <
typename TargetT>
87 : already_set_up(
false)
97 virtual TargetT* construct_target_ptr()
const = 0;
100 virtual Succeeded set_up(shared_ptr<TargetT>
const& target_sptr);
114 virtual void compute_sub_gradient(TargetT& gradient,
const TargetT& current_estimate,
const int subset_num);
120 virtual void compute_sub_gradient_without_penalty(TargetT& gradient,
const TargetT& current_estimate,
const int subset_num) = 0;
130 virtual void compute_gradient(TargetT& gradient,
const TargetT& current_estimate);
138 virtual void compute_gradient_without_penalty(TargetT& gradient,
const TargetT& current_estimate);
142 virtual double compute_objective_function_without_penalty(
const TargetT& current_estimate,
const int subset_num);
147 virtual double compute_objective_function_without_penalty(
const TargetT& current_estimate);
158 double compute_penalty(
const TargetT& current_estimate,
const int subset_num);
161 double compute_penalty(
const TargetT& current_estimate);
169 double compute_objective_function(
const TargetT& current_estimate,
const int subset_num);
177 double compute_objective_function(
const TargetT& current_estimate);
180 double compute_value(
const TargetT& current_estimate) {
return compute_objective_function(current_estimate); }
206 Succeeded add_multiplication_with_approximate_sub_Hessian_without_penalty(TargetT& output,
207 const TargetT& input,
208 const int subset_num)
const;
209 Succeeded add_multiplication_with_approximate_sub_Hessian(TargetT& output,
const TargetT& input,
const int subset_num)
const;
210 Succeeded add_multiplication_with_approximate_Hessian_without_penalty(TargetT& output,
const TargetT& input)
const;
211 Succeeded add_multiplication_with_approximate_Hessian(TargetT& output,
const TargetT& input)
const;
222 Succeeded accumulate_Hessian_times_input(TargetT& output,
const TargetT& current_image_estimate,
const TargetT& input)
const;
224 Succeeded accumulate_Hessian_times_input_without_penalty(TargetT& output,
225 const TargetT& current_image_estimate,
226 const TargetT& input)
const;
228 Succeeded accumulate_sub_Hessian_times_input(TargetT& output,
229 const TargetT& current_image_estimate,
230 const TargetT& input,
231 const int subset_num)
const;
232 Succeeded accumulate_sub_Hessian_times_input_without_penalty(TargetT& output,
233 const TargetT& current_image_estimate,
234 const TargetT& input,
235 const int subset_num)
const;
240 std::string get_objective_function_values_report(
const TargetT& current_estimate);
243 int get_num_subsets()
const;
249 virtual std::unique_ptr<ExamInfo> get_exam_info_uptr_for_target()
const 251 auto exam_info_uptr = unique_ptr<ExamInfo>(
new ExamInfo(*(this->get_input_data().get_exam_info_sptr())));
252 return exam_info_uptr;
258 virtual int set_num_subsets(
const int num_subsets) = 0;
269 bool subsets_are_approximately_balanced()
const;
277 bool subsets_are_approximately_balanced(std::string& warning_message)
const;
280 bool prior_is_zero()
const;
287 shared_ptr<GeneralisedPrior<TargetT>> get_prior_sptr();
298 virtual void set_input_data(
const shared_ptr<ExamData>&) = 0;
302 virtual const ExamData& get_input_data()
const = 0;
309 virtual void set_additive_proj_data_sptr(
const shared_ptr<ExamData>&) = 0;
315 virtual void set_normalisation_sptr(
const shared_ptr<BinNormalisation>&) = 0;
321 shared_ptr<GeneralisedPrior<TargetT>> prior_sptr;
325 void set_defaults()
override;
328 void initialise_keymap()
override;
342 virtual bool actual_subsets_are_approximately_balanced(std::string& warning_message)
const = 0;
354 virtual double actual_compute_objective_function_without_penalty(
const TargetT& current_estimate,
const int subset_num) = 0;
369 virtual Succeeded actual_add_multiplication_with_approximate_sub_Hessian_without_penalty(TargetT& output,
370 const TargetT& input,
371 const int subset_num)
const;
386 virtual Succeeded actual_accumulate_sub_Hessian_times_input_without_penalty(TargetT& output,
387 const TargetT& current_image_estimate,
388 const TargetT& input,
389 const int subset_num)
const;
A base class for 'generalised' objective functions, i.e. objective functions for which at least a 'gr...
Definition: GeneralisedObjectiveFunction.h:83
declaration of stir::ExamData
Declaration of class stir::ParsingObject.
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
Declaration of class stir::ProjData.
virtual void fill_nonidentifiable_target_parameters(TargetT &target, const float value) const
Fill any elements that we cannot estimate with a fixed value.
Definition: GeneralisedObjectiveFunction.h:196
Declaration of class stir::BinNormalisation.
Declaration of class stiir::RegisteredObject.
Helper class to provide registry mechanisms to a Base classSuppose you have a hierarchy of classes wi...
Definition: RegisteredObject.h:95
double compute_value(const TargetT ¤t_estimate)
Alias for compute_objective_function(const TargetT&)
Definition: GeneralisedObjectiveFunction.h:180
Declaration of class stir::GeneralisedPrior.
a class for storing information about 1 exam (or scan)
Definition: ExamInfo.h:41
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43
base class for data objects such as ProjData etcProvides an ExamInfo member.
Definition: ExamData.h:33