ITK  6.0.0
Insight Toolkit
itkOrthogonalSwath2DPathFilter.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 itkOrthogonalSwath2DPathFilter_h
19#define itkOrthogonalSwath2DPathFilter_h
20
23
24#include <memory> // For unique_ptr.
25
26namespace itk
27{
53template <typename TFourierSeriesPath, typename TSwathMeritImage>
54class ITK_TEMPLATE_EXPORT OrthogonalSwath2DPathFilter
55 : public PathAndImageToPathFilter<TFourierSeriesPath, TSwathMeritImage, OrthogonallyCorrected2DParametricPath>
56{
57public:
58 ITK_DISALLOW_COPY_AND_MOVE(OrthogonalSwath2DPathFilter);
59
62 using Superclass =
66
68 itkNewMacro(Self);
69
71 itkOverrideGetNameOfClassMacro(OrthogonalSwath2DPathFilter);
72
74 using InputPathType = TFourierSeriesPath;
76 using InputPathInputType = typename InputPathType::InputType;
77
78 using ImageType = TSwathMeritImage;
80
86
88 using OffsetType = typename InputPathType::OffsetType;
89 using SizeType = typename ImageType::SizeType;
90
91protected:
93 ~OrthogonalSwath2DPathFilter() override = default;
94 void
95 PrintSelf(std::ostream & os, Indent indent) const override;
96
97 void
98 GenerateData() override;
99
100private:
101 // Find the "L" for the maximum merit over the range L-1 to L+1 at F & x.
102 // This value is both returned and stored in m_StepValues.
103 // The merits for F & x at L-1 to L+1 must have already been calculated.
104 unsigned int
105 FindAndStoreBestErrorStep(unsigned int x, unsigned int F, unsigned int L);
106
107 // m_StepValues & m_MeritValues are stored as datatype[x][F][L] which requires
108 // cols*rows*rows bytes of storage where rows and cols are the dimensions of
109 // the processed image.
110 //
111 // This ordering of elements is most efficient when L is incremented in the
112 // inner-most loop and x is incremented in the outer-most loop.
113 //
114 // m_StepValues & m_MeritValues should always be accessed using the
115 // StepValue()
116 // and MeritValue() access functions. StepValue() and MeritValue() can each
117 // be
118 // used on both the left and right hand of assignments for reads & writes, ex:
119 // StepValue(1,1,1) = 2+MeritValue(0,0,3);
120 inline int &
121 StepValue(int f, int l, int x)
122 {
123 int rows = m_SwathSize[1];
124
125 return m_StepValues[(x * rows * rows) + (f * rows) + (l)];
126 }
127
128 inline double &
129 MeritValue(int f, int l, int x)
130 {
131 int rows = m_SwathSize[1];
132
133 return m_MeritValues[(x * rows * rows) + (f * rows) + (l)];
134 }
135
136 std::unique_ptr<int[]> m_StepValues{ nullptr }; // best y=error coordinate @ x of image for (0,F) ->
137 // (x+1,L)
138 std::unique_ptr<double[]> m_MeritValues{ nullptr };
139
140 std::unique_ptr<int[]> m_OptimumStepsValues{ nullptr }; // best step (e value)
141 // sequence for a
142 // closed path
144
145 SizeType m_SwathSize{ { 0 } };
146};
147} // end namespace itk
148
149#ifndef ITK_MANUAL_INSTANTIATION
150# include "itkOrthogonalSwath2DPathFilter.hxx"
151#endif
152
153#endif
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Filter that optimizes a 2D path relative to an image.
typename InputPathType::IndexType IndexType
unsigned int FindAndStoreBestErrorStep(unsigned int x, unsigned int F, unsigned int L)
~OrthogonalSwath2DPathFilter() override=default
typename ImageType::ConstPointer ImageConstPointer
typename OutputPathType::OrthogonalCorrectionTableType OrthogonalCorrectionTableType
typename InputPathType::Pointer InputPathPointer
typename InputPathType::InputType InputPathInputType
void PrintSelf(std::ostream &os, Indent indent) const override
typename InputPathType::OffsetType OffsetType
typename OutputPathType::InputType OutputPathInputType
typename OutputPathType::OrthogonalCorrectionTablePointer OrthogonalCorrectionTablePointer
typename OutputPathType::Pointer OutputPathPointer
Represent an orthogonally corrected 2D parametric path.
Base class for filters that take both a path and an image as input and produce a path as output.
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
SmartPointer< const Self > ConstPointer
static Pointer New()
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....