STIR  6.2.0
IterativeReconstruction.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2000 PARAPET partners
5  Copyright (C) 2000- 2011, Hammersmith Imanet Ltd
6  Copyright (C) 2018, University College London
7  This file is part of STIR.
8 
9  SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
10 
11  See STIR/LICENSE.txt for details
12 */
13 #ifndef __stir_recon_buildblock_IterativeReconstruction_h__
14 # define __stir_recon_buildblock_IterativeReconstruction_h__
15 
29 /* Modification history
30 
31  KT 10122001
32  - added get_initial_data_ptr and 0 argument reconstruct()
33 */
35 # include "stir/shared_ptr.h"
36 # include "stir/DataProcessor.h"
38 
39 START_NAMESPACE_STIR
40 
80 template <class TargetT>
81 class IterativeReconstruction : public Reconstruction<TargetT>
82 {
83 private:
85 
86 public:
88  int get_subiteration_num() const { return subiteration_num; }
89 
91 
101  int get_subset_num();
102 
104 
112  virtual TargetT* get_initial_data_ptr() const;
113 
115 
122  Succeeded reconstruct() override;
123 
125 
130  Succeeded reconstruct(shared_ptr<TargetT> const& target_data_sptr) override;
131 
133 
135  std::string make_filename_prefix_subiteration_num(const std::string& filename_prefix) const;
136 
138 
140  std::string make_filename_prefix_subiteration_num() const;
141 
147  GeneralisedObjectiveFunction<TargetT> const& get_objective_function() const;
148 
149  shared_ptr<GeneralisedObjectiveFunction<TargetT>> get_objective_function_sptr() const;
150 
152  const int get_max_num_full_iterations() const;
153 
155  const int get_num_subsets() const;
156 
158  const int get_num_subiterations() const;
159 
161  const int get_start_subiteration_num() const;
162 
164  const int get_start_subset_num() const;
165 
166  // TODO rename
168  const int get_save_interval() const;
169 
171  const bool get_randomise_subset_order() const;
172 
174  const DataProcessor<TargetT>& get_inter_iteration_filter() const;
175 
176  shared_ptr<DataProcessor<TargetT>> get_inter_iteration_filter_sptr();
177 
179  const int get_inter_iteration_filter_interval() const;
180 
182  const int get_report_objective_function_values_interval() const;
184 
191  void set_objective_function_sptr(const shared_ptr<GeneralisedObjectiveFunction<TargetT>>&);
193 
195  void set_max_num_full_iterations(const int);
196 
198  void set_num_subsets(const int);
199 
201  void set_num_subiterations(const int);
202 
204  void set_start_subiteration_num(const int);
205 
207  void set_start_subset_num(const int);
208 
209  // TODO rename
211  void set_save_interval(const int);
212 
214  void set_randomise_subset_order(const bool);
215 
217  void set_inter_iteration_filter_ptr(const shared_ptr<DataProcessor<TargetT>>&);
218 
220  void set_inter_iteration_filter_interval(const int);
221 
223  void set_report_objective_function_values_interval(const int);
224 
228  void set_input_data(const shared_ptr<ExamData>& arg) override;
229  const ExamData& get_input_data() const override;
231 
232  Succeeded set_up(shared_ptr<TargetT> const& target_data_ptr) override;
233 
235  virtual void update_estimate(TargetT& current_estimate) = 0;
236 
237 protected:
239 
241 
254  // KT 14/12/2001 remove =0 as it's not a pure virtual and the default implementation is usually fine.
255  virtual void end_of_iteration_processing(TargetT& current_estimate);
256 
257  shared_ptr<GeneralisedObjectiveFunction<TargetT>> objective_function_sptr;
258 
261 
264 
265  // parameters
266 protected:
269 
272 
275 
278 
281 
284 
285  // TODO rename
286 
289 
292 
294  shared_ptr<DataProcessor<TargetT>> inter_iteration_filter_ptr;
295 
298 
300 
303 
305  virtual void ask_parameters();
306 
307  void set_defaults() override;
308  void initialise_keymap() override;
310  bool post_processing() override;
311 
312 private:
314 
315  VectorWithOffset<int> _current_subset_array;
317  VectorWithOffset<int> randomly_permute_subset_order() const;
318 };
319 
320 END_NAMESPACE_STIR
321 
322 #endif
323 // __IterativeReconstruction_h__
int report_objective_function_values_interval
subiteration interval at which to report the values of the objective function
Definition: IterativeReconstruction.h:302
int inter_iteration_filter_interval
subiteration interval at which to apply inter-iteration filters
Definition: IterativeReconstruction.h:297
declares the stir::Reconstruction class
A base class for &#39;generalised&#39; objective functions, i.e. objective functions for which at least a &#39;gr...
Definition: GeneralisedObjectiveFunction.h:83
int max_num_full_iterations
the maximum allowed number of full iterations
Definition: IterativeReconstruction.h:268
Declaration of class stir::DataProcessor.
int subiteration_num
the subiteration counter
Definition: IterativeReconstruction.h:260
shared_ptr< DataProcessor< TargetT > > inter_iteration_filter_ptr
inter-iteration filter
Definition: IterativeReconstruction.h:294
std::string initial_data_filename
name of the file containing the data for intializing the reconstruction
Definition: IterativeReconstruction.h:280
int start_subiteration_num
value with which to initialize the subiteration counter
Definition: IterativeReconstruction.h:277
int save_interval
subiteration interval at which data will be saved
Definition: IterativeReconstruction.h:288
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
bool terminate_iterations
used to abort the loop over iterations
Definition: IterativeReconstruction.h:263
int num_subsets
the number of ordered subsets
Definition: IterativeReconstruction.h:271
bool randomise_subset_order
signals whether to randomise the subset order in each iteration
Definition: IterativeReconstruction.h:291
int num_subiterations
the number of subiterations
Definition: IterativeReconstruction.h:274
Declaration of class stir::GeneralisedObjectiveFunction.
base class for all ReconstructionsAs there is not a lot of commonality between different reconstructi...
Definition: Reconstruction.h:69
int get_subiteration_num() const
accessor for the subiteration counter
Definition: IterativeReconstruction.h:88
int start_subset_num
the starting subset number
Definition: IterativeReconstruction.h:283
base class for iterative reconstruction objectsThis is the base class for all iterative reconstructio...
Definition: IterativeReconstruction.h:81
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