ITK  4.2.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 protected:
91  virtual ~OrthogonalSwath2DPathFilter();
92  void PrintSelf(std::ostream & os, Indent indent) const;
93 
94  void GenerateData(void);
95 
96 private:
97  OrthogonalSwath2DPathFilter(const Self &); //purposely not implemented
98  void operator=(const Self &); //purposely not implemented
99 
100  // Find the "L" for the maximum merit over the range L-1 to L+1 at F & x.
101  // This value is both returned and stored in m_StepValues.
102  // The merits for F & x at L-1 to L+1 must have already been calculated.
103  unsigned int FindAndStoreBestErrorStep(unsigned int x, unsigned int F,
104  unsigned int L);
105 
106  // m_StepValues & m_MeritValues are stored as datatype[x][F][L] which requres
107  // cols*rows*rows bytes of storage where rows and cols are the dimensions of
108  // the processed image.
109  //
110  // This ordering of elements is most efficient when L is incremented in the
111  // inner-most loop and x is incremented in the outer-most loop.
112  //
113  // m_StepValues & m_MeritValues should always be accessed using the
114  // StepValue()
115  // and MeritValue() access functions. StepValue() and MeritValue() can each
116  // be
117  // used on both the left and right hand of assignments for reads & writes, ex:
118  // StepValue(1,1,1) = 2+MeritValue(0,0,3);
119  inline int & 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 & MeritValue(int f, int l, int x)
127  {
128  int rows = m_SwathSize[1];
129 
130  return m_MeritValues[( x * rows * rows ) + ( f * rows ) + ( l )];
131  }
132 
133  int * m_StepValues; // best y=error coordinate @ x of image for (0,F) ->
134  // (x+1,L)
135  double *m_MeritValues;
136 
137  int * m_OptimumStepsValues; // best step (e value)
138  // sequence for a
139  // closed path
141 
143 };
144 } // end namespace itk
145 
146 #ifndef ITK_MANUAL_INSTANTIATION
147 #include "itkOrthogonalSwath2DPathFilter.hxx"
148 #endif
149 
150 #endif
151