Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Add default factory initialization
Leverages the `InitFactory` mechanism introduced in ITK commit c266651 to register VkFFT GPU-accelerated implementation classes as the default backends for ITK FFT classes via the object factory.
- Loading branch information
Showing
13 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/*========================================================================= | ||
* | ||
* Copyright NumFOCUS | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0.txt | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*=========================================================================*/ | ||
#ifndef itkVkFFTImageFilterInitFactory_h | ||
#define itkVkFFTImageFilterInitFactory_h | ||
#include "VkFFTBackendExport.h" | ||
|
||
#include "itkLightObject.h" | ||
|
||
namespace itk | ||
{ | ||
/** | ||
*\class VkFFTImageFilterInitFactory | ||
* \brief Initialize Vk FFT image filter factory backends. | ||
* | ||
* The purpose of VkFFTImageFilterInitFactory is to perform | ||
* one-time registration of factory objects that handle | ||
* creation of Vk-backend FFT image filter classes | ||
* through the ITK object factory singleton mechanism. | ||
* | ||
* \ingroup FourierTransform | ||
* \ingroup ITKFFT | ||
* \ingroup ITKSystemObjects | ||
* \ingroup VkFFTBackend | ||
*/ | ||
class VkFFTBackend_EXPORT VkFFTImageFilterInitFactory : public LightObject | ||
{ | ||
public: | ||
ITK_DISALLOW_COPY_AND_MOVE(VkFFTImageFilterInitFactory); | ||
|
||
/** Standard class type aliases. */ | ||
using Self = VkFFTImageFilterInitFactory; | ||
using Superclass = LightObject; | ||
using Pointer = SmartPointer<Self>; | ||
using ConstPointer = SmartPointer<const Self>; | ||
|
||
/** Method for class instantiation. */ | ||
itkFactorylessNewMacro(Self); | ||
|
||
/** Run-time type information (and related methods). */ | ||
itkTypeMacro(VkFFTImageFilterInitFactory, LightObject); | ||
|
||
/** Mimic factory interface for Python initialization */ | ||
static void | ||
RegisterOneFactory() | ||
{ | ||
RegisterFactories(); | ||
} | ||
|
||
/** Register all Vk FFT factories */ | ||
static void | ||
RegisterFactories(); | ||
|
||
protected: | ||
VkFFTImageFilterInitFactory(); | ||
~VkFFTImageFilterInitFactory() override = default; | ||
}; | ||
} // end namespace itk | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/*========================================================================= | ||
* | ||
* Copyright NumFOCUS | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0.txt | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*=========================================================================*/ | ||
#include "ITKFFTExport.h" | ||
|
||
#include "itkVkComplexToComplex1DFFTImageFilter.h" | ||
#include "itkVkComplexToComplexFFTImageFilter.h" | ||
#include "itkFFTImageFilterFactory.h" | ||
#include "itkVkForward1DFFTImageFilter.h" | ||
#include "itkVkForwardFFTImageFilter.h" | ||
#include "itkVkHalfHermitianToRealInverseFFTImageFilter.h" | ||
#include "itkVkInverse1DFFTImageFilter.h" | ||
#include "itkVkInverseFFTImageFilter.h" | ||
#include "itkVkRealToHalfHermitianForwardFFTImageFilter.h" | ||
|
||
#include "itkVkFFTImageFilterInitFactory.h" | ||
|
||
namespace itk | ||
{ | ||
VkFFTImageFilterInitFactory::VkFFTImageFilterInitFactory() | ||
{ | ||
VkFFTImageFilterInitFactory::RegisterFactories(); | ||
} | ||
|
||
void VkFFTImageFilterInitFactory::RegisterFactories() | ||
{ | ||
itk::ObjectFactoryBase::RegisterFactory(FFTImageFilterFactory<VkComplexToComplex1DFFTImageFilter>::New(), | ||
itk::ObjectFactoryEnums::InsertionPosition::INSERT_AT_FRONT); | ||
itk::ObjectFactoryBase::RegisterFactory(FFTImageFilterFactory<VkComplexToComplexFFTImageFilter>::New(), | ||
itk::ObjectFactoryEnums::InsertionPosition::INSERT_AT_FRONT); | ||
itk::ObjectFactoryBase::RegisterFactory(FFTImageFilterFactory<VkForward1DFFTImageFilter>::New(), | ||
itk::ObjectFactoryEnums::InsertionPosition::INSERT_AT_FRONT); | ||
itk::ObjectFactoryBase::RegisterFactory(FFTImageFilterFactory<VkForwardFFTImageFilter>::New(), | ||
itk::ObjectFactoryEnums::InsertionPosition::INSERT_AT_FRONT); | ||
itk::ObjectFactoryBase::RegisterFactory(FFTImageFilterFactory<VkHalfHermitianToRealInverseFFTImageFilter>::New(), | ||
itk::ObjectFactoryEnums::InsertionPosition::INSERT_AT_FRONT); | ||
itk::ObjectFactoryBase::RegisterFactory(FFTImageFilterFactory<VkInverse1DFFTImageFilter>::New(), | ||
itk::ObjectFactoryEnums::InsertionPosition::INSERT_AT_FRONT); | ||
itk::ObjectFactoryBase::RegisterFactory(FFTImageFilterFactory<VkInverseFFTImageFilter>::New(), | ||
itk::ObjectFactoryEnums::InsertionPosition::INSERT_AT_FRONT); | ||
itk::ObjectFactoryBase::RegisterFactory(FFTImageFilterFactory<VkRealToHalfHermitianForwardFFTImageFilter>::New(), | ||
itk::ObjectFactoryEnums::InsertionPosition::INSERT_AT_FRONT); | ||
} | ||
|
||
// Undocumented API used to register during static initialization. | ||
// DO NOT CALL DIRECTLY. | ||
void VkFFTBackend_EXPORT | ||
VkFFTImageFilterInitFactoryRegister__Private() | ||
{ | ||
VkFFTImageFilterInitFactory::RegisterFactories(); | ||
} | ||
|
||
} // end namespace itk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
itk_wrap_simple_class("itk::VkFFTImageFilterInitFactory" POINTER) |