ITK  4.3.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  using Superclass::MakeOutput;
162 
167  virtual void GenerateOutputInformation();
168 
170  virtual void EnlargeOutputRequestedRegion(DataObject * output);
171 
173  virtual void BeforeThreadedGenerateData();
174 
175  virtual void ThreadedGenerateData( ThreadIdType threadId ) throw ( ExceptionObject );
176 
178  virtual void AfterThreadedGenerateData();
179 
181  virtual void GenerateData();
182 
185 
186  void PrintSelf( std::ostream & os, Indent indent ) const;
187 
191  static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg);
192 
195  struct ThreadStruct {
197  };
198 
199 private:
200  //purposely not implemented
202  void operator=( const BlockMatchingImageFilter & );
203 
204  // algorithm parameters
207 
208  // temporary dynamic arrays for storing threads outputs
212 
213 };
214 } // end namespace itk
215 
216 #ifndef ITK_MANUAL_INSTANTIATION
217 #include "itkBlockMatchingImageFilter.hxx"
218 #endif
219 
220 #endif
221