Commit 14f4c262 authored by Floris Berendsen's avatar Floris Berendsen
Browse files

WIP: added templated Constructor for SuperElastixFilter

parent 41d8c803
......@@ -17,8 +17,7 @@
*
*=========================================================================*/
#include "selxSuperElastixFilter.h"
#include "selxRegisterComponentFactoriesByTypeList.h"
#include "selxSuperElastixFilterCustomComponents.h"
#include "elxParameterObject.h"
#include "selxElastixComponent.h"
......@@ -68,9 +67,9 @@ public:
virtual void SetUp()
{
// Instantiate SuperElastixFilter before each test
superElastixFilter = SuperElastixFilter::New();
// Register the components we want to have available in SuperElastix
RegisterFactoriesByTypeList< RegisterComponents >::Register();
superElastixFilter = SuperElastixFilterCustomComponents<RegisterComponents>::New();
dataManager = DataManagerType::New();
}
......@@ -84,7 +83,7 @@ public:
}
// Blueprint holds a configuration for SuperElastix
BlueprintPointer blueprint;
SuperElastixFilter::Pointer superElastixFilter;
SuperElastixFilterCustomComponents<RegisterComponents>::Pointer superElastixFilter;
// Data manager provides the paths to the input and output data for unit tests
DataManagerType::Pointer dataManager;
};
......
......@@ -70,7 +70,7 @@ public:
private:
class BlueprintImpl;
struct BlueprintImpl;
std::unique_ptr< BlueprintImpl > m_Pimple;
};
......
......@@ -102,9 +102,12 @@ public:
void Update( void ) ITK_OVERRIDE;
protected:
// default constructor for API library use
SuperElastixFilter( void );
// special constructor which is called by the templated SuperElastixFilter for SDK library use
SuperElastixFilter( bool InitializeEmptyComponentList );
virtual void GenerateOutputInformation( void ) ITK_OVERRIDE;
virtual void GenerateData( void ) ITK_OVERRIDE;
......
/*=========================================================================
*
* Copyright Leiden University Medical Center, Erasmus University Medical
* Center and contributors
*
* 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 selxSuperElastixFilterCustomComponents_h
#define selxSuperElastixFilterCustomComponents_h
#include "selxSuperElastixFilter.h"
/**
* \class SuperElastixFilter
* \brief ITK Filter interface to the SuperElastix registration library.
*/
namespace selx
{
template <typename ComponentList>
class SuperElastixFilterCustomComponents : public SuperElastixFilter
{
public:
/** Standard ITK typedefs. */
typedef SuperElastixFilterCustomComponents Self;
typedef itk::ProcessObject Superclass;
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro( Self );
/** Run-time type information (and related methods). */
itkTypeMacro( Self, itk::ProcessObject );
protected:
// default constructor
SuperElastixFilterCustomComponents(void);
private:
};
} // namespace elx
#ifndef ITK_MANUAL_INSTANTIATION
#include "selxSuperElastixFilterCustomComponents.hxx"
#endif
#endif // selxSuperElastixFilterCustomComponents_h
/*=========================================================================
*
* Copyright Leiden University Medical Center, Erasmus University Medical
* Center and contributors
*
* 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 selxSuperElastixFilterCustomComponents_hxx
#define selxSuperElastixFilterCustomComponents_hxx
#include "selxSuperElastixFilterCustomComponents.h"
#include "selxRegisterComponentFactoriesByTypeList.h"
#include "selxNetworkBuilder.h"
namespace selx
{
/**
* ********************* Constructor *********************
*/
template<typename ComponentTypeList>
SuperElastixFilterCustomComponents<ComponentTypeList>
::SuperElastixFilterCustomComponents(void) : SuperElastixFilter(true)
{
RegisterFactoriesByTypeList< ComponentTypeList >::Register();
} // end Constructor
} // namespace elx
#endif // selxSuperElastixFilterCustomComponents_hxx
......@@ -23,6 +23,8 @@
#include "selxSuperElastixFilter.h"
#include "selxNetworkBuilder.h"
#include "selxRegisterComponentFactoriesByTypeList.h"
#include "selxDefaultComponents.h"
namespace selx
{
......@@ -31,17 +33,24 @@ namespace selx
*/
SuperElastixFilter
::SuperElastixFilter( void ) :
m_InputConnectionModified( true ),
m_OutputConnectionModified( true ),
m_BlueprintConnectionModified( true ),
m_IsConnected( false ),
m_AllUniqueComponents( false )
::SuperElastixFilter(void) : SuperElastixFilter(true)
{
//RegisterFactoriesByTypeList< ComponentTypeList >::Register();
// The default constructor registers the default components.
RegisterFactoriesByTypeList< DefaultComponents >::Register();
} // end Constructor
// Disable "Primary" as required input< C< ComponentTypeList >omponentTypeList >
this->SetRequiredInputNames( {} );
//
SuperElastixFilter
::SuperElastixFilter(bool InitializeEmptyComponentList) :
m_InputConnectionModified(true),
m_OutputConnectionModified(true),
m_BlueprintConnectionModified(true),
m_IsConnected(false),
m_AllUniqueComponents(false)
{
// Disable "Primary" as required input
// TODO: Blueprint should become primary
this->SetRequiredInputNames({});
} // end Constructor
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment