CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
iPenaltyMarkovRandomField.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 IPENALTYMARKOVRANDOMFIELD_HH
31 #define IPENALTYMARKOVRANDOMFIELD_HH 1
32 
33 #include "vPenalty.hh"
34 #include "sAddonManager.hh"
35 #include "sOutputManager.hh"
36 
37 #define MRF_POTENTIAL_QUADRATIC 0
38 #define MRF_POTENTIAL_RELATIVE_DIFFERENCE 1
39 #define MRF_POTENTIAL_GEMAN_MCCLURE 2
40 #define MRF_POTENTIAL_GREEN 3
41 #define MRF_POTENTIAL_HEBERT_LEAHY 4
42 #define MRF_POTENTIAL_HUBER 5
43 
44 #define MRF_PROXIMITY_NONE 0
45 #define MRF_PROXIMITY_EUCLIDIAN 1
46 #define MRF_PROXIMITY_VOXEL 2
47 //#define MRF_PROXIMITY_EXP_DIST_SQUARED 3
48 
49 #define MRF_SIMILARITY_NONE 0
50 #define MRF_SIMILARITY_BOWSHER 1
51 
52 #define MRF_NEIGHBORHOOD_SPHERE 0
53 #define MRF_NEIGHBORHOOD_BOX 1
54 #define MRF_NEIGHBORHOOD_6_NEAREST 2
55 
56 #define MRF_NOT_DEFINED -1
57 
58 #define MRF_NEIGHBOR_X 0
59 #define MRF_NEIGHBOR_Y 1
60 #define MRF_NEIGHBOR_Z 2
61 
68 {
69  // -------------------------------------------------------------------
70  // Constructor & Destructor
71  public:
72 
87 
88  // -------------------------------------------------------------------
89  // Public member functions
90  public:
91  // Function for automatic insertion (put the class name as the parameter and do not add semi-column at the end of the line)
103  int ReadConfigurationFile(const string& a_configurationFile);
114  int ReadOptionsList(const string& a_optionsList);
127  int LocalPreProcessingStep(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th);
140  FLTNB ComputePenaltyValue(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th);
153  FLTNB ComputeFirstDerivative(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th);
166  FLTNB ComputeSecondDerivative(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th);
178  int BuildSpecificNeighborhood(INTNB a_voxel, int a_th);
179 
180  // -------------------------------------------------------------------
181  // Public Get & Set functions
182  public:
187  inline int GetPotentialType() {return m_potentialType;}
203 
204  // -------------------------------------------------------------------
205  // Private member functions
206  private:
216  void ShowHelpSpecific();
233  int InitializeSpecific();
249  int BuildProximityFactors();
261  int ComputeSimilarityFactors(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th);
262 
263  // -------------------------------------------------------------------
264  // Data members
265  private:
266  // Potential functions
273  // Proximity factors
277  // Similarity factors
282  // Neighborhood
291 };
292 
293 // Class for automatic insertion (set here the visible optimizer's name as the first parameter,
294 // put the class name as the second parameter and do NOT add semi-colon at the end of the line)
296 
297 #endif
298 
int BuildSpecificNeighborhood(INTNB a_voxel, int a_th)
Computes the specific neighborhood of a voxel, m2p_neighborhoodIndices, as well as mp_neighborhoodNbV...
#define FLTNB
Definition: gVariables.hh:81
This class implements the general Markov Random Field kind of penalties.
int BuildProximityFactors()
A function used to build the kernel of the proximity factors.
int LocalPreProcessingStep(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)
A public function computing a local pre-processing step for the penalty.
FLTNB ComputeSecondDerivative(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)
Implementation of the pure virtual vPenalty::ComputeSecondDerivative()
int ReadConfigurationFile(const string &a_configurationFile)
A function used to read options from a configuration file.
FLTNB ComputeFirstDerivative(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)
Implementation of the pure virtual vPenalty::ComputeFirstDerivative()
int InitializeSpecific()
This function is used to initialize specific stuff to the child penalty.
iPenaltyMarkovRandomField()
The constructor of iPenaltyMarkovRandomField.
#define FUNCTION_PENALTY(CLASS)
Definition: vPenalty.hh:303
Declaration of class vPenalty.
This class is designed to generically described any penalty applied to MAP algorithms.
Definition: vPenalty.hh:48
int ReadOptionsList(const string &a_optionsList)
A function used to read options from a list of options.
#define INTNB
Definition: gVariables.hh:92
FLTNB ComputePenaltyValue(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)
Implementation of the pure virtual vPenalty::ComputePenaltyValue()
Declaration of class sOutputManager.
int ComputeSimilarityFactors(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)
Computes the similarity factors of this specific voxel with respect to the similarity type used...
#define CLASS_PENALTY(NAME, CLASS)
Definition: vPenalty.hh:307
~iPenaltyMarkovRandomField()
The destructor of iPenaltyMarkovRandomField.
int CheckSpecificParameters()
A private function used to check the parameters settings specific to the child penalty.
int BuildNeighborhoodKernel()
A function used to build the neighborhood kernel.
void ShowHelpSpecific()
A function used to show help about the child penalty.
Declaration of class sAddonManager.