ITK  5.0.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 
44  ImageVoxel() = default;
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() const { return m_Vpos[0]; }
61  unsigned int GetY() const { return m_Vpos[1]; }
63  unsigned int GetZ() const { return m_Vpos[2]; }
65  double GetDistance() const { return m_Distance; }
67  double GetValue() 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  using InputMeshType = TInputMesh;
108  using OutputMeshType = TOutputMesh;
109 
111  using GradientIndexType = typename Superclass::GradientIndexType;
112  using GradientIndexValueType = typename Superclass::GradientIndexValueType;
113  using GradientType = typename Superclass::GradientType;
114  using GradientImageType = typename Superclass::GradientImageType;
115 
116  /* Mesh pointer definition. */
117  using InputMeshPointer = typename InputMeshType::Pointer;
118  using OutputMeshPointer = typename OutputMeshType::Pointer;
119 
120  using PixelType = typename InputMeshType::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
142  BOTH
143  };
144 
148  itkSetConstObjectMacro(Image, OriginalImageType);
149 
150 protected:
154  void operator=(const Self &){}
155  void PrintSelf(std::ostream & os, Indent indent) const override;
156 
160  void ComputeExternalForce(SimplexMeshGeometry *data, const GradientImageType *gradientImage) override;
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.
Three-dimensional deformable model for image segmentation.
TOutputMesh OutputMeshType
Definition: itkMeshSource.h:68
unsigned int GetY() const
returns voxel Y coordinate (voxel row)
typename GradientImageType::IndexType GradientIndexType
typename SimplexMeshGeometry::PointType PointType
unsigned int GetX() const
returns voxel X coordinate (voxel column)
void SetValue(const double val)
returns voxel position
double GetDistance() const
returns voxel distance to origin
unsigned int GetZ() const
returns voxel Z coordinate (voxel plane)
typename InputMeshType::Pointer InputMeshPointer
signed long IndexValueType
Definition: itkIntTypes.h:90
typename GradientIndexType::IndexValueType GradientIndexValueType
typename OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:69
handle geometric properties for vertices of a simplx mesh
ImageVoxel()=default
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...
A templated class holding a n-Dimensional covariant vector.
Templated n-dimensional image class.
Definition: itkImage.h:75