STIR  6.2.0
SeparableConvolutionImageFilter.h
Go to the documentation of this file.
1 //
2 //
12 /*
13  Copyright (C) 2002- 2009, Hammersmith Imanet Ltd
14  This file is part of STIR.
15 
16  SPDX-License-Identifier: Apache-2.0
17 
18  See STIR/LICENSE.txt for details
19 */
20 
21 #ifndef __stir_SeparableConvolutionImageFilter_H__
22 #define __stir_SeparableConvolutionImageFilter_H__
23 
26 #include "stir/DataProcessor.h"
28 #include "stir/VectorWithOffset.h"
29 #include <vector>
30 
31 START_NAMESPACE_STIR
32 
33 // TODO!! remove define
34 // currently fixed at 3 because I didn't really have a good idea for the parsing
35 // keywords in n dimensions.
36 //
37 #define num_dimensions 3
38 
79 template <typename elemT>
80 class SeparableConvolutionImageFilter : public RegisteredParsingObject<SeparableConvolutionImageFilter<elemT>,
81  DataProcessor<DiscretisedDensity<3, elemT>>,
82  DataProcessor<DiscretisedDensity<3, elemT>>>
83 {
84 private:
87  DataProcessor<DiscretisedDensity<3, elemT>>>
88  base_type;
89 
90 public:
92  static const char* const registered_name;
93 
96 
98 
105 
107 
108  VectorWithOffset<VectorWithOffset<elemT>> get_filter_coefficients();
109  void set_filter_coefficients(const VectorWithOffset<VectorWithOffset<elemT>>& v);
110  // These methods are made available as VectorWithOffset<VectorWithOffset<elemT>> is not accessable via swig
111  VectorWithOffset<elemT> get_filter_coefficients(const int axis);
112  void set_filter_coefficients(const int axis, const VectorWithOffset<elemT>& v);
114 
115 private:
116  // silly business because KeyParser supports only LIST_OF_DOUBLES
117  // TODO remove
118  std::vector<std::vector<double>> filter_coefficients_for_parsing;
119 
120  VectorWithOffset<VectorWithOffset<elemT>> filter_coefficients;
121 
123 
124  void set_defaults() override;
125  void initialise_keymap() override;
126  bool post_processing() override;
127 
128  Succeeded virtual_set_up(const DiscretisedDensity<num_dimensions, elemT>& image) override;
129  void virtual_apply(DiscretisedDensity<num_dimensions, elemT>& out_density,
130  const DiscretisedDensity<num_dimensions, elemT>& in_density) const override;
131  void virtual_apply(DiscretisedDensity<num_dimensions, elemT>& density) const override;
132 };
133 
134 #undef num_dimensions
135 
136 END_NAMESPACE_STIR
137 
138 #endif
This class implements an n -dimensional ArrayFunctionObject whose operation is separable.
Definition: SeparableArrayFunctionObject.h:41
A templated class for vectors, but with indices starting not from 0.
Definition: ArrayFilter1DUsingConvolution.h:31
Declaration of class stir::SeparableArrayFunctionObject.
Declaration of class stir::DataProcessor.
Base class that defines an interface for classes that do data processing.
Definition: DataProcessor.h:46
defines the stir::DiscretisedDensity class
static const char *const registered_name
Name for parsing registry.
Definition: SeparableConvolutionImageFilter.h:92
defines the stir::VectorWithOffset class
Parent class for all leaves in a RegisteredObject hierarchy that do parsing of parameter files...
Definition: RegisteredParsingObject.h:77
A class derived from DataProcessor for performing separable non-periodic convolutions.
Definition: SeparableConvolutionImageFilter.h:80
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43
Declaration of class stir::RegisteredParsingObject.
This abstract class is the basis for all image representations.
Definition: FBP2DReconstruction.h:35