ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkMaskedFFTNormalizedCorrelationImageFilter.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 * https://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 itkMaskedFFTNormalizedCorrelationImageFilter_h
19#define itkMaskedFFTNormalizedCorrelationImageFilter_h
20
22#include "itkImage.h"
23
24namespace itk
25{
138template <typename TInputImage, typename TOutputImage, typename TMaskImage = TInputImage>
140 : public ImageToImageFilter<TInputImage, TOutputImage>
141{
142public:
143 ITK_DISALLOW_COPY_AND_MOVE(MaskedFFTNormalizedCorrelationImageFilter);
144
150
152 itkNewMacro(Self);
153
155 itkOverrideGetNameOfClassMacro(MaskedFFTNormalizedCorrelationImageFilter);
156
159 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
160
162 using InputImageType = TInputImage;
163 using InputRegionType = typename InputImageType::RegionType;
164 using InputImagePointer = typename InputImageType::Pointer;
165 using InputImageConstPointer = typename InputImageType::ConstPointer;
166 using InputSizeType = typename InputImageType::SizeType;
168
169 using OutputImageType = TOutputImage;
170 using OutputImagePointer = typename OutputImageType::Pointer;
171 using OutputPixelType = typename OutputImageType::PixelType;
172
180
181 using MaskImageType = TMaskImage;
182 using MaskImagePointer = typename MaskImageType::Pointer;
183
186
209 itkSetMacro(RequiredNumberOfOverlappingPixels, SizeValueType);
210 itkGetMacro(RequiredNumberOfOverlappingPixels, SizeValueType);
214 itkGetMacro(RequiredFractionOfOverlappingPixels, RealPixelType);
215 itkSetClampMacro(RequiredFractionOfOverlappingPixels, RealPixelType, 0.0f, 1.0f);
218 itkGetMacro(MaximumNumberOfOverlappingPixels, SizeValueType);
219
220 itkConceptMacro(OutputPixelTypeIsFloatingPointCheck, (Concept::IsFloatingPoint<OutputPixelType>));
221
222protected:
225
226 {
227 // #0 "FixedImage" required
228 Self::SetPrimaryInputName("FixedImage");
229
230 // #1 "MaskImage" required
231 Self::AddRequiredInputName("MovingImage", 1);
232
233 // #2 "FixedImageMask" optional
234 Self::AddOptionalInputName("FixedImageMask", 2);
235
236 // #3 "MaskImageMask" optional
237 Self::AddOptionalInputName("MovingImageMask", 3);
238 }
240 void
241 PrintSelf(std::ostream & os, Indent indent) const override;
242
244 void
245 VerifyInputInformation() const override;
246
248 void
249 GenerateData() override;
250
256 void
258
263 void
265
266 void
268
269 typename TMaskImage::Pointer
270 PreProcessMask(const InputImageType * inputImage, const MaskImageType * inputMask);
271
272 typename TInputImage::Pointer
273 PreProcessImage(const InputImageType * inputImage, const MaskImageType * inputMask);
274
275 template <typename LocalInputImageType>
276 typename LocalInputImageType::Pointer
277 RotateImage(LocalInputImageType * inputImage);
278
279 template <typename LocalInputImageType, typename LocalOutputImageType>
280 typename LocalOutputImageType::Pointer
281 CalculateForwardFFT(LocalInputImageType * inputImage, InputSizeType & FFTImageSize);
282
283 template <typename LocalInputImageType, typename LocalOutputImageType>
284 typename LocalOutputImageType::Pointer
285 CalculateInverseFFT(LocalInputImageType * inputImage, RealSizeType & combinedImageSize);
286
287 // Helper math methods.
288 template <typename LocalInputImageType, typename LocalOutputImageType>
289 typename LocalOutputImageType::Pointer
290 ElementProduct(LocalInputImageType * inputImage1, LocalInputImageType * inputImage2);
291
292 template <typename LocalInputImageType>
293 typename LocalInputImageType::Pointer
294 ElementQuotient(LocalInputImageType * inputImage1, LocalInputImageType * inputImage2);
295
296 template <typename LocalInputImageType>
297 typename LocalInputImageType::Pointer
298 ElementSubtraction(LocalInputImageType * inputImage1, LocalInputImageType * inputImage2);
299
300 template <typename LocalInputImageType>
301 typename LocalInputImageType::Pointer
302 ElementPositive(LocalInputImageType * inputImage);
303
304 template <typename LocalInputImageType, typename LocalOutputImageType>
305 typename LocalOutputImageType::Pointer
306 ElementRound(LocalInputImageType * inputImage);
307
308 // This function factorizes the image size uses factors of 2, 3, and
309 // 5. After this factorization, if there are any remaining values,
310 // the function returns this value.
311 int
313
314 // Find the closest valid dimension above the desired dimension. This
315 // will be a combination of 2s, 3s, and 5s.
316 int
318
319 template <typename LocalInputImageType>
320 double
321 CalculatePrecisionTolerance(LocalInputImageType * inputImage);
322
323private:
328
332
335
337 const unsigned int m_TotalForwardAndInverseFFTs{ 12 };
338
341};
342} // end namespace itk
343
344#ifndef ITK_MANUAL_INSTANTIATION
345# include "itkMaskedFFTNormalizedCorrelationImageFilter.hxx"
346#endif
347
348#endif
Base class for all data objects in ITK.
Templated n-dimensional image class.
Definition itkImage.h:89
Point< PointValueType, VImageDimension > PointType
ImageRegion< VImageDimension > RegionType
Control indentation during Print() invocation.
Definition itkIndent.h:50
Image< std::complex< RealPixelType >, ImageDimension > FFTImageType
LocalOutputImageType::Pointer ElementProduct(LocalInputImageType *inputImage1, LocalInputImageType *inputImage2)
itkGetInputMacro(FixedImage, InputImageType)
LocalInputImageType::Pointer ElementQuotient(LocalInputImageType *inputImage1, LocalInputImageType *inputImage2)
itkSetInputMacro(FixedImage, InputImageType)
void PrintSelf(std::ostream &os, Indent indent) const override
itkSetInputMacro(MovingImage, InputImageType)
LocalInputImageType::Pointer RotateImage(LocalInputImageType *inputImage)
void EnlargeOutputRequestedRegion(DataObject *output) override
itkSetInputMacro(FixedImageMask, MaskImageType)
itkSetInputMacro(MovingImageMask, MaskImageType)
double CalculatePrecisionTolerance(LocalInputImageType *inputImage)
LocalInputImageType::Pointer ElementPositive(LocalInputImageType *inputImage)
TMaskImage::Pointer PreProcessMask(const InputImageType *inputImage, const MaskImageType *inputMask)
TInputImage::Pointer PreProcessImage(const InputImageType *inputImage, const MaskImageType *inputMask)
LocalOutputImageType::Pointer CalculateForwardFFT(LocalInputImageType *inputImage, InputSizeType &FFTImageSize)
LocalInputImageType::Pointer ElementSubtraction(LocalInputImageType *inputImage1, LocalInputImageType *inputImage2)
LocalOutputImageType::Pointer CalculateInverseFFT(LocalInputImageType *inputImage, RealSizeType &combinedImageSize)
itkGetInputMacro(MovingImage, InputImageType)
LocalOutputImageType::Pointer ElementRound(LocalInputImageType *inputImage)
~MaskedFFTNormalizedCorrelationImageFilter() override=default
itkGetInputMacro(FixedImageMask, MaskImageType)
itkGetInputMacro(MovingImageMask, MaskImageType)
virtual void SetPrimaryInputName(const DataObjectIdentifierType &key)
void AddOptionalInputName(const DataObjectIdentifierType &)
Define a named input that is not required and optionally associate with a numbered index.
bool AddRequiredInputName(const DataObjectIdentifierType &)
Define a required named input and optionally associate it with a numbered index.
Implements transparent reference counting.
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition itkIntTypes.h:86