ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkOrthogonalSwath2DPathFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
50 template< typename TFourierSeriesPath, typename TSwathMeritImage >
51 class ITK_TEMPLATE_EXPORT OrthogonalSwath2DPathFilter:public
52  PathAndImageToPathFilter< TFourierSeriesPath, TSwathMeritImage,
53  OrthogonallyCorrected2DParametricPath >
54 {
55 public:
56  ITK_DISALLOW_COPY_AND_ASSIGN(OrthogonalSwath2DPathFilter);
57 
60  using Superclass = PathAndImageToPathFilter< TFourierSeriesPath, TSwathMeritImage,
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 PrintSelf(std::ostream & os, Indent indent) const override;
93 
94  void GenerateData() override;
95 
96 private:
97  // Find the "L" for the maximum merit over the range L-1 to L+1 at F & x.
98  // This value is both returned and stored in m_StepValues.
99  // The merits for F & x at L-1 to L+1 must have already been calculated.
100  unsigned int FindAndStoreBestErrorStep(unsigned int x, unsigned int F,
101  unsigned int L);
102 
103  // m_StepValues & m_MeritValues are stored as datatype[x][F][L] which requres
104  // cols*rows*rows bytes of storage where rows and cols are the dimensions of
105  // the processed image.
106  //
107  // This ordering of elements is most efficient when L is incremented in the
108  // inner-most loop and x is incremented in the outer-most loop.
109  //
110  // m_StepValues & m_MeritValues should always be accessed using the
111  // StepValue()
112  // and MeritValue() access functions. StepValue() and MeritValue() can each
113  // be
114  // used on both the left and right hand of assignments for reads & writes, ex:
115  // StepValue(1,1,1) = 2+MeritValue(0,0,3);
116  inline int & StepValue(int f, int l, int x)
117  {
118  int rows = m_SwathSize[1];
119 
120  return m_StepValues[( x * rows * rows ) + ( f * rows ) + ( l )];
121  }
122 
123  inline double & MeritValue(int f, int l, int x)
124  {
125  int rows = m_SwathSize[1];
126 
127  return m_MeritValues[( x * rows * rows ) + ( f * rows ) + ( l )];
128  }
129 
130  int * m_StepValues; // best y=error coordinate @ x of image for (0,F) ->
131  // (x+1,L)
132  double *m_MeritValues;
133 
134  int * m_OptimumStepsValues; // best step (e value)
135  // sequence for a
136  // closed path
138 
140 };
141 } // end namespace itk
142 
143 #ifndef ITK_MANUAL_INSTANTIATION
144 #include "itkOrthogonalSwath2DPathFilter.hxx"
145 #endif
146 
147 #endif
typename InputPathType::Pointer InputPathPointer
Light weight base class for most itk classes.
typename InputPathType::OffsetType OffsetType
typename OutputPathType::OrthogonalCorrectionTableType OrthogonalCorrectionTableType
Filter that optimizes a 2D path relative to an image.
typename InputPathType::InputType InputPathInputType
OrthogonalCorrectionTablePointer m_FinalOffsetValues
typename OutputPathType::Pointer OutputPathPointer
Base class for filters that take both a path and an image as input and produce a path as output...
Represent an orthogonally corrected 2D parametric path.
typename InputPathType::IndexType IndexType
typename OutputPathType::OrthogonalCorrectionTablePointer OrthogonalCorrectionTablePointer
typename OutputPathType::InputType OutputPathInputType
Define a front-end to the STL &quot;vector&quot; container that conforms to the IndexedContainerInterface.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename ImageType::ConstPointer ImageConstPointer