STIR  6.2.0
DistributedWorker.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 - 2011-02-23, Hammersmith Imanet Ltd
3  Copyright (C) 2014, University College London
4  This file is part of STIR.
5 
6  SPDX-License-Identifier: Apache-2.0
7 
8  See STIR/LICENSE.txt for details
9 */
10 
11 #ifndef __stir_recon_buildblock_DistributedWorker_h__
12 # define __stir_recon_buildblock_DistributedWorker_h__
13 
24 # include "stir/shared_ptr.h"
25 # include "stir/TimedObject.h"
26 //#include "stir/ParsingObject.h"
27 # include "stir/ProjData.h"
30 # include <string>
31 # include <vector>
32 
33 START_NAMESPACE_STIR
34 
35 class ExamInfo;
36 
59 template <class TargetT>
60 class DistributedWorker : public TimedObject //, public ParsingObject
61 {
62 private:
63  double* log_likelihood_ptr;
64  bool zero_seg0_end_planes;
65  shared_ptr<ProjectorByBinPair> proj_pair_sptr;
66  shared_ptr<ExamInfo> exam_info_sptr;
67  shared_ptr<const ProjDataInfo> proj_data_info_sptr;
68  shared_ptr<TargetT> target_sptr;
69 
70  int image_buffer_size; // to save the image_size
71 
72  // cache variables
73  bool cache_enabled;
74  shared_ptr<ProjData> proj_data_ptr;
75  shared_ptr<ProjData> binwise_correction;
76  shared_ptr<ProjData> mult_proj_data_sptr;
77 
78  int my_rank; // rank of the worker
79 
80 public:
81  // Default constructor
83 
84  // Default destructor
86 
90  void start();
91 
92 protected:
96  void set_defaults();
97 
118  void distributable_computation(RPC_process_related_viewgrams_type* RPC_process_related_viewgrams);
119 };
120 
121 END_NAMESPACE_STIR
122 
123 #endif
124 // __DistributedWorker_h__
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
Declaration of the main functions that perform parallel processing.
This implements the Worker for the stir::distributable_computation() function.
Definition: DistributedWorker.h:60
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
Declaration of class stir::ProjData.
base class for all objects which need timers. At the moment, there&#39;s only a CPU timer.
Definition: TimedObject.h:35
declares the stir::TimedObject class
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:273
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
Declares class stir::ProjectorByBinPair.