ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkArrivalFunctionToPathFilter.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 itkArrivalFunctionToPathFilter_h
19#define itkArrivalFunctionToPathFilter_h
20
21#include "itkImage.h"
22#include "itkCommand.h"
28
29namespace itk
30{
41
42template <typename TFilter>
43class ITK_TEMPLATE_EXPORT ArrivalFunctionToPathCommand : public itk::Command
44{
45public:
46 ITK_DISALLOW_COPY_AND_MOVE(ArrivalFunctionToPathCommand);
47
52
54 itkNewMacro(Self);
55
57 using FilterType = TFilter;
58
60 itkSetObjectMacro(Filter, FilterType);
61 itkGetConstObjectMacro(Filter, FilterType);
62
64 void
65 Execute(itk::Object * caller, const itk::EventObject & event) override
66 {
67 const auto * constCaller = const_cast<const itk::Object *>(caller);
68 Execute(constCaller, event);
69 }
70
72 void
73 Execute(const itk::Object * object, const itk::EventObject & event) override
74 {
75 if (!itk::IterationEvent().CheckEvent(&event))
76 {
77 return;
78 }
79 // Pass event to Filter
80 if (m_Filter.IsNotNull())
81 {
82 m_Filter->Execute(object, event);
83 }
84 }
85
86protected:
88 ~ArrivalFunctionToPathCommand() override = default;
89
90private:
92};
93
94
142template <typename TInputImage, typename TOutputPath = PolyLineParametricPath<TInputImage::ImageDimension>>
143class ITK_TEMPLATE_EXPORT ArrivalFunctionToPathFilter : public ImageToPathFilter<TInputImage, TOutputPath>
144{
145public:
146 ITK_DISALLOW_COPY_AND_MOVE(ArrivalFunctionToPathFilter);
147
153
155 itkOverrideGetNameOfClassMacro(ArrivalFunctionToPathFilter);
156
158 itkNewMacro(Self);
159
161 using InputImageType = TInputImage;
162 using InputImagePointer = typename InputImageType::Pointer;
163 using InputImageConstPointer = typename InputImageType::ConstPointer;
164 using InputImageRegionType = typename InputImageType::RegionType;
165 using InputImagePixelType = typename InputImageType::PixelType;
166
168 using OutputPathType = TOutputPath;
169 using OutputPathPointer = typename OutputPathType::Pointer;
170 using OutputPathConstPointer = typename OutputPathType::ConstPointer;
171
173 static constexpr unsigned int InputImageDimension = InputImageType::ImageDimension;
174
183
185 using PointsContainerType = std::vector<PointType>;
186
188 itkSetObjectMacro(Optimizer, OptimizerType);
189 itkGetConstObjectMacro(Optimizer, OptimizerType);
190
193 itkSetObjectMacro(CostFunction, CostFunctionType);
194 itkGetConstObjectMacro(CostFunction, CostFunctionType);
195
197 virtual void
199
201 virtual void
203
205 virtual void
207
211 itkSetMacro(TerminationValue, typename OptimizerType::MeasureType);
212 itkGetMacro(TerminationValue, typename OptimizerType::MeasureType);
213
215 virtual void
216 Execute(const itk::Object * object, const itk::EventObject & event);
217
218protected:
221 void
222 PrintSelf(std::ostream & os, Indent indent) const override;
223
225 void
227
229 void
230 GenerateData() override;
231
233 virtual unsigned int
235
238 virtual InputImageType *
240
242 virtual const PointsContainerType &
244
248 std::vector<PointsContainerType> m_PointList;
249 unsigned int m_CurrentOutput;
250};
251
252} // end namespace itk
253
254#ifndef ITK_MANUAL_INSTANTIATION
255# include "itkArrivalFunctionToPathFilter.hxx"
256#endif
257
258#endif
A command to listen for Optimizer Iteration events.
void Execute(const itk::Object *object, const itk::EventObject &event) override
~ArrivalFunctionToPathCommand() override=default
void Execute(itk::Object *caller, const itk::EventObject &event) override
virtual void AddPathEndPoint(const PointType &point)
virtual unsigned int GetNumberOfPathsToExtract() const
ImageToPathFilter< TInputImage, TOutputPath > Superclass
virtual InputImageType * ComputeArrivalFunction()
virtual void SetPathEndPoint(const PointType &point)
typename InputImageType::ConstPointer InputImageConstPointer
ContinuousIndex< double, InputImageDimension > ContinuousIndexType
void GenerateInputRequestedRegion() override
ArrivalFunctionToPathCommand< Self > CommandType
typename InputImageType::RegionType InputImageRegionType
virtual const PointsContainerType & GetNextEndPoint()
void PrintSelf(std::ostream &os, Indent indent) const override
typename OutputPathType::ConstPointer OutputPathConstPointer
Point< double, InputImageDimension > PointType
RegularStepGradientDescentOptimizer DefaultOptimizerType
SingleImageCostFunction< InputImageType > CostFunctionType
typename InputImageType::PixelType InputImagePixelType
virtual void Execute(const itk::Object *object, const itk::EventObject &event)
typename InputImageType::Pointer InputImagePointer
typename OutputPathType::Pointer OutputPathPointer
Superclass for callback/observer methods.
Definition itkCommand.h:46
A templated class holding a point in n-Dimensional image space.
Abstraction of the Events used to communicating among filters and with GUIs.
Control indentation during Print() invocation.
Definition itkIndent.h:53
Base class for most ITK classes.
Definition itkObject.h:62
Generic representation for an optimization method.
A templated class holding a geometric point in n-Dimensional space.
Definition itkPoint.h:54
This class is a cost function which queries an underlying image for the single value.
This class is a base for the Optimization methods that optimize a single valued function.
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
CostFunctionTemplate< double > CostFunction
#define itkSetMacro(name, type)
Represent a n-dimensional index in a n-dimensional image.
Definition itkIndex.h:69