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
188
189 [[nodiscard]] IdentifierType
190 GetTotalNumberOfNodes() const override;
191
192 void
193 SetOutputValue(OutputImageType * oImage, const NodeType & iNode, const OutputPixelType & iValue) override;
194
196 const OutputPixelType
197 GetOutputValue(OutputImageType * oImage, const NodeType & iNode) const override;
198
200 unsigned char
201 GetLabelValueForGivenNode(const NodeType & iNode) const override;
202
204 void
205 SetLabelValueForGivenNode(const NodeType & iNode, const LabelType & iLabel) override;
206
208 void
209 UpdateNeighbors(OutputImageType * oImage, const NodeType & iNode) override;
210
212 void
213 UpdateValue(OutputImageType * oImage, const NodeType & iNode) override;
214
217 bool
218 CheckTopology(OutputImageType * oImage, const NodeType & iNode) override;
219 void
223 void
225
227 double
228 Solve(OutputImageType * oImage, const NodeType & iNode, InternalNodeStructureArray & iNeighbors) const;
229
230 //
231 // Functions and variables to check for topology changes (2D/3D only).
232 //
233
234 // Functions/data for the 2-D case
235 void
237 bool
239 [[nodiscard]] bool
240 IsCriticalC1Configuration2D(const std::bitset<9> &) const;
241 [[nodiscard]] bool
242 IsCriticalC2Configuration2D(const std::bitset<9> &) const;
243 [[nodiscard]] bool
244 IsCriticalC3Configuration2D(const std::bitset<9> &) const;
245 [[nodiscard]] bool
246 IsCriticalC4Configuration2D(const std::bitset<9> &) const;
247
250
251 // Functions/data for the 3-D case
252 void
254 [[nodiscard]] bool
255 IsCriticalC1Configuration3D(const std::bitset<8> &) const;
256 [[nodiscard]] unsigned int
257 IsCriticalC2Configuration3D(const std::bitset<8> &) const;
258 bool
260
263
264 // Functions for both 2D/3D cases
265 bool
267 bool
269
271};
272} // end namespace itk
273
274#ifndef ITK_MANUAL_INSTANTIATION
275# include "itkFastMarchingImageFilterBase.hxx"
276#endif
277
278#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:51
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