CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
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-2019 all CASToR contributors listed below:
18 
19  --> Didier BENOIT, Claude COMTAT, Marina FILIPOVIC, Thibaut MERLIN, Mael MILLARDET, Simon STUTE, Valentin VIELZEUF
20 
21 This is CASToR version 3.0.
22 */
23 
30 #ifndef VIMAGECONVOLVER_HH
31 #define VIMAGECONVOLVER_HH 1
32 
33 #include "gVariables.hh"
34 #include "gOptions.hh"
35 
36 class oImageSpace;
38 
58 {
59  // -----------------------------------------------------------------------------------------
60  // Constructor & Destructor
61  public:
76  virtual ~vImageConvolver();
77 
78 
79  // -----------------------------------------------------------------------------------------
80  // Public member functions
81  public:
90  int CheckParameters();
100  int Initialize();
111  int ApplyConvolution(FLTNB* ap_image);
123  int ApplyConvolutionTranspose(FLTNB* ap_image);
124 
125 
126  // -----------------------------------------------------------------------------------------
127  // Private member functions
128  private:
136  void CopyToPaddedImage(FLTNB* ap_inputImage);
147  virtual int Convolve(FLTNB* ap_outputImage);
159  virtual int ConvolveTranspose(FLTNB* ap_outputImage);
160 
161 
162  // -----------------------------------------------------------------------------------------
163  // Pure virtual public member functions that need to be implemented by children
164  public:
175  virtual int ReadConfigurationFile(const string& a_fileOptions) = 0;
186  virtual int ReadOptionsList(const string& a_listOptions) = 0;
195  virtual void ShowHelp() = 0;
196 
197 
198  // -----------------------------------------------------------------------------------------
199  // Pure virtual private member functions that need to be implemented by children
200  private:
209  virtual int CheckSpecificParameters() = 0;
221  virtual int BuildConvolutionKernel() = 0;
222 
223 
224  // -----------------------------------------------------------------------------------------
225  // Public Get & Set functions
226  public:
232  inline void SetVerbose(int a_verbose)
233  {m_verbose = a_verbose;}
239  inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
240  {mp_ImageDimensionsAndQuantification = ap_ImageDimensionsAndQuantification;}
241 
242  // -----------------------------------------------------------------------------------------
243  // Data members
244  protected:
245  // Standards
248  int m_verbose;
249  // Booleans
250  bool m_checked;
253  // Padded image
263  // Convolution kernel
269 };
270 
271 
272 // ----------------------------------------------------------------------
273 // Part of code that manages the auto declaration of children classes
274 // ----------------------------------------------------------------------
275 
276 // Macro for the function that creates the object
277 #define FUNCTION_IMAGE_CONVOLVER(CLASS) \
278  static vImageConvolver *make_image_convolver() { return new CLASS(); };
279 
280 // Macro for the class that links the appropriate function to the map of objects
281 #define CLASS_IMAGE_CONVOLVER(NAME,CLASS) \
282  class NAME##ImageConvolverCreator \
283  { \
284  public: \
285  NAME##ImageConvolverCreator() \
286  { sAddonManager::GetInstance()->mp_listOfImageConvolvers[#NAME] = CLASS::make_image_convolver; } \
287  }; \
288  static NAME##ImageConvolverCreator ImageConvolverCreator##NAME;
289 
290 #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:60
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.