ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkBinaryMask3DMeshSource.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 itkBinaryMask3DMeshSource_h
19#define itkBinaryMask3DMeshSource_h
20
21#include "vnl/vnl_matrix_fixed.h"
22#include "itkMesh.h"
24#include "itkTriangleCell.h"
25#include "itkCovariantVector.h"
28
29namespace itk
30{
68template <typename TInputImage, typename TOutputMesh>
69class ITK_TEMPLATE_EXPORT BinaryMask3DMeshSource : public ImageToMeshFilter<TInputImage, TOutputMesh>
70{
71public:
72 ITK_DISALLOW_COPY_AND_MOVE(BinaryMask3DMeshSource);
73
79
81 itkNewMacro(Self);
82
84 itkOverrideGetNameOfClassMacro(BinaryMask3DMeshSource);
85
87 using OutputMeshType = TOutputMesh;
88 using OMeshTraits = typename OutputMeshType::MeshTraits;
89 using OPointType = typename OutputMeshType::PointType;
90 using OPixelType = typename OMeshTraits::PixelType;
91
93 using OutputMeshPointer = typename OutputMeshType::Pointer;
94 using CellTraits = typename OutputMeshType::CellTraits;
95 using PointsContainerPointer = typename OutputMeshType::PointsContainerPointer;
96 using PointsContainer = typename OutputMeshType::PointsContainer;
97 using CellsContainerPointer = typename OutputMeshType::CellsContainerPointer;
98 using CellsContainer = typename OutputMeshType::CellsContainer;
101
106 using TriCellAutoPointer = typename TriCell::SelfAutoPointer;
107
109 using InputImageType = TInputImage;
110 using InputImagePointer = typename InputImageType::Pointer;
111 using InputImageConstPointer = typename InputImageType::ConstPointer;
112 using InputPixelType = typename InputImageType::PixelType;
113 using SpacingType = typename InputImageType::SpacingType;
114 using OriginType = typename InputImageType::PointType;
115 using RegionType = typename InputImageType::RegionType;
116 using SizeType = typename InputImageType::SizeType;
117
119 using InputImageIndexType = typename InputImageType::IndexType;
120
122
125
126 itkSetMacro(ObjectValue, InputPixelType);
127
128 itkGetConstMacro(NumberOfNodes, SizeValueType);
129 itkGetConstMacro(NumberOfCells, SizeValueType);
130
133 virtual void
134 SetInput(const InputImageType * image);
135
136 void
138 {
139 if (iRegion != m_RegionOfInterest)
140 {
141 this->m_RegionOfInterest = iRegion;
143 this->Modified();
144 }
145 }
146
147 itkGetConstReferenceMacro(RegionOfInterest, RegionType);
148
149protected:
152 void
153 PrintSelf(std::ostream & os, Indent indent) const override;
154
155 void
156 GenerateData() override;
157
158
161
162 void
164 {} // do nothing override
165
166private:
167 using InputImageSizeType = typename InputImageType::SizeType;
168
169 void
171
172 void
173 XFlip(unsigned char * x); // 7 kinds of transformation
174
175 void
176 YFlip(unsigned char * x);
177
178 void
179 ZFlip(unsigned char * x);
180
181 void
182 XRotation(unsigned char * x);
183
184 void
185 YRotation(unsigned char * x);
186
187 void
188 ZRotation(unsigned char * x);
189
190 void
191 inverse(unsigned char * x);
192
193 void
194 InitializeLUT(); // initialize the look up table before the mesh
195 // construction
196
197 void
198 AddCells(unsigned char celltype, unsigned char celltran, int index);
199
200 void
201 AddNodes(int index,
202 unsigned char * nodesid,
203 IdentifierType * globalnodesid,
204 IdentifierType ** currentrowtmp,
205 IdentifierType ** currentframetmp);
206
207 void
208 CellTransfer(unsigned char * nodesid, unsigned char celltran);
209
211 SearchThroughLastRow(int index, int start, int end);
212
214 SearchThroughLastFrame(int index, int start, int end);
215
216 unsigned char m_LUT[256][2]{}; // the two lookup tables
217
220
225
228 int m_LastRowNum{ 0 };
230 int m_CurrentRowNum{ 200 };
231 int m_CurrentFrameNum{ 2000 };
232 unsigned char m_AvailableNodes[14]{};
233
234 double m_LocationOffset[14][3]{};
235
238
239 int m_NodeLimit{ 2000 };
240 int m_CellLimit{ 4000 };
241 int m_ImageWidth{ 0 };
243 int m_ImageDepth{ 0 };
244 int m_ColFlag{ 0 };
245 int m_RowFlag{ 0 };
246 int m_FrameFlag{ 0 };
250
251 unsigned char m_PointFound{ 0 };
253
259};
260} // end namespace itk
261
262#ifndef ITK_MANUAL_INSTANTIATION
263# include "itkBinaryMask3DMeshSource.hxx"
264#endif
265
266#endif
typename OutputMeshType::PointsContainerPointer PointsContainerPointer
typename InputImageType::Pointer InputImagePointer
typename OutputMeshType::PointType OPointType
typename InputImageType::RegionType RegionType
typename InputImageType::PointType OriginType
typename OutputMeshType::CellsContainerPointer CellsContainerPointer
typename OutputMeshType::PointsContainer PointsContainer
void XRotation(unsigned char *x)
TriangleCell< TCellInterface > TriCell
virtual void SetInput(const InputImageType *image)
void YRotation(unsigned char *x)
void inverse(unsigned char *x)
ImageRegionConstIterator< InputImageType > InputImageIterator
typename OutputMeshType::MeshTraits OMeshTraits
typename InputImageType::ConstPointer InputImageConstPointer
CellInterface< OPixelType, CellTraits > TCellInterface
void SetRegionOfInterest(const RegionType &iRegion)
typename OutputMeshType::CellTraits CellTraits
void XFlip(unsigned char *x)
void ZRotation(unsigned char *x)
typename InputImageType::IndexType InputImageIndexType
void GenerateData() override
typename InputImageType::SizeType SizeType
typename OutputMeshType::CellsContainer CellsContainer
ImageToMeshFilter< TInputImage, TOutputMesh > Superclass
typename TriCell::SelfAutoPointer TriCellAutoPointer
CovariantVector< int, 2 > intVector
typename InputImageType::SpacingType SpacingType
typename InputImageType::SizeType InputImageSizeType
IdentifierType SearchThroughLastFrame(int index, int start, int end)
typename OMeshTraits::PixelType OPixelType
typename OutputMeshType::Pointer OutputMeshPointer
typename InputImageType::PixelType InputPixelType
CovariantVector< double, 2 > doubleVector
IdentifierType SearchThroughLastRow(int index, int start, int end)
void CellTransfer(unsigned char *nodesid, unsigned char celltran)
void PrintSelf(std::ostream &os, Indent indent) const override
void YFlip(unsigned char *x)
void AddNodes(int index, unsigned char *nodesid, IdentifierType *globalnodesid, IdentifierType **currentrowtmp, IdentifierType **currentframetmp)
void AddCells(unsigned char celltype, unsigned char celltran, int index)
SmartPointer< const Self > ConstPointer
void ZFlip(unsigned char *x)
An abstract interface for cells.
A templated class holding a n-Dimensional covariant vector.
A multi-dimensional iterator templated over image type that walks a region of pixels.
void SetInput(unsigned int idx, const InputImageType *input)
Control indentation during Print() invocation.
Definition itkIndent.h:50
virtual void Modified() const
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
SizeValueType IdentifierType
Definition itkIntTypes.h:90
unsigned long SizeValueType
Definition itkIntTypes.h:86