ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkBlockMatchingImageFilter.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 __itkBlockMatchingImageFilter_h
19 #define __itkBlockMatchingImageFilter_h
20 
21 #include "itkMeshToMeshFilter.h"
22 #include "itkImage.h"
23 #include "itkPointSet.h"
24 #include "itkVector.h"
26 
27 
28 namespace itk
29 {
67 template<
68  class TFixedImage,
69  class TMovingImage = TFixedImage,
70  class TFeatures = PointSet< Matrix< double, TFixedImage::ImageDimension, TFixedImage::ImageDimension>, TFixedImage::ImageDimension >,
71  class TDisplacements = PointSet< Vector< typename TFeatures::PointType::ValueType, TFeatures::PointDimension >, TFeatures::PointDimension >,
72  class TSimilarities = PointSet< double, TDisplacements::PointDimension > >
73 class ITK_EXPORT BlockMatchingImageFilter:
74 public MeshToMeshFilter< TFeatures, TDisplacements>
75 {
76 public:
77  itkStaticConstMacro(ImageDimension, unsigned, TFixedImage::ImageDimension);
78 
83 
85  typedef TFixedImage FixedImageType;
86  typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
87  typedef typename FixedImageType::PixelType FixedImagePixelType;
88 
90  typedef TMovingImage MovingImageType;
91  typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
92 
94  typedef TFeatures FeaturePointsType;
95  typedef typename FeaturePointsType::Pointer FeaturePointsPointer;
96  typedef typename FeaturePointsType::ConstPointer FeaturePointsConstPointer;
97  typedef typename FeaturePointsType::PointType FeaturePointsPhysicalCoordinates;
98 
100  typedef TDisplacements DisplacementsType;
101  typedef typename DisplacementsType::Pointer DisplacementsPointer;
102  typedef typename DisplacementsType::ConstPointer DisplacementsConstPointer;
103  typedef typename DisplacementsType::PixelType DisplacementsVector;
104 
106  typedef TSimilarities SimilaritiesType;
107  typedef typename SimilaritiesType::Pointer SimilaritiesPointer;
108  typedef typename SimilaritiesType::ConstPointer SimilaritiesConstPointer;
109  typedef typename SimilaritiesType::PixelType SimilaritiesValue;
110 
116 
118  itkNewMacro(Self);
119 
122 
124  itkSetMacro(BlockRadius, ImageSizeType);
125  itkGetConstMacro(BlockRadius, ImageSizeType);
127 
129  itkSetMacro(SearchRadius, ImageSizeType);
130  itkGetConstMacro(SearchRadius, ImageSizeType);
132 
134  itkSetInputMacro(FixedImage, FixedImageType);
135  itkGetInputMacro(FixedImage, FixedImageType);
137 
139  itkSetInputMacro(MovingImage, MovingImageType);
140  itkGetInputMacro(MovingImage, MovingImageType);
142 
144  itkSetInputMacro(FeaturePoints, FeaturePointsType);
145  itkGetInputMacro(FeaturePoints, FeaturePointsType);
147 
148  inline DisplacementsType * GetDisplacements()
149  {
150  return dynamic_cast< DisplacementsType * >( this->ProcessObject::GetOutput( 0 ) );
151  }
152 
153  inline SimilaritiesType * GetSimilarities()
154  {
155  return dynamic_cast< SimilaritiesType * >( this->ProcessObject::GetOutput( 1 ) );
156  }
157 
158 protected:
160  virtual ProcessObject::DataObjectPointerArraySizeType GetNumberOfValidRequiredInputs() const;
161 
163  using Superclass::MakeOutput;
165 
166  virtual void AllocateOutputs();
167 
169  virtual void BeforeThreadedGenerateData();
170 
171  virtual void ThreadedGenerateData( ThreadIdType threadId ) throw ( ExceptionObject );
172 
174  virtual void AfterThreadedGenerateData();
175 
177  virtual void GenerateData();
178 
181 
182  void PrintSelf( std::ostream & os, Indent indent ) const;
183 
187  static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg);
188 
191  struct ThreadStruct {
193  };
194 
195 private:
196  //purposely not implemented
198  void operator=( const BlockMatchingImageFilter & );
199 
200  // algorithm parameters
203 
204  // temporary dynamic arrays for storing threads outputs
208 
209 };
210 } // end namespace itk
211 
212 #ifndef ITK_MANUAL_INSTANTIATION
213 #include "itkBlockMatchingImageFilter.hxx"
214 #endif
215 
216 #endif
217