ITK  5.2.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  * http://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 namespace itk
25 {
51 template <typename TFourierSeriesPath, typename TSwathMeritImage>
52 class ITK_TEMPLATE_EXPORT OrthogonalSwath2DPathFilter
53  : public PathAndImageToPathFilter<TFourierSeriesPath, TSwathMeritImage, OrthogonallyCorrected2DParametricPath>
54 {
55 public:
56  ITK_DISALLOW_COPY_AND_MOVE(OrthogonalSwath2DPathFilter);
57 
60  using Superclass =
64 
66  itkNewMacro(Self);
67 
70 
72  using InputPathType = TFourierSeriesPath;
73  using InputPathPointer = typename InputPathType::Pointer;
74  using InputPathInputType = typename InputPathType::InputType;
75 
76  using ImageType = TSwathMeritImage;
77  using ImageConstPointer = typename ImageType::ConstPointer;
78 
84 
86  using OffsetType = typename InputPathType::OffsetType;
87  using SizeType = typename ImageType::SizeType;
88 
89 protected:
91  ~OrthogonalSwath2DPathFilter() override;
92  void
93  PrintSelf(std::ostream & os, Indent indent) const override;
94 
95  void
96  GenerateData() override;
97 
98 private:
99  // Find the "L" for the maximum merit over the range L-1 to L+1 at F & x.
100  // This value is both returned and stored in m_StepValues.
101  // The merits for F & x at L-1 to L+1 must have already been calculated.
102  unsigned int
103  FindAndStoreBestErrorStep(unsigned int x, unsigned int F, unsigned int L);
104 
105  // m_StepValues & m_MeritValues are stored as datatype[x][F][L] which requires
106  // cols*rows*rows bytes of storage where rows and cols are the dimensions of
107  // the processed image.
108  //
109  // This ordering of elements is most efficient when L is incremented in the
110  // inner-most loop and x is incremented in the outer-most loop.
111  //
112  // m_StepValues & m_MeritValues should always be accessed using the
113  // StepValue()
114  // and MeritValue() access functions. StepValue() and MeritValue() can each
115  // be
116  // used on both the left and right hand of assignments for reads & writes, ex:
117  // StepValue(1,1,1) = 2+MeritValue(0,0,3);
118  inline int &
119  StepValue(int f, int l, int x)
120  {
121  int rows = m_SwathSize[1];
122 
123  return m_StepValues[(x * rows * rows) + (f * rows) + (l)];
124  }
125 
126  inline double &
127  MeritValue(int f, int l, int x)
128  {
129  int rows = m_SwathSize[1];
130 
131  return m_MeritValues[(x * rows * rows) + (f * rows) + (l)];
132  }
133 
134  int * m_StepValues; // best y=error coordinate @ x of image for (0,F) ->
135  // (x+1,L)
136  double * m_MeritValues;
137 
138  int * m_OptimumStepsValues; // best step (e value)
139  // sequence for a
140  // closed path
142 
144 };
145 } // end namespace itk
146 
147 #ifndef ITK_MANUAL_INSTANTIATION
148 # include "itkOrthogonalSwath2DPathFilter.hxx"
149 #endif
150 
151 #endif
itk::OrthogonalSwath2DPathFilter::OffsetType
typename InputPathType::OffsetType OffsetType
Definition: itkOrthogonalSwath2DPathFilter.h:86
itk::OrthogonalSwath2DPathFilter::OutputPathInputType
typename OutputPathType::InputType OutputPathInputType
Definition: itkOrthogonalSwath2DPathFilter.h:81
itk::OrthogonalSwath2DPathFilter::ImageConstPointer
typename ImageType::ConstPointer ImageConstPointer
Definition: itkOrthogonalSwath2DPathFilter.h:77
itk::OrthogonallyCorrected2DParametricPath
Represent an orthogonally corrected 2D parametric path.
Definition: itkOrthogonallyCorrected2DParametricPath.h:45
itk::OrthogonalSwath2DPathFilter::m_SwathSize
SizeType m_SwathSize
Definition: itkOrthogonalSwath2DPathFilter.h:143
itk::OrthogonallyCorrected2DParametricPath::InputType
Superclass::InputType InputType
Definition: itkOrthogonallyCorrected2DParametricPath.h:60
itk::OrthogonalSwath2DPathFilter::SizeType
typename ImageType::SizeType SizeType
Definition: itkOrthogonalSwath2DPathFilter.h:87
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:73
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:59
itkOrthogonallyCorrected2DParametricPath.h
itk::OrthogonalSwath2DPathFilter::StepValue
int & StepValue(int f, int l, int x)
Definition: itkOrthogonalSwath2DPathFilter.h:119
itk::OrthogonalSwath2DPathFilter::ImageType
TSwathMeritImage ImageType
Definition: itkOrthogonalSwath2DPathFilter.h:76
itk::OrthogonalSwath2DPathFilter::MeritValue
double & MeritValue(int f, int l, int x)
Definition: itkOrthogonalSwath2DPathFilter.h:127
itk::OrthogonalSwath2DPathFilter::m_OptimumStepsValues
int * m_OptimumStepsValues
Definition: itkOrthogonalSwath2DPathFilter.h:138
itk::OrthogonalSwath2DPathFilter::OrthogonalCorrectionTableType
typename OutputPathType::OrthogonalCorrectionTableType OrthogonalCorrectionTableType
Definition: itkOrthogonalSwath2DPathFilter.h:82
itk::OrthogonalSwath2DPathFilter::InputPathType
TFourierSeriesPath InputPathType
Definition: itkOrthogonalSwath2DPathFilter.h:72
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: itkAnnulusOperator.h:24
itk::OrthogonalSwath2DPathFilter::InputPathInputType
typename InputPathType::InputType InputPathInputType
Definition: itkOrthogonalSwath2DPathFilter.h:74
itk::OrthogonalSwath2DPathFilter::OutputPathPointer
typename OutputPathType::Pointer OutputPathPointer
Definition: itkOrthogonalSwath2DPathFilter.h:80
itk::OrthogonalSwath2DPathFilter::m_StepValues
int * m_StepValues
Definition: itkOrthogonalSwath2DPathFilter.h:134
itk::OrthogonalSwath2DPathFilter::m_FinalOffsetValues
OrthogonalCorrectionTablePointer m_FinalOffsetValues
Definition: itkOrthogonalSwath2DPathFilter.h:141
itk::OrthogonalSwath2DPathFilter::m_MeritValues
double * m_MeritValues
Definition: itkOrthogonalSwath2DPathFilter.h:136
itk::OrthogonalSwath2DPathFilter::OrthogonalCorrectionTablePointer
typename OutputPathType::OrthogonalCorrectionTablePointer OrthogonalCorrectionTablePointer
Definition: itkOrthogonalSwath2DPathFilter.h:83
itk::OrthogonalSwath2DPathFilter::IndexType
typename InputPathType::IndexType IndexType
Definition: itkOrthogonalSwath2DPathFilter.h:85
itk::VectorContainer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Definition: itkVectorContainer.h:48
itk::OrthogonalSwath2DPathFilter
Filter that optimizes a 2D path relative to an image.
Definition: itkOrthogonalSwath2DPathFilter.h:52