ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkDeformableSimplexMesh3DGradientConstraintForceFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkDeformableSimplexMesh3DGradientConstraintForceFilter_h
19 #define __itkDeformableSimplexMesh3DGradientConstraintForceFilter_h
20 
22 #include "itkMesh.h"
24 #include "itkCovariantVector.h"
25 
26 #include <set>
27 #include <vector>
28 namespace itk
29 {
31 {
32 public:
33  // voxel coordinates
34  unsigned int m_Vpos[3];
35  // subvoxel coordinates (in cartesian space)
36  double m_Spos[3];
37  // voxel value converted to a double
38  double m_Value;
39  // distance from line origin
40  double m_Distance;
41  // index
42  unsigned int m_Index;
43 
45  ImageVoxel(int *pos, double *subpos, double val, double dist, unsigned int ind)
46  {
47  this->m_Vpos[0] = pos[0];
48  this->m_Vpos[1] = pos[1];
49  this->m_Vpos[2] = pos[2];
50  this->m_Spos[0] = subpos[0];
51  this->m_Spos[1] = subpos[1];
52  this->m_Spos[2] = subpos[2];
53  this->m_Value = val;
54  this->m_Distance = dist;
55  this->m_Index = ind;
56  }
57 
59  unsigned int GetX(void) const { return m_Vpos[0]; }
61  unsigned int GetY(void) const { return m_Vpos[1]; }
63  unsigned int GetZ(void) const { return m_Vpos[2]; }
65  double GetDistance(void) const { return m_Distance; }
67  double GetValue(void) const { return m_Value; }
69 
71  void SetValue(const double val) { m_Value = val; }
72 };
73 
85 template< typename TInputMesh, typename TOutputMesh >
87  public DeformableSimplexMesh3DFilter< TInputMesh, TOutputMesh >
88 {
89 public:
92 
95 
99 
101  itkNewMacro(Self);
102 
105 
107  typedef TInputMesh InputMeshType;
108  typedef TOutputMesh OutputMeshType;
109 
115 
116  /* Mesh pointer definition. */
117  typedef typename InputMeshType::Pointer InputMeshPointer;
118  typedef typename OutputMeshType::Pointer OutputMeshPointer;
119 
120  typedef typename InputMeshType::PixelType PixelType;
121 
124 
129 
131  itkSetMacro(Range, int);
132  itkGetConstMacro(Range, int);
134 
135  // full segment or half segment direction
136  enum SIDE {
137  // half segment in direction
139  // half segment in -direction
141  // complete segment
143  };
144 
148  itkSetConstObjectMacro(Image, OriginalImageType);
149 
150 protected:
154  void operator=(const Self &){}
155  void PrintSelf(std::ostream & os, Indent indent) const;
156 
160  virtual void ComputeExternalForce(SimplexMeshGeometry *data, const GradientImageType *gradientImage);
161 
165  int m_Range;
166 
167 private:
168  double NextVoxel(const double *pp, int *ic, double *x, double *y, double *z);
169 
170  int Signi(double a);
171 
172  void Clear();
173 
174  // line starting voxel
176  // line voxels in direction
177  std::vector< ImageVoxel * > m_Positive;
178  // line voxels in -direction
179  std::vector< ImageVoxel * > m_Negative;
180 
182 }; // end of class
183 } // namespace itk
184 
185 #ifndef ITK_MANUAL_INSTANTIATION
186 #include "itkDeformableSimplexMesh3DGradientConstraintForceFilter.hxx"
187 #endif
188 
189 #endif /* __DeformableSimplexMesh3DGradientConstraintForceFilter_h */
ImageVoxel(int *pos, double *subpos, double val, double dist, unsigned int ind)
Light weight base class for most itk classes.
void PrintSelf(std::ostream &os, Indent indent) const
Three-dimensional deformable model for image segmentation.
double GetValue(void) const
returns voxel value
signed long IndexValueType
Definition: itkIntTypes.h:150
void SetValue(const double val)
returns voxel position
unsigned int GetX(void) const
returns voxel X coordinate (voxel column)
Superclass::IndexType IndexType
Definition: itkImage.h:122
GradientIndexType::IndexValueType GradientIndexValueType
unsigned int GetY(void) const
returns voxel Y coordinate (voxel row)
unsigned int GetZ(void) const
returns voxel Z coordinate (voxel plane)
handle geometric properties for vertices of a simplx mesh
virtual void ComputeExternalForce(SimplexMeshGeometry *data, const GradientImageType *gradientImage)
double GetDistance(void) const
returns voxel distance to origin
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Additional to its superclass this class reimplemets the external forces methos in which the scan line...
double NextVoxel(const double *pp, int *ic, double *x, double *y, double *z)
Templated n-dimensional image class.
Definition: itkImage.h:75