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{
139
140template <typename TInputImage, typename TOutputImage, typename TMaskImage = TInputImage>
142 : public ImageToImageFilter<TInputImage, TOutputImage>
143{
144public:
145 ITK_DISALLOW_COPY_AND_MOVE(MaskedFFTNormalizedCorrelationImageFilter);
146
152
154 itkNewMacro(Self);
155
157 itkOverrideGetNameOfClassMacro(MaskedFFTNormalizedCorrelationImageFilter);
158
161 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
162
164 using InputImageType = TInputImage;
165 using InputRegionType = typename InputImageType::RegionType;
166 using InputImagePointer = typename InputImageType::Pointer;
167 using InputImageConstPointer = typename InputImageType::ConstPointer;
168 using InputSizeType = typename InputImageType::SizeType;
170
171 using OutputImageType = TOutputImage;
172 using OutputImagePointer = typename OutputImageType::Pointer;
173 using OutputPixelType = typename OutputImageType::PixelType;
174
182
183 using MaskImageType = TMaskImage;
184 using MaskImagePointer = typename MaskImageType::Pointer;
185
188
193
198
203
208
210 itkSetMacro(RequiredNumberOfOverlappingPixels, SizeValueType);
211 itkGetMacro(RequiredNumberOfOverlappingPixels, SizeValueType);
213
215 itkGetMacro(RequiredFractionOfOverlappingPixels, RealPixelType);
216 itkSetClampMacro(RequiredFractionOfOverlappingPixels, RealPixelType, 0.0f, 1.0f);
218
220 itkGetMacro(MaximumNumberOfOverlappingPixels, SizeValueType);
221
222 itkConceptMacro(OutputPixelTypeIsFloatingPointCheck, (Concept::IsFloatingPoint<OutputPixelType>));
223
224protected:
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
243 }
245 void
246 PrintSelf(std::ostream & os, Indent indent) const override;
247
249 void
250 VerifyInputInformation() const override;
251
253 void
254 GenerateData() override;
255
261 void
263
268 void
270
271 void
273
274 typename TMaskImage::Pointer
275 PreProcessMask(const InputImageType * inputImage, const MaskImageType * inputMask);
276
277 typename TInputImage::Pointer
278 PreProcessImage(const InputImageType * inputImage, const MaskImageType * inputMask);
279
280 template <typename LocalInputImageType>
281 typename LocalInputImageType::Pointer
282 RotateImage(LocalInputImageType * inputImage);
283
284 template <typename LocalInputImageType, typename LocalOutputImageType>
285 typename LocalOutputImageType::Pointer
286 CalculateForwardFFT(LocalInputImageType * inputImage, InputSizeType & FFTImageSize);
287
288 template <typename LocalInputImageType, typename LocalOutputImageType>
289 typename LocalOutputImageType::Pointer
290 CalculateInverseFFT(LocalInputImageType * inputImage, RealSizeType & combinedImageSize);
291
292 // Helper math methods.
293 template <typename LocalInputImageType, typename LocalOutputImageType>
294 typename LocalOutputImageType::Pointer
295 ElementProduct(LocalInputImageType * inputImage1, LocalInputImageType * inputImage2);
296
297 template <typename LocalInputImageType>
298 typename LocalInputImageType::Pointer
299 ElementQuotient(LocalInputImageType * inputImage1, LocalInputImageType * inputImage2);
300
301 template <typename LocalInputImageType>
302 typename LocalInputImageType::Pointer
303 ElementSubtraction(LocalInputImageType * inputImage1, LocalInputImageType * inputImage2);
304
305 template <typename LocalInputImageType>
306 typename LocalInputImageType::Pointer
307 ElementPositive(LocalInputImageType * inputImage);
308
309 template <typename LocalInputImageType, typename LocalOutputImageType>
310 typename LocalOutputImageType::Pointer
311 ElementRound(LocalInputImageType * inputImage);
312
313 // This function factorizes the image size uses factors of 2, 3, and
314 // 5. After this factorization, if there are any remaining values,
315 // the function returns this value.
316 int
318
319 // Find the closest valid dimension above the desired dimension. This
320 // will be a combination of 2s, 3s, and 5s.
321 int
323
324 template <typename LocalInputImageType>
325 double
326 CalculatePrecisionTolerance(LocalInputImageType * inputImage);
327
328private:
333
337
340
342 const unsigned int m_TotalForwardAndInverseFFTs{ 12 };
343
346};
347} // end namespace itk
348
349#ifndef ITK_MANUAL_INSTANTIATION
350# include "itkMaskedFFTNormalizedCorrelationImageFilter.hxx"
351#endif
352
353#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