STIR 6.4.0
distributable.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2000 PARAPET partners
3 Copyright (C) 2000 - 2011, Hammersmith Imanet Ltd
4 Copyright (C) 2013, University College London
5 Copyright (C) 2022, University of Pennsylvania
6 This file is part of STIR.
7
8 SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
9
10 See STIR/LICENSE.txt for details
11*/
12
13#ifndef __stir_recon_buildblock_DISTRIBUTABLE_H__
14#define __stir_recon_buildblock_DISTRIBUTABLE_H__
15
29#include "stir/shared_ptr.h"
30#include "stir/Bin.h"
31#include <vector>
32
33START_NAMESPACE_STIR
34
35template <typename elemT>
36class RelatedViewgrams;
37template <int num_dimensions, typename elemT>
38class DiscretisedDensity;
39class BinNormalisation;
40class ProjData;
41class ProjDataInfo;
42class ExamInfo;
43class DataSymmetriesForViewSegmentNumbers;
44class ForwardProjectorByBin;
45class BackProjectorByBin;
46class ProjectorByBinPair;
47class DistributedCachingInformation;
48class ProjMatrixByBin;
49
51
53const int task_stop_processing = 0;
54const int task_setup_distributable_computation = 200;
55const int task_do_distributable_gradient_computation = 42;
56const int task_do_distributable_loglikelihood_computation = 43;
57const int task_do_distributable_sensitivity_computation = 44;
59
61
69void setup_distributable_computation(const shared_ptr<ProjectorByBinPair>& proj_pair_sptr,
70 const shared_ptr<const ExamInfo>& exam_info_sptr,
71 const shared_ptr<const ProjDataInfo> proj_data_info_sptr,
72 const shared_ptr<const DiscretisedDensity<3, float>>& target_sptr,
73 const bool zero_seg0_end_planes,
74 const bool distributed_cache_enabled);
75
77
82
84
93typedef void RPC_process_related_viewgrams_type(const shared_ptr<ForwardProjectorByBin>& forward_projector_sptr,
94 const shared_ptr<BackProjectorByBin>& back_projector_sptr,
95 RelatedViewgrams<float>* measured_viewgrams_ptr,
96 int& count,
97 int& count2,
98 double* log_likelihood_ptr,
99 const RelatedViewgrams<float>* additive_binwise_correction_ptr,
100 const RelatedViewgrams<float>* mult_viewgrams_ptr);
101
163void distributable_computation(const shared_ptr<ForwardProjectorByBin>& forward_projector_sptr,
164 const shared_ptr<BackProjectorByBin>& back_projector_sptr,
165 const shared_ptr<DataSymmetriesForViewSegmentNumbers>& symmetries_sptr,
166 DiscretisedDensity<3, float>* output_image_ptr,
167 const DiscretisedDensity<3, float>* input_image_ptr,
168 const shared_ptr<ProjData>& proj_data_ptr,
169 const bool read_from_proj_data,
170 int subset_num,
171 int num_subsets,
172 int min_segment_num,
173 int max_segment_num,
174 bool zero_seg0_end_planes,
175 double* double_out_ptr,
176 const shared_ptr<ProjData>& additive_binwise_correction,
177 const shared_ptr<BinNormalisation> normalise_sptr,
178 const double start_time_of_frame,
179 const double end_time_of_frame,
180 RPC_process_related_viewgrams_type* RPC_process_related_viewgrams,
181 DistributedCachingInformation* caching_info_ptr,
182 int min_timing_pos_num,
183 int max_timing_pos_num);
184
194template <typename CallBackT>
195void LM_distributable_computation(const shared_ptr<ProjMatrixByBin> PM_sptr,
196 const shared_ptr<ProjDataInfo>& proj_data_info_sptr,
197 DiscretisedDensity<3, float>* output_image_ptr,
198 const DiscretisedDensity<3, float>* input_image_ptr,
199 const std::vector<BinAndCorr>& record_cache,
200 const int subset_num,
201 const int num_subsets,
202 const bool has_add,
203 const bool accumulate,
204 double* double_out_ptr,
205 CallBackT&& call_back);
206
211const int AVAILABLE_NOTIFICATION_TAG = 2;
212const int END_ITERATION_TAG = 3;
213const int END_RECONSTRUCTION_TAG = 4;
214const int END_NOTIFICATION_TAG = 5;
215const int BINWISE_CORRECTION_TAG = 6;
216const int BINWISE_MULT_TAG = 66;
217const int REUSE_VIEWGRAM_TAG = 10;
218const int NEW_VIEWGRAM_TAG = 11;
219const int USE_DOUBLE_ARG_TAG = 70;
220const int USE_OUTPUT_IMAGE_ARG_TAG = 71;
221
223
224END_NAMESPACE_STIR
225
226#endif // __stir_recon_buildblock_DISTRIBUTABLE_H__
Declaration of class stir::Bin.
This abstract class is the basis for all image representations.
Definition DiscretisedDensity.h:99
This class implements the logic needed to support caching in a distributed manner.
Definition DistributedCachingInformation.h:63
A class for storing viewgrams which are related by symmetry.
Definition RelatedViewgrams.h:41
void end_distributable_computation()
clean-up after a sequence of computations
Definition distributable.cxx:131
void setup_distributable_computation(const shared_ptr< ProjectorByBinPair > &proj_pair_sptr, const shared_ptr< const ExamInfo > &exam_info_sptr, const shared_ptr< const ProjDataInfo > proj_data_info_sptr, const shared_ptr< const DiscretisedDensity< 3, float > > &target_sptr, const bool zero_seg0_end_planes, const bool distributed_cache_enabled)
set-up parameters before calling distributable_computation()
Definition distributable.cxx:80
void distributable_computation(const shared_ptr< ForwardProjectorByBin > &forward_projector_sptr, const shared_ptr< BackProjectorByBin > &back_projector_sptr, const shared_ptr< DataSymmetriesForViewSegmentNumbers > &symmetries_sptr, DiscretisedDensity< 3, float > *output_image_ptr, const DiscretisedDensity< 3, float > *input_image_ptr, const shared_ptr< ProjData > &proj_data_ptr, const bool read_from_proj_data, int subset_num, int num_subsets, int min_segment_num, int max_segment_num, bool zero_seg0_end_planes, double *double_out_ptr, const shared_ptr< ProjData > &additive_binwise_correction, const shared_ptr< BinNormalisation > normalise_sptr, const double start_time_of_frame, const double end_time_of_frame, RPC_process_related_viewgrams_type *RPC_process_related_viewgrams, DistributedCachingInformation *caching_info_ptr, int min_timing_pos_num, int max_timing_pos_num)
This function essentially implements a loop over segments and all views in the current subset.
Definition distributable.cxx:272
void RPC_process_related_viewgrams_type(const shared_ptr< ForwardProjectorByBin > &forward_projector_sptr, const shared_ptr< BackProjectorByBin > &back_projector_sptr, RelatedViewgrams< float > *measured_viewgrams_ptr, int &count, int &count2, double *log_likelihood_ptr, const RelatedViewgrams< float > *additive_binwise_correction_ptr, const RelatedViewgrams< float > *mult_viewgrams_ptr)
typedef for callback functions for distributable_computation()
Definition distributable.h:93
void LM_distributable_computation(const shared_ptr< ProjMatrixByBin > PM_sptr, const shared_ptr< ProjDataInfo > &proj_data_info_sptr, DiscretisedDensity< 3, float > *output_image_ptr, const DiscretisedDensity< 3, float > *input_image_ptr, const std::vector< BinAndCorr > &record_cache, const int subset_num, const int num_subsets, const bool has_add, const bool accumulate, double *double_out_ptr, CallBackT &&call_back)
This function essentially implements a loop over a cached listmode file.
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast into the stir names...