File: SnakeParameters.h

package info (click to toggle)
itksnap 3.6.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 22,132 kB
  • sloc: cpp: 91,089; ansic: 1,994; sh: 327; makefile: 16
file content (211 lines) | stat: -rw-r--r-- 5,717 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/*=========================================================================

  Program:   ITK-SNAP
  Module:    $RCSfile: SnakeParameters.h,v $
  Language:  C++
  Date:      $Date: 2007/12/30 04:05:15 $
  Version:   $Revision: 1.2 $
  Copyright (c) 2007 Paul A. Yushkevich
  
  This file is part of ITK-SNAP 

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0.txt

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  -----

  Copyright (c) 2003 Insight Software Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.

  This software is distributed WITHOUT ANY WARRANTY; without even
  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  PURPOSE.  See the above copyright notices for more information. 

=========================================================================*/
#ifndef __SnakeParameters_h_
#define __SnakeParameters_h_

#include "itkMacro.h"

// TODO: implement this using AbstractPropertyContainerModel

/**
 * \class SnakeParameters
 * \brief Parameters for the Level Set evolution.
 * Most of these parameters correspond to the terms in LevelSetFunction.
 *
 * \sa itk::LevelSetFunction
 */
class SnakeParameters
{
public:
    virtual ~SnakeParameters() { /*To avoid compiler warning.*/ }
  enum ConstraintsType {
    SAPIRO, SCHLEGEL, TURELLO, USER
  };

  enum SnakeType {
    EDGE_SNAKE, REGION_SNAKE
  };

  enum SolverType {
    PARALLEL_SPARSE_FIELD_SOLVER, SPARSE_FIELD_SOLVER,
    NARROW_BAND_SOLVER, LEGACY_SOLVER, DENSE_SOLVER
  };


  /**
   * Initialize parameters with default values for snake extraction
   * in Edge images
   */
  static SnakeParameters GetDefaultEdgeParameters();

  /**
   * Initialize parameters with default values for snake extraction
   * in Inside/Outside images
   */
  static SnakeParameters GetDefaultInOutParameters();

  /**
   * Initialize parameters with default values for snake extraction
   * in Inside/Outside images
   */
  static SnakeParameters GetDefaultAllZeroParameters();

  // Define a comparison operator
  bool operator ==(const SnakeParameters &p) const;
  bool operator !=(const SnakeParameters &p) const
    { return !((*this) == p); }

  /** Whether we wish to automatically compute optimal time step 
   * in level snake propagation */
  itkGetConstMacro(AutomaticTimeStep,bool);
  void SetAutomaticTimeStep( bool value )
  {
    this->m_AutomaticTimeStep = value;
  }

  /** Time step factor in level snake propagation.  This is is only used if the
   * automatic computation is off, and represents the factor by which the auto
   * time step is multiplied */
  itkGetConstMacro(TimeStepFactor,float);
  void SetTimeStepFactor( float value )
  {
    this->m_TimeStepFactor = value;
  }

  /** Clamp-to-ground parameter.  Obsolete in ITK implementation, kept for
    backward compatibility and regression testing */
  itkGetConstMacro(Ground,float);
  void SetGround( float value )
  {
    this->m_Ground = value;
  }

  /** Whether to clamp or not.  Obsolete in ITK implementation, kept for
    backward compatibility and regression testing */
  itkGetConstMacro(Clamp,bool);
  void SetClamp( bool value )
  {
    this->m_Clamp = value;
  }

  /** Which solver to use to run the equation */
  itkGetConstMacro(Solver,SolverType);
  void SetSolver( SolverType value )
  {
    this->m_Solver = value;
  }

  /** Type of equation (well known parameter sets) */
  itkGetConstMacro(SnakeType,SnakeType);
  void SetSnakeType( SnakeType value )
  {
    this->m_SnakeType = value;
  }

  itkGetConstMacro(PropagationWeight,float);
  void SetPropagationWeight( float value )
  {
    this->m_PropagationWeight = value;
  }
  
  itkGetConstMacro(PropagationSpeedExponent,int);
  void SetPropagationSpeedExponent( int value )
  {
    this->m_PropagationSpeedExponent = value;
  }

  itkGetConstMacro(CurvatureWeight,float);
  void SetCurvatureWeight( float value )
  {
    this->m_CurvatureWeight = value;
  }

  itkGetConstMacro(CurvatureSpeedExponent,int);
  void SetCurvatureSpeedExponent( int value )
  {
    this->m_CurvatureSpeedExponent = value;
  }

  itkGetConstMacro(LaplacianWeight,float);
  void SetLaplacianWeight( float value )
  {
    this->m_LaplacianWeight = value;
  }

  itkGetConstMacro(LaplacianSpeedExponent,int);
  void SetLaplacianSpeedExponent( int value )
  {
    this->m_LaplacianSpeedExponent = value;
  }

  itkGetConstMacro(AdvectionWeight,float);
  void SetAdvectionWeight( float value )
  {
    this->m_AdvectionWeight = value;
  }

  itkGetConstMacro(AdvectionSpeedExponent,int);
  void SetAdvectionSpeedExponent( int value )
  {
    this->m_AdvectionSpeedExponent = value;
  }

private:
  float m_TimeStepFactor;
  float m_Ground;

  SnakeType m_SnakeType;
  bool m_Clamp;

  bool m_AutomaticTimeStep;

  float m_PropagationWeight;
  int m_PropagationSpeedExponent;

  float m_CurvatureWeight;
  int m_CurvatureSpeedExponent;

  float m_LaplacianWeight;
  int m_LaplacianSpeedExponent;

  float m_AdvectionWeight;
  int m_AdvectionSpeedExponent;   

  SolverType m_Solver;
};

#endif // __SnakeParameters_h_