ITK  5.4.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  * https://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 
99  inline friend std::ostream &
100  operator<<(std::ostream & os, const ImageVoxel & val)
101  {
102  os << "Vpos: " << val.m_Vpos << std::endl;
103  os << "Spos: " << val.m_Spos << std::endl;
104  os << "Value: " << val.m_Value << std::endl;
105  os << "Distance: " << val.m_Distance << std::endl;
106  os << "Index: " << val.m_Index << std::endl;
107 
108  return os;
109  }
110 };
116 {
117 public:
122  enum class SIDE : uint8_t
123  {
124  // half segment in direction
125  NORMAL,
126  // half segment in -direction
127  INVERSE,
128  // complete segment
129  BOTH
130  };
131 };
132 // Define how to print enumeration
133 extern ITKDeformableMesh_EXPORT std::ostream &
135 
148 template <typename TInputMesh, typename TOutputMesh>
150  : public DeformableSimplexMesh3DFilter<TInputMesh, TOutputMesh>
151 {
152 public:
155 
158 
162 
164  itkNewMacro(Self);
165 
167  itkOverrideGetNameOfClassMacro(DeformableSimplexMesh3DGradientConstraintForceFilter);
168 
170  using InputMeshType = TInputMesh;
171  using OutputMeshType = TOutputMesh;
172 
173  using typename Superclass::PointType;
174  using typename Superclass::GradientIndexType;
175  using typename Superclass::GradientIndexValueType;
176  using typename Superclass::GradientType;
177  using typename Superclass::GradientImageType;
178 
179  /* Mesh pointer definition. */
182 
183  using PixelType = typename InputMeshType::PixelType;
184 
187 
192 
194  itkSetMacro(Range, int);
195  itkGetConstMacro(Range, int);
199 #if !defined(ITK_LEGACY_REMOVE)
200 
201  static constexpr SIDEEnum NORMAL = SIDEEnum::NORMAL;
202  static constexpr SIDEEnum INVERSE = SIDEEnum::INVERSE;
203  static constexpr SIDEEnum BOTH = SIDEEnum::BOTH;
204 #endif
205 
209  itkSetConstObjectMacro(Image, OriginalImageType);
210 
211 protected:
215  void
216  operator=(const Self &)
217  {}
218  void
219  PrintSelf(std::ostream & os, Indent indent) const override;
220 
224  void
225  ComputeExternalForce(SimplexMeshGeometry * data, const GradientImageType * gradientImage) override;
226 
230  int m_Range{};
231 
232 private:
233  double
234  NextVoxel(const double * pp, int * ic, double * x, double * y, double * z);
235 
236  int
237  Signi(double a);
238 
239  void
240  Clear();
241 
242  // line starting voxel
243  ImageVoxel * m_StartVoxel{};
244  // line voxels in direction
245  std::vector<ImageVoxel *> m_Positive{};
246  // line voxels in -direction
247  std::vector<ImageVoxel *> m_Negative{};
248 
250 }; // end of class
251 } // namespace itk
252 
253 #ifndef ITK_MANUAL_INSTANTIATION
254 # include "itkDeformableSimplexMesh3DGradientConstraintForceFilter.hxx"
255 #endif
256 
257 #endif /* __DeformableSimplexMesh3DGradientConstraintForceFilter_h */
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::ImageIndexValueType
typename OriginalImageIndexType::IndexValueType ImageIndexValueType
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:190
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itkCovariantVector.h
itkConstNeighborhoodIterator.h
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:216
itk::ImageVoxel::operator<<
friend std::ostream & operator<<(std::ostream &os, const ImageVoxel &val)
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:100
itk::DeformableSimplexMesh3DGradientConstraintForceFilterEnums
Contains all enum classes used by the DeformableSimplexMesh3DGradientConstraintForceFilter class.
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:115
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:122
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 simplex mesh
Definition: itkSimplexMeshGeometry.h:44
itk::DeformableSimplexMesh3DGradientConstraintForceFilter
Additional to its superclass this class reimplements the external forces methods in which the scan li...
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:149
itk::IndexValueType
long IndexValueType
Definition: itkIntTypes.h:90
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::OriginalImagePointer
typename OriginalImageType::ConstPointer OriginalImagePointer
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:191
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::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
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:189
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:216
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:186
itk::DeformableSimplexMesh3DGradientConstraintForceFilter::DeformableSimplexMesh3DGradientConstraintForceFilter
DeformableSimplexMesh3DGradientConstraintForceFilter(const Self &)
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:214
itk::DeformableSimplexMesh3DFilter
Three-dimensional deformable model for image segmentation.
Definition: itkDeformableSimplexMesh3DFilter.h:77
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
SIDE
itk::DeformableSimplexMesh3DGradientConstraintForceFilterEnums::SIDE::BOTH
itk::ImageVoxel::GetY
unsigned int GetY() const
returns voxel Y coordinate (voxel row)
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:68
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::MeshSource::OutputMeshType
TOutputMesh OutputMeshType
Definition: itkMeshSource.h:68
itk::DeformableSimplexMesh3DFilter::PixelType
typename InputMeshType::PixelType PixelType
Definition: itkDeformableSimplexMesh3DFilter.h:110
itk::pp
*par Constraints *The filter requires an image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating so it cannot multithread for data other than in Anisotropic Diffusion of Multivalued Images *with Application to Color IEEE Transactions on Image No pp
Definition: itkVectorGradientMagnitudeImageFilter.h:119
itk::ImageVoxel::m_Vpos
unsigned int m_Vpos[3]
Definition: itkDeformableSimplexMesh3DGradientConstraintForceFilter.h:36