ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkFastMarchingImageFilterBase.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
19#ifndef itkFastMarchingImageFilterBase_h
20#define itkFastMarchingImageFilterBase_h
21
22#include "itkFastMarchingBase.h"
24#include "itkArray.h"
25#include <bitset>
26
27namespace itk
28{
71template <typename TInput, typename TOutput>
72class ITK_TEMPLATE_EXPORT FastMarchingImageFilterBase : public FastMarchingBase<TInput, TOutput>
73{
74public:
75 ITK_DISALLOW_COPY_AND_MOVE(FastMarchingImageFilterBase);
76
81 using typename Superclass::Traits;
82
84 itkNewMacro(Self);
85
87 itkOverrideGetNameOfClassMacro(FastMarchingImageFilterBase);
88
89
92 using typename Superclass::InputPixelType;
93
96 using typename Superclass::OutputPixelType;
97 using OutputSpacingType = typename OutputImageType::SpacingType;
98 using OutputSizeType = typename OutputImageType::SizeType;
99 using OutputRegionType = typename OutputImageType::RegionType;
100 using OutputPointType = typename OutputImageType::PointType;
101 using OutputDirectionType = typename OutputImageType::DirectionType;
102
103 using NodeType = typename Traits::NodeType;
104 using NodePairType = typename Traits::NodePairType;
105 using NodePairContainerType = typename Traits::NodePairContainerType;
106 using NodePairContainerPointer = typename Traits::NodePairContainerPointer;
107 using NodePairContainerConstIterator = typename Traits::NodePairContainerConstIterator;
108
109 using typename Superclass::LabelType;
110
111 static constexpr unsigned int ImageDimension = Traits::ImageDimension;
112
113
116
119
122
123 class InternalNodeStructure;
124
125
127
128 itkGetModifiableObjectMacro(LabelImage, LabelImageType);
129
138 virtual void
140 {
141 m_OutputRegion = size;
142 }
143 virtual OutputSizeType
145 {
146 return m_OutputRegion.GetSize();
147 }
148 itkSetMacro(OutputRegion, OutputRegionType);
149 itkGetConstReferenceMacro(OutputRegion, OutputRegionType);
150 itkSetMacro(OutputSpacing, OutputSpacingType);
151 itkGetConstReferenceMacro(OutputSpacing, OutputSpacingType);
152 itkSetMacro(OutputDirection, OutputDirectionType);
153 itkGetConstReferenceMacro(OutputDirection, OutputDirectionType);
154 itkSetMacro(OutputOrigin, OutputPointType);
155 itkGetConstReferenceMacro(OutputOrigin, OutputPointType);
156 itkSetMacro(OverrideOutputInformation, bool);
157 itkGetConstReferenceMacro(OverrideOutputInformation, bool);
158 itkBooleanMacro(OverrideOutputInformation);
160protected:
162
163 ~FastMarchingImageFilterBase() override = default;
164
165 void
166 PrintSelf(std::ostream & os, Indent indent) const override;
167
171
177
179 void
181
182 void
184
187
188 [[nodiscard]] IdentifierType
189 GetTotalNumberOfNodes() const override;
190
191 void
192 SetOutputValue(OutputImageType * oImage, const NodeType & iNode, const OutputPixelType & iValue) override;
193
195 const OutputPixelType
196 GetOutputValue(OutputImageType * oImage, const NodeType & iNode) const override;
197
199 unsigned char
200 GetLabelValueForGivenNode(const NodeType & iNode) const override;
201
203 void
204 SetLabelValueForGivenNode(const NodeType & iNode, const LabelType & iLabel) override;
205
207 void
208 UpdateNeighbors(OutputImageType * oImage, const NodeType & iNode) override;
209
211 void
212 UpdateValue(OutputImageType * oImage, const NodeType & iNode) override;
213
216 bool
217 CheckTopology(OutputImageType * oImage, const NodeType & iNode) override;
218 void
222 void
224
226 double
227 Solve(OutputImageType * oImage, const NodeType & iNode, InternalNodeStructureArray & iNeighbors) const;
228
229 //
230 // Functions and variables to check for topology changes (2D/3D only).
231 //
232
233 // Functions/data for the 2-D case
234 void
236 bool
238 [[nodiscard]] bool
239 IsCriticalC1Configuration2D(const std::bitset<9> &) const;
240 [[nodiscard]] bool
241 IsCriticalC2Configuration2D(const std::bitset<9> &) const;
242 [[nodiscard]] bool
243 IsCriticalC3Configuration2D(const std::bitset<9> &) const;
244 [[nodiscard]] bool
245 IsCriticalC4Configuration2D(const std::bitset<9> &) const;
246
249
250 // Functions/data for the 3-D case
251 void
253 [[nodiscard]] bool
254 IsCriticalC1Configuration3D(const std::bitset<8> &) const;
255 [[nodiscard]] unsigned int
256 IsCriticalC2Configuration3D(const std::bitset<8> &) const;
257 bool
259
262
263 // Functions for both 2D/3D cases
264 bool
266 bool
268
270};
271} // end namespace itk
272
273#ifndef ITK_MANUAL_INSTANTIATION
274# include "itkFastMarchingImageFilterBase.hxx"
275#endif
276
277#endif // itkFastMarchingImageFilterBase_h
Array class with size defined at construction time.
Definition itkArray.h:48
Base class for all data objects in ITK.
FastMarchingTraits< TInput, TOutput > Traits
typename Traits::InputPixelType InputPixelType
typename Traits::OutputDomainPointer OutputDomainPointer
typename Traits::InputDomainType InputDomainType
typename Traits::OutputDomainType OutputDomainType
typename Traits::InputDomainPointer InputDomainPointer
FastMarchingBase()
Constructor.
typename Traits::OutputPixelType OutputPixelType
typename Traits::LabelType LabelType
void InitializeOutput(OutputImageType *oImage) override
typename OutputImageType::RegionType OutputRegionType
typename Superclass::OutputDomainPointer OutputImagePointer
bool IsCriticalC1Configuration2D(const std::bitset< 9 > &) const
typename Traits::NodePairContainerType NodePairContainerType
typename Superclass::InputDomainPointer InputImagePointer
typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType
~FastMarchingImageFilterBase() override=default
bool IsCriticalC1Configuration3D(const std::bitset< 8 > &) const
IdentifierType GetTotalNumberOfNodes() const override
Get the total number of nodes in the domain.
bool IsChangeWellComposed3D(const NodeType &) const
double Solve(OutputImageType *oImage, const NodeType &iNode, InternalNodeStructureArray &iNeighbors) const
void GetInternalNodesUsed(OutputImageType *oImage, const NodeType &iNode, InternalNodeStructureArray &ioNodesUsed)
NeighborhoodIterator< LabelImageType > NeighborhoodIteratorType
unsigned char GetLabelValueForGivenNode(const NodeType &iNode) const override
FastMarchingBase< TInput, TOutput > Superclass
Image< unsigned int, ImageDimension > ConnectedComponentImageType
typename ConnectedComponentImageType::Pointer ConnectedComponentImagePointer
FixedArray< InternalNodeStructure, ImageDimension > InternalNodeStructureArray
Image< unsigned char, ImageDimension > LabelImageType
unsigned int IsCriticalC2Configuration3D(const std::bitset< 8 > &) const
void SetLabelValueForGivenNode(const NodeType &iNode, const LabelType &iLabel) override
void SetOutputValue(OutputImageType *oImage, const NodeType &iNode, const OutputPixelType &iValue) override
Set the output value (front value) for a given node.
typename Superclass::InputDomainType InputImageType
typename OutputImageType::PointType OutputPointType
bool IsChangeWellComposed2D(const NodeType &) const
const OutputPixelType GetOutputValue(OutputImageType *oImage, const NodeType &iNode) const override
virtual void SetOutputSize(const OutputSizeType &size)
void PrintSelf(std::ostream &os, Indent indent) const override
void EnlargeOutputRequestedRegion(DataObject *output) override
void UpdateNeighbors(OutputImageType *oImage, const NodeType &iNode) override
typename OutputImageType::DirectionType OutputDirectionType
bool IsCriticalC2Configuration2D(const std::bitset< 9 > &) const
typename LabelImageType::Pointer LabelImagePointer
bool IsCriticalC3Configuration2D(const std::bitset< 9 > &) const
bool CheckTopology(OutputImageType *oImage, const NodeType &iNode) override
bool DoesVoxelChangeViolateWellComposedness(const NodeType &) const
void GenerateOutputInformation() override
typename OutputImageType::SizeType OutputSizeType
typename OutputImageType::SpacingType OutputSpacingType
ConnectedComponentImagePointer m_ConnectedComponentImage
typename Traits::NodePairContainerConstIterator NodePairContainerConstIterator
typename Traits::NodePairContainerPointer NodePairContainerPointer
typename Superclass::OutputDomainType OutputImageType
bool IsCriticalC4Configuration2D(const std::bitset< 9 > &) const
typename Traits::OutputPixelType OutputPixelType
void UpdateValue(OutputImageType *oImage, const NodeType &iNode) override
bool DoesVoxelChangeViolateStrictTopology(const NodeType &) const
typename Traits::LabelType LabelType
Simulate a standard C array with copy semantics.
Templated n-dimensional image class.
Definition itkImage.h:89
Control indentation during Print() invocation.
Definition itkIndent.h:50
Defines iteration of a local N-dimensional neighborhood of pixels across an itk::Image.
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
SizeValueType IdentifierType
Definition itkIntTypes.h:90