ITK  5.2.0
Insight Toolkit
itkBlockMatchingImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 {
71 template <
72  typename TFixedImage,
73  typename TMovingImage = TFixedImage,
74  typename TFeatures = PointSet<Matrix<SpacePrecisionType, TFixedImage::ImageDimension, TFixedImage::ImageDimension>,
75  TFixedImage::ImageDimension>,
76  class TDisplacements =
77  PointSet<Vector<typename TFeatures::PointType::ValueType, TFeatures::PointDimension>, TFeatures::PointDimension>,
78  class TSimilarities = PointSet<SpacePrecisionType, TDisplacements::PointDimension>>
79 class ITK_TEMPLATE_EXPORT BlockMatchingImageFilter : public MeshToMeshFilter<TFeatures, TDisplacements>
80 {
81 public:
82  ITK_DISALLOW_COPY_AND_ASSIGN(BlockMatchingImageFilter);
83 
84  static constexpr unsigned ImageDimension = TFixedImage::ImageDimension;
85 
90 
92  using FixedImageType = TFixedImage;
93  using FixedImageConstPointer = typename FixedImageType::ConstPointer;
94  using FixedImagePixelType = typename FixedImageType::PixelType;
95 
97  using MovingImageType = TMovingImage;
98  using MovingImageConstPointer = typename MovingImageType::ConstPointer;
99 
101  using FeaturePointsType = TFeatures;
102  using FeaturePointsPointer = typename FeaturePointsType::Pointer;
103  using FeaturePointsConstPointer = typename FeaturePointsType::ConstPointer;
105 
107  using DisplacementsType = TDisplacements;
108  using DisplacementsPointer = typename DisplacementsType::Pointer;
109  using DisplacementsConstPointer = typename DisplacementsType::ConstPointer;
110  using DisplacementsVector = typename DisplacementsType::PixelType;
111 
113  using SimilaritiesType = TSimilarities;
114  using SimilaritiesPointer = typename SimilaritiesType::Pointer;
115  using SimilaritiesConstPointer = typename SimilaritiesType::ConstPointer;
116  using SimilaritiesValue = typename SimilaritiesType::PixelType;
117 
123 
125  itkNewMacro(Self);
126 
129 
131  itkSetMacro(BlockRadius, ImageSizeType);
132  itkGetConstMacro(BlockRadius, ImageSizeType);
134 
136  itkSetMacro(SearchRadius, ImageSizeType);
137  itkGetConstMacro(SearchRadius, ImageSizeType);
139 
141  itkSetInputMacro(FixedImage, FixedImageType);
142  itkGetInputMacro(FixedImage, FixedImageType);
144 
146  itkSetInputMacro(MovingImage, MovingImageType);
147  itkGetInputMacro(MovingImage, MovingImageType);
149 
151  itkSetInputMacro(FeaturePoints, FeaturePointsType);
152  itkGetInputMacro(FeaturePoints, FeaturePointsType);
154 
155  inline DisplacementsType *
157  {
158  return dynamic_cast<DisplacementsType *>(this->ProcessObject::GetOutput(0));
159  }
160 
161  inline SimilaritiesType *
163  {
164  return dynamic_cast<SimilaritiesType *>(this->ProcessObject::GetOutput(1));
165  }
166 
167 protected:
169  using Superclass::MakeOutput;
171  MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override;
172 
177  void
178  GenerateOutputInformation() override;
179 
181  void
182  EnlargeOutputRequestedRegion(DataObject * output) override;
183 
185  virtual void
186  BeforeThreadedGenerateData();
187 
188  virtual void
189  ThreadedGenerateData(ThreadIdType threadId);
190 
192  virtual void
193  AfterThreadedGenerateData();
194 
196  void
197  GenerateData() override;
198 
200  ~BlockMatchingImageFilter() override = default;
201 
202  void
203  PrintSelf(std::ostream & os, Indent indent) const override;
204 
209  ThreaderCallback(void * arg);
210 
214  {
216  };
217 
218 private:
219  // algorithm parameters
222 
223  // temporary dynamic arrays for storing threads outputs
227 };
228 } // end namespace itk
229 
230 #ifndef ITK_MANUAL_INSTANTIATION
231 # include "itkBlockMatchingImageFilter.hxx"
232 #endif
233 
234 #endif
itk::BlockMatchingImageFilter::FeaturePointsType
TFeatures FeaturePointsType
Definition: itkBlockMatchingImageFilter.h:101
itk::BlockMatchingImageFilter::DisplacementsConstPointer
typename DisplacementsType::ConstPointer DisplacementsConstPointer
Definition: itkBlockMatchingImageFilter.h:109
itk::Index
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:66
itk::Size< ImageDimension >
itk::BlockMatchingImageFilter::FeaturePointsPointer
typename FeaturePointsType::Pointer FeaturePointsPointer
Definition: itkBlockMatchingImageFilter.h:102
itk::ImageRegion
An image region represents a structured region of data.
Definition: itkImageRegion.h:69
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::ProcessObject::GetOutput
DataObject * GetOutput(const DataObjectIdentifierType &key)
itk::BlockMatchingImageFilter
Computes displacements of given points from a fixed image in a floating image.
Definition: itkBlockMatchingImageFilter.h:79
itkImage.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::BlockMatchingImageFilter::m_SearchRadius
ImageSizeType m_SearchRadius
Definition: itkBlockMatchingImageFilter.h:221
itk::ProcessObject::DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Definition: itkProcessObject.h:193
itk::BlockMatchingImageFilter::m_PointsCount
SizeValueType m_PointsCount
Definition: itkBlockMatchingImageFilter.h:224
itk::BlockMatchingImageFilter::MovingImageConstPointer
typename MovingImageType::ConstPointer MovingImageConstPointer
Definition: itkBlockMatchingImageFilter.h:98
itk::BlockMatchingImageFilter::GetDisplacements
DisplacementsType * GetDisplacements()
Definition: itkBlockMatchingImageFilter.h:156
itk::BlockMatchingImageFilter::SimilaritiesValue
typename SimilaritiesType::PixelType SimilaritiesValue
Definition: itkBlockMatchingImageFilter.h:116
itk::ThreadIdType
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
itkDefaultDynamicMeshTraits.h
itk::ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
itk::ITK_THREAD_RETURN_TYPE ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
Definition: itkThreadSupport.h:82
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::BlockMatchingImageFilter::FixedImageConstPointer
typename FixedImageType::ConstPointer FixedImageConstPointer
Definition: itkBlockMatchingImageFilter.h:93
itk::BlockMatchingImageFilter::DisplacementsType
TDisplacements DisplacementsType
Definition: itkBlockMatchingImageFilter.h:107
itk::BlockMatchingImageFilter::DisplacementsVector
typename DisplacementsType::PixelType DisplacementsVector
Definition: itkBlockMatchingImageFilter.h:110
itk::MeshToMeshFilter
MeshToMeshFilter is the base class for all process objects that output mesh data, and require mesh da...
Definition: itkMeshToMeshFilter.h:47
itk::BlockMatchingImageFilter::MovingImageType
TMovingImage MovingImageType
Definition: itkBlockMatchingImageFilter.h:97
itk::BlockMatchingImageFilter::SimilaritiesPointer
typename SimilaritiesType::Pointer SimilaritiesPointer
Definition: itkBlockMatchingImageFilter.h:114
itk::BlockMatchingImageFilter::GetSimilarities
SimilaritiesType * GetSimilarities()
Definition: itkBlockMatchingImageFilter.h:162
itkMeshToMeshFilter.h
itk::BlockMatchingImageFilter::FixedImagePixelType
typename FixedImageType::PixelType FixedImagePixelType
Definition: itkBlockMatchingImageFilter.h:94
itk::BlockMatchingImageFilter::FixedImageType
TFixedImage FixedImageType
Definition: itkBlockMatchingImageFilter.h:92
itk::BlockMatchingImageFilter::SimilaritiesConstPointer
typename SimilaritiesType::ConstPointer SimilaritiesConstPointer
Definition: itkBlockMatchingImageFilter.h:115
itk::BlockMatchingImageFilter::FeaturePointsPhysicalCoordinates
typename FeaturePointsType::PointType FeaturePointsPhysicalCoordinates
Definition: itkBlockMatchingImageFilter.h:104
itk::BlockMatchingImageFilter::SimilaritiesType
TSimilarities SimilaritiesType
Definition: itkBlockMatchingImageFilter.h:113
itk::BlockMatchingImageFilter::m_SimilaritiesValuesArray
SimilaritiesValue * m_SimilaritiesValuesArray
Definition: itkBlockMatchingImageFilter.h:226
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::BlockMatchingImageFilter::ThreadStruct
Definition: itkBlockMatchingImageFilter.h:213
itkVector.h
itkPointSet.h
itk::BlockMatchingImageFilter::m_BlockRadius
ImageSizeType m_BlockRadius
Definition: itkBlockMatchingImageFilter.h:220
itk::BlockMatchingImageFilter::DisplacementsPointer
typename DisplacementsType::Pointer DisplacementsPointer
Definition: itkBlockMatchingImageFilter.h:108
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293
itk::BlockMatchingImageFilter::ThreadStruct::Filter
Pointer Filter
Definition: itkBlockMatchingImageFilter.h:215
itk::BlockMatchingImageFilter::FeaturePointsConstPointer
typename FeaturePointsType::ConstPointer FeaturePointsConstPointer
Definition: itkBlockMatchingImageFilter.h:103
itk::BlockMatchingImageFilter::m_DisplacementsVectorsArray
DisplacementsVector * m_DisplacementsVectorsArray
Definition: itkBlockMatchingImageFilter.h:225