STIR  6.2.0
NonseparableSpatiallyVaryingFilters.h
Go to the documentation of this file.
1 //
2 //
16 /*
17  Copyright (C) 2000- 2007, Hammersmith Imanet
18  SPDX-License-Identifier: Apache-2.0
19  See STIR/LICENSE.txt for details
20 */
21 
22 #ifndef __stir_NonseparableSpatiallyVaryingFilters_H__
23 #define __stir_NonseparableSpatiallyVaryingFilters_H__
24 
27 #include "stir/DataProcessor.h"
29 #include "stir/VectorWithOffset.h"
30 #include "stir/ProjData.h"
31 #include "stir_experimental/ArrayFilter2DUsingConvolution.h"
32 #include "stir_experimental/ArrayFilter3DUsingConvolution.h"
33 
34 #include "stir/shared_ptr.h"
35 
36 START_NAMESPACE_STIR
37 
38 // TODO!! remove define
39 
40 #define num_dimensions 3
41 
42 template <typename elemT>
43 class NonseparableSpatiallyVaryingFilters
44  : public RegisteredParsingObject<NonseparableSpatiallyVaryingFilters<elemT>,
45  DataProcessor<DiscretisedDensity<num_dimensions, elemT>>,
46  DataProcessor<DiscretisedDensity<num_dimensions, elemT>>>
47 {
48 private:
49  typedef RegisteredParsingObject<NonseparableSpatiallyVaryingFilters<elemT>,
50  DataProcessor<DiscretisedDensity<num_dimensions, elemT>>,
51  DataProcessor<DiscretisedDensity<num_dimensions, elemT>>>
52  base_type;
53 
54 public:
55  static const char* const registered_name;
56 
58  NonseparableSpatiallyVaryingFilters();
59 
60  NonseparableSpatiallyVaryingFilters(string proj_data_filename,
61  string attenuation_proj_data_filename,
62  const Array<2, float>& filter_coefficients,
63  shared_ptr<ProjData> proj_data_ptr,
64  shared_ptr<ProjData> attenuation_proj_data_ptr,
65  DiscretisedDensity<3, float>* initial_image,
66  DiscretisedDensity<3, float>* sensitivity_image,
67  DiscretisedDensity<3, float>* precomputed_coefficients_image,
68  DiscretisedDensity<3, float>* normalised_bck_image,
69  int mask_size,
70  int num_dim);
71 
72 private:
73  int mask_size;
74  Array<2, float> filter_coefficients_for_parsing;
75  mutable Array<2, float> filter_coefficients;
76 
77  shared_ptr<ProjData> proj_data_ptr;
78  string proj_data_filename;
79 
80  shared_ptr<ProjData> attenuation_proj_data_ptr;
81  string attenuation_proj_data_filename;
82 
83  DiscretisedDensity<3, float>* initial_image;
84  string initial_image_filename;
85 
86  DiscretisedDensity<3, float>* sensitivity_image;
87  string sensitivity_image_filename;
88 
89  DiscretisedDensity<3, float>* precomputed_coefficients_image;
90  string precomputed_coefficients_filename;
91 
92  DiscretisedDensity<3, float>* normalised_bck_image;
93  string normalised_bck_filename;
94  int num_dim;
95  int number_of_coefficients_before_padding;
96 
97  Succeeded virtual_set_up(const DiscretisedDensity<num_dimensions, elemT>& density);
98  // new
99  void virtual_apply(DiscretisedDensity<num_dimensions, elemT>& out_density,
100  const DiscretisedDensity<num_dimensions, elemT>& in_density) const;
101  void virtual_apply(DiscretisedDensity<num_dimensions, elemT>& density) const;
102  void precalculate_filter_coefficients_2D(
103  VectorWithOffset<VectorWithOffset<VectorWithOffset<shared_ptr<ArrayFilter2DUsingConvolution<float>>>>>&
104  all_filter_coefficients,
105  DiscretisedDensity<3, elemT>* in_density) const;
106 
107  virtual void set_defaults();
108  virtual void initialise_keymap();
109 
110  virtual bool post_processing();
111 };
112 
113 #undef num_dimensions
114 
115 END_NAMESPACE_STIR
116 
117 #endif
Declaration of class stir::DataProcessor.
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
defines the stir::DiscretisedDensity class
Declaration of class stir::ProjData.
This is a messy first attempt to design spatially varying filter Given the kernel which in this case ...
defines the stir::VectorWithOffset class
Declaration of class stir::RegisteredParsingObject.