ITK  4.4.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 {
51 template< class TFourierSeriesPath, class TSwathMeritImage >
52 class ITK_EXPORT OrthogonalSwath2DPathFilter:public
53  PathAndImageToPathFilter< TFourierSeriesPath, TSwathMeritImage,
54  OrthogonallyCorrected2DParametricPath >
55 {
56 public:
59  typedef PathAndImageToPathFilter< TFourierSeriesPath, TSwathMeritImage,
63 
65  itkNewMacro(Self);
66 
69 
71  typedef TFourierSeriesPath InputPathType;
72  typedef typename InputPathType::Pointer InputPathPointer;
73  typedef typename InputPathType::InputType InputPathInputType;
74 
75  typedef TSwathMeritImage ImageType;
76  typedef typename ImageType::ConstPointer ImageConstPointer;
77 
85 
86  typedef typename InputPathType::IndexType IndexType;
87  typedef typename InputPathType::OffsetType OffsetType;
88  typedef typename ImageType::SizeType SizeType;
89 
90 protected:
92  virtual ~OrthogonalSwath2DPathFilter();
93  void PrintSelf(std::ostream & os, Indent indent) const;
94 
95  void GenerateData(void);
96 
97 private:
98  OrthogonalSwath2DPathFilter(const Self &); //purposely not implemented
99  void operator=(const Self &); //purposely not implemented
100 
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 FindAndStoreBestErrorStep(unsigned int x, unsigned int F,
105  unsigned int L);
106 
107  // m_StepValues & m_MeritValues are stored as datatype[x][F][L] which requres
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 & StepValue(int f, int l, int x)
121  {
122  int rows = m_SwathSize[1];
123 
124  return m_StepValues[( x * rows * rows ) + ( f * rows ) + ( l )];
125  }
126 
127  inline double & 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
152