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 
26 namespace itk
27 {
53 template <typename TFourierSeriesPath, typename TSwathMeritImage>
54 class ITK_TEMPLATE_EXPORT OrthogonalSwath2DPathFilter
55  : public PathAndImageToPathFilter<TFourierSeriesPath, TSwathMeritImage, OrthogonallyCorrected2DParametricPath>
56 {
57 public:
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 
91 protected:
92  OrthogonalSwath2DPathFilter() = default;
93  ~OrthogonalSwath2DPathFilter() override = default;
94  void
95  PrintSelf(std::ostream & os, Indent indent) const override;
96 
97  void
98  GenerateData() override;
99 
100 private:
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
itk::OrthogonalSwath2DPathFilter::OffsetType
typename InputPathType::OffsetType OffsetType
Definition: itkOrthogonalSwath2DPathFilter.h:88
itk::OrthogonalSwath2DPathFilter::OutputPathInputType
typename OutputPathType::InputType OutputPathInputType
Definition: itkOrthogonalSwath2DPathFilter.h:83
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::OrthogonalSwath2DPathFilter::ImageConstPointer
typename ImageType::ConstPointer ImageConstPointer
Definition: itkOrthogonalSwath2DPathFilter.h:79
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::detail::VectorContainer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Definition: itkVectorContainer.h:51
itk::OrthogonallyCorrected2DParametricPath
Represent an orthogonally corrected 2D parametric path.
Definition: itkOrthogonallyCorrected2DParametricPath.h:45
itk::OrthogonallyCorrected2DParametricPath::InputType
Superclass::InputType InputType
Definition: itkOrthogonallyCorrected2DParametricPath.h:60
itk::OrthogonalSwath2DPathFilter::SizeType
typename ImageType::SizeType SizeType
Definition: itkOrthogonalSwath2DPathFilter.h:89
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::OrthogonalSwath2DPathFilter::InputPathPointer
typename InputPathType::Pointer InputPathPointer
Definition: itkOrthogonalSwath2DPathFilter.h:75
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkOrthogonallyCorrected2DParametricPath.h
itk::OrthogonalSwath2DPathFilter::StepValue
int & StepValue(int f, int l, int x)
Definition: itkOrthogonalSwath2DPathFilter.h:121
itk::OrthogonalSwath2DPathFilter::ImageType
TSwathMeritImage ImageType
Definition: itkOrthogonalSwath2DPathFilter.h:78
itk::OrthogonalSwath2DPathFilter::MeritValue
double & MeritValue(int f, int l, int x)
Definition: itkOrthogonalSwath2DPathFilter.h:129
itk::OrthogonalSwath2DPathFilter::OrthogonalCorrectionTableType
typename OutputPathType::OrthogonalCorrectionTableType OrthogonalCorrectionTableType
Definition: itkOrthogonalSwath2DPathFilter.h:84
itk::OrthogonalSwath2DPathFilter::InputPathType
TFourierSeriesPath InputPathType
Definition: itkOrthogonalSwath2DPathFilter.h:74
itk::PathAndImageToPathFilter
Base class for filters that take both a path and an image as input and produce a path as output.
Definition: itkPathAndImageToPathFilter.h:39
itkPathAndImageToPathFilter.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::OrthogonalSwath2DPathFilter::InputPathInputType
typename InputPathType::InputType InputPathInputType
Definition: itkOrthogonalSwath2DPathFilter.h:76
itk::OrthogonalSwath2DPathFilter::OutputPathPointer
typename OutputPathType::Pointer OutputPathPointer
Definition: itkOrthogonalSwath2DPathFilter.h:82
New
static Pointer New()
itk::OrthogonalSwath2DPathFilter::OrthogonalCorrectionTablePointer
typename OutputPathType::OrthogonalCorrectionTablePointer OrthogonalCorrectionTablePointer
Definition: itkOrthogonalSwath2DPathFilter.h:85
itk::OrthogonalSwath2DPathFilter::IndexType
typename InputPathType::IndexType IndexType
Definition: itkOrthogonalSwath2DPathFilter.h:87
itk::OrthogonalSwath2DPathFilter
Filter that optimizes a 2D path relative to an image.
Definition: itkOrthogonalSwath2DPathFilter.h:54