CASToR  2.0
Tomographic Reconstruction (PET/SPECT/CT)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vImageConvolver.hh
Go to the documentation of this file.
1 /*
2 This file is part of CASToR.
3 
4  CASToR is free software: you can redistribute it and/or modify it under the
5  terms of the GNU General Public License as published by the Free Software
6  Foundation, either version 3 of the License, or (at your option) any later
7  version.
8 
9  CASToR is distributed in the hope that it will be useful, but WITHOUT ANY
10  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  details.
13 
14  You should have received a copy of the GNU General Public License along with
15  CASToR (in file GNU_GPL.TXT). If not, see <http://www.gnu.org/licenses/>.
16 
17 Copyright 2017-2018 all CASToR contributors listed below:
18 
19  --> current contributors: Thibaut MERLIN, Simon STUTE, Didier BENOIT, Claude COMTAT, Marina FILIPOVIC, Mael MILLARDET
20  --> past contributors: Valentin VIELZEUF
21 
22 This is CASToR version 2.0.
23 */
24 
31 #ifndef VIMAGECONVOLVER_HH
32 #define VIMAGECONVOLVER_HH 1
33 
34 #include "gVariables.hh"
35 #include "gOptions.hh"
36 
37 class oImageSpace;
39 
59 {
60  // -----------------------------------------------------------------------------------------
61  // Constructor & Destructor
62  public:
77  virtual ~vImageConvolver();
78 
79 
80  // -----------------------------------------------------------------------------------------
81  // Public member functions
82  public:
91  int CheckParameters();
101  int Initialize();
112  int ApplyConvolution(FLTNB* ap_image);
124  int ApplyConvolutionTranspose(FLTNB* ap_image);
125 
126 
127  // -----------------------------------------------------------------------------------------
128  // Private member functions
129  private:
137  void CopyToPaddedImage(FLTNB* ap_inputImage);
148  virtual int Convolve(FLTNB* ap_outputImage);
160  virtual int ConvolveTranspose(FLTNB* ap_outputImage);
161 
162 
163  // -----------------------------------------------------------------------------------------
164  // Pure virtual public member functions that need to be implemented by children
165  public:
176  virtual int ReadConfigurationFile(const string& a_fileOptions) = 0;
187  virtual int ReadOptionsList(const string& a_listOptions) = 0;
196  virtual void ShowHelp() = 0;
197 
198 
199  // -----------------------------------------------------------------------------------------
200  // Pure virtual private member functions that need to be implemented by children
201  private:
210  virtual int CheckSpecificParameters() = 0;
222  virtual int BuildConvolutionKernel() = 0;
223 
224 
225  // -----------------------------------------------------------------------------------------
226  // Public Get & Set functions
227  public:
233  inline void SetVerbose(int a_verbose)
234  {m_verbose = a_verbose;}
240  inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
241  {mp_ImageDimensionsAndQuantification = ap_ImageDimensionsAndQuantification;}
242 
243  // -----------------------------------------------------------------------------------------
244  // Data members
245  protected:
246  // Standards
249  int m_verbose;
250  // Booleans
251  bool m_checked;
254  // Padded image
264  // Convolution kernel
270 };
271 
272 
273 // ----------------------------------------------------------------------
274 // Part of code that manages the auto declaration of children classes
275 // ----------------------------------------------------------------------
276 
277 // Macro for the function that creates the object
278 #define FUNCTION_IMAGE_CONVOLVER(CLASS) \
279  static vImageConvolver *make_image_convolver() { return new CLASS(); };
280 
281 // Macro for the class that links the appropriate function to the map of objects
282 #define CLASS_IMAGE_CONVOLVER(NAME,CLASS) \
283  class NAME##ImageConvolverCreator \
284  { \
285  public: \
286  NAME##ImageConvolverCreator() \
287  { sAddonManager::GetInstance()->mp_listOfImageConvolvers[#NAME] = CLASS::make_image_convolver; } \
288  }; \
289  static NAME##ImageConvolverCreator ImageConvolverCreator##NAME;
290 
291 #endif
This header file is mainly used to declare some macro definitions and all includes needed from the st...
#define FLTNB
Definition: gVariables.hh:81
virtual int ConvolveTranspose(FLTNB *ap_outputImage)
A private function used to apply the transpose convolution on the padded image to the provided output...
int Initialize()
A public function used to initialize the module.
virtual int ReadConfigurationFile(const string &a_fileOptions)=0
A function used to read options from a configuration file.
virtual int BuildConvolutionKernel()=0
A private function used to build the convolution kernel specific to the child convolver.
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
int CheckParameters()
A public function used to check the parameters settings.
virtual void ShowHelp()=0
A function used to show help about the child module.
int ApplyConvolutionTranspose(FLTNB *ap_image)
A public function used to apply the transpose convolution module on the provided image.
virtual ~vImageConvolver()
The destructor of vImageConvolver.
vImageConvolver()
The constructor of vImageConvolver.
#define INTNB
Definition: gVariables.hh:92
int ApplyConvolution(FLTNB *ap_image)
A public function used to apply the convolution module on the provided image.
virtual int CheckSpecificParameters()=0
A private function used to check the parameters settings specific to the child convolver.
This class holds all the matrices in the image domain that can be used in the algorithm: image...
Definition: oImageSpace.hh:61
This class is designed to manage all dimensions and quantification related stuff. ...
virtual int Convolve(FLTNB *ap_outputImage)
A private function used to apply the convolution on the padded image to the provided output image...
This file is used for all kind of different functions designed for options parsing and ASCII file rea...
void SetVerbose(int a_verbose)
Set the member m_verboseLevel to the provided value.
virtual int ReadOptionsList(const string &a_listOptions)=0
A function used to read options from a list of options.
void CopyToPaddedImage(FLTNB *ap_inputImage)
A private function used to copy the provided image into the padded buffer.
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the member mp_ImageDimensionsAndQuantification to the provided value.
This abstract class is the generic image convolver class used by the oImageConvolverManager.