ITK  5.2.0
Insight Toolkit
itkDeformableSimplexMesh3DGradientConstraintForceFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 #include <ITKDeformableMeshExport.h>
29 
30 namespace itk
31 {
33 {
34 public:
35  // voxel coordinates
36  unsigned int m_Vpos[3];
37  // subvoxel coordinates (in cartesian space)
38  double m_Spos[3];
39  // voxel value converted to a double
40  double m_Value;
41  // distance from line origin
42  double m_Distance;
43  // index
44  unsigned int m_Index;
45 
46  ImageVoxel() = default;
47  ImageVoxel(const int * pos, const double * subpos, double val, double dist, unsigned int ind)
48  {
49  this->m_Vpos[0] = pos[0];
50  this->m_Vpos[1] = pos[1];
51  this->m_Vpos[2] = pos[2];
52  this->m_Spos[0] = subpos[0];
53  this->m_Spos[1] = subpos[1];
54  this->m_Spos[2] = subpos[2];
55  this->m_Value = val;
56  this->m_Distance = dist;
57  this->m_Index = ind;
58  }
59 
61  unsigned int
62  GetX() const
63  {
64  return m_Vpos[0];
65  }
67  unsigned int
68  GetY() const
69  {
70  return m_Vpos[1];
71  }
73  unsigned int
74  GetZ() const
75  {
76  return m_Vpos[2];
77  }
79  double
80  GetDistance() const
81  {
82  return m_Distance;
83  }
85  double
86  GetValue() const
87  {
88  return m_Value;
89  }
91 
93  void
94  SetValue(const double val)
95  {
96  m_Value = val;
97  }
98 };
104 {
105 public:
110  enum class SIDE : uint8_t
111  {
112  // half segment in direction
113  NORMAL,
114  // half segment in -direction
115  INVERSE,
116  // complete segment
117  BOTH
118  };
119 };
120 // Define how to print enumeration
121 extern ITKDeformableMesh_EXPORT std::ostream &
123 
136 template <typename TInputMesh, typename TOutputMesh>
138  : public DeformableSimplexMesh3DFilter<TInputMesh, TOutputMesh>
139 {
140 public:
143 
146 
150 
152  itkNewMacro(Self);
153 
156 
158  using InputMeshType = TInputMesh;
159  using OutputMeshType = TOutputMesh;
160 
162  using GradientIndexType = typename Superclass::GradientIndexType;
163  using GradientIndexValueType = typename Superclass::GradientIndexValueType;
164  using GradientType = typename Superclass::GradientType;
165  using GradientImageType = typename Superclass::GradientImageType;
166 
167  /* Mesh pointer definition. */
168  using InputMeshPointer = typename InputMeshType::Pointer;
169  using OutputMeshPointer = typename OutputMeshType::Pointer;
170 
171  using PixelType = typename InputMeshType::PixelType;
172 
175 
180 
182  itkSetMacro(Range, int);
183  itkGetConstMacro(Range, int);
185 
187 #if !defined(ITK_LEGACY_REMOVE)
188 
189  static constexpr SIDEEnum NORMAL = SIDEEnum::NORMAL;
190  static constexpr SIDEEnum INVERSE = SIDEEnum::INVERSE;
191  static constexpr SIDEEnum BOTH = SIDEEnum::BOTH;
192 #endif
193 
197  itkSetConstObjectMacro(Image, OriginalImageType);
198 
199 protected:
203  void
204  operator=(const Self &)
205  {}
206  void
207  PrintSelf(std::ostream & os, Indent indent) const override;
208 
212  void
213  ComputeExternalForce(SimplexMeshGeometry * data, const GradientImageType * gradientImage) override;
214 
218  int m_Range;
219 
220 private:
221  double
222  NextVoxel(const double * pp, int * ic, double * x, double * y, double * z);
223 
224  int
225  Signi(double a);
226 
227  void
228  Clear();
229 
230  // line starting voxel
232  // line voxels in direction
233  std::vector<ImageVoxel *> m_Positive;
234  // line voxels in -direction
235  std::vector<ImageVoxel *> m_Negative;
236 
238 }; // end of class
239 } // namespace itk
240 
241 #ifndef ITK_MANUAL_INSTANTIATION
242 # include "itkDeformableSimplexMesh3DGradientConstraintForceFilter.hxx"
243 #endif
244 
245 #endif /* __DeformableSimplexMesh3DGradientConstraintForceFilter_h */
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::ImageIndexValueType
typename OriginalImageIndexType::IndexValueType ImageIndexValueType
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:178
itk::DeformableSimplexMesh3DFilter::GradientIndexValueType
typename GradientIndexType::IndexValueType GradientIndexValueType
Definition: itkDeformableSimplexMesh3DFilter.h:121
itk::uint8_t
::uint8_t uint8_t
Definition: itkIntTypes.h:29
itkCovariantVector.h
itkConstNeighborhoodIterator.h
itk::DeformableSimplexMesh3DFilter::PointType
typename SimplexMeshGeometry::PointType PointType
Definition: itkDeformableSimplexMesh3DFilter.h:107
itk::MeshSource::OutputMeshPointer
typename OutputMeshType::Pointer OutputMeshPointer
Definition: itkMeshSource.h:69
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:218
itk::DeformableSimplexMesh3DGradientConstraintForceFilterEnums
Contains all enum classes used by the DeformableSimplexMesh3DGradientConstraintForceFilter class.
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:103
itk::ImageVoxel::GetZ
unsigned int GetZ() const
returns voxel Z coordinate (voxel plane)
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:74
itk::MeshToMeshFilter::InputMeshPointer
typename InputMeshType::Pointer InputMeshPointer
Definition: itkMeshToMeshFilter.h:66
itk::ImageVoxel::ImageVoxel
ImageVoxel()=default
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::ImageVoxel::GetValue
double GetValue() const
returns voxel value
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:86
itk::DeformableSimplexMesh3DGradientConstraintForceFilterEnums::SIDE::INVERSE
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::DeformableSimplexMesh3DGradientConstraintForceFilterEnums::SIDE::NORMAL
itk::ImageVoxel::m_Spos
double m_Spos[3]
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:38
itk::DeformableSimplexMesh3DGradientConstraintForceFilterEnums::SIDE
SIDE
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:110
itk::ImageVoxel::m_Value
double m_Value
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:40
itk::MeshToMeshFilter::InputMeshType
TInputMesh InputMeshType
Definition: itkMeshToMeshFilter.h:65
itk::SimplexMeshGeometry
handle geometric properties for vertices of a simplx mesh
Definition: itkSimplexMeshGeometry.h:44
itk::DeformableSimplexMesh3DGradientConstraintForceFilter
Additional to its superclass this class reimplements the external forces methos in which the scan lin...
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:137
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::m_Negative
std::vector< ImageVoxel * > m_Negative
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:235
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::OriginalImagePointer
typename OriginalImageType::ConstPointer OriginalImagePointer
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:179
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageVoxel::ImageVoxel
ImageVoxel(const int *pos, const double *subpos, double val, double dist, unsigned int ind)
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:47
itk::ImageVoxel
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:32
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::m_Positive
std::vector< ImageVoxel * > m_Positive
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:233
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ImageVoxel::m_Index
unsigned int m_Index
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:44
itkDeformableSimplexMesh3DFilter.h
itkMesh.h
itk::ImageVoxel::GetDistance
double GetDistance() const
returns voxel distance to origin
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:80
itk::ImageVoxel::m_Distance
double m_Distance
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:42
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::OriginalImageIndexType
typename OriginalImageType::IndexType OriginalImageIndexType
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:177
itk::ImageVoxel::GetX
unsigned int GetX() const
returns voxel X coordinate (voxel column)
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:62
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::operator=
void operator=(const Self &)
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:204
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::m_Image
OriginalImagePointer m_Image
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:237
itk::CovariantVector
A templated class holding a n-Dimensional covariant vector.
Definition: itkCovariantVector.h:70
itk::ImageVoxel::SetValue
void SetValue(const double val)
returns voxel position
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:94
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::GradientIntensityImagePointer
typename GradientIntensityImageType::Pointer GradientIntensityImagePointer
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:174
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::m_Range
int m_Range
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:218
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::DeformableSimplexMesh3DGradientConstraintForceFilter
DeformableSimplexMesh3DGradientConstraintForceFilter(const Self &)
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:202
itk::DeformableSimplexMesh3DFilter
Three-dimensional deformable model for image segmentation.
Definition: itkDeformableSimplexMesh3DFilter.h:77
itk::DeformableSimplexMesh3DFilter::GradientIndexType
typename GradientImageType::IndexType GradientIndexType
Definition: itkDeformableSimplexMesh3DFilter.h:119
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::m_StartVoxel
ImageVoxel * m_StartVoxel
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:231
SIDE
itk::DeformableSimplexMesh3DGradientConstraintForceFilterEnums::SIDE::BOTH
itk::ImageVoxel::GetY
unsigned int GetY() const
returns voxel Y coordinate (voxel row)
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:68
itk::IndexValueType
signed long IndexValueType
Definition: itkIntTypes.h:90
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::MeshSource::OutputMeshType
TOutputMesh OutputMeshType
Definition: itkMeshSource.h:68
itk::DeformableSimplexMesh3DFilter::PixelType
typename InputMeshType::PixelType PixelType
Definition: itkDeformableSimplexMesh3DFilter.h:110
itk::ImageVoxel::m_Vpos
unsigned int m_Vpos[3]
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:36