Commit 53e80653 authored by Floris Berendsen's avatar Floris Berendsen
Browse files

ENH: changed all unit test to use the

SuperElastixFilterCustomComponents<...>
parent a0d63082
......@@ -17,9 +17,8 @@
*
*=========================================================================*/
#include "selxSuperElastixFilter.h"
#include "selxRegisterComponentFactoriesByTypeList.h"
#include "selxDefaultComponents.h"
#include "selxSuperElastixFilterCustomComponents.h"
#include "selxRegistrationController.h"
#include "selxNiftyregReadImageComponent.h"
......@@ -47,10 +46,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();
// Instantiate SuperElastixFilter before each test and
// register the components we want to have available in SuperElastix
superElastixFilter = SuperElastixFilterCustomComponents< RegisterComponents >::New();
dataManager = DataManagerType::New();
}
......
......@@ -17,8 +17,7 @@
*
*=========================================================================*/
#include "selxSuperElastixFilter.h"
#include "selxRegisterComponentFactoriesByTypeList.h"
#include "selxSuperElastixFilterCustomComponents.h"
#include "selxTransformComponent1.h"
#include "selxMetricComponent1.h"
......@@ -128,10 +127,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();
// Instantiate SuperElastixFilter before each test and
// register the components we want to have available in SuperElastix
superElastixFilter = SuperElastixFilterCustomComponents< RegisterComponents >::New();
dataManager = DataManagerType::New();
}
......
......@@ -17,8 +17,8 @@
*
*=========================================================================*/
#include "selxSuperElastixFilter.h"
#include "selxRegisterComponentFactoriesByTypeList.h"
#include "selxSuperElastixFilterCustomComponents.h"
#include "itkSharedPointerDataObjectDecorator.h"
#include "selxItkSmoothingRecursiveGaussianImageFilterComponent.h"
......@@ -86,6 +86,7 @@ public:
virtual void TearDown()
{
// Unregister all components after each test
// TODO: when SuperElastix is refactored to not use the ITK object factory this UnRegisterAllFactories call must be removed
itk::ObjectFactoryBase::UnRegisterAllFactories();
// Delete the SuperElastixFilter after each test
superElastixFilter = nullptr;
......@@ -113,10 +114,11 @@ TEST_F( SuperElastixFilterTest, ImageOnly )
blueprint->SetConnection( "InputImage", "ImageFilter", { {} } ); //
blueprint->SetConnection( "ImageFilter", "OutputImage", { {} } );
// Instantiate SuperElastixFilter before each test
EXPECT_NO_THROW(superElastixFilter = SuperElastixFilter::New());
// Register the components we want to have available in SuperElastix
RegisterFactoriesByTypeList< RegisterComponents >::Register();
// Instantiate SuperElastixFilter before each test and
// register the components we want to have available in SuperElastix
EXPECT_NO_THROW(superElastixFilter = SuperElastixFilterCustomComponents<RegisterComponents>::New());
SuperElastixFilterBlueprintPointer superElastixBlueprint = SuperElastixFilterBlueprintType::New();
superElastixBlueprint->Set( blueprint );
......@@ -153,10 +155,9 @@ TEST_F( SuperElastixFilterTest, ImageAndMesh )
blueprint->SetComponent( "OutputMesh", { { "NameOfClass", { "ItkMeshSinkComponent" } } } );
blueprint->SetConnection( "InputMesh", "OutputMesh", Blueprint::ParameterMapType() );
// Instantiate SuperElastixFilter before each test
EXPECT_NO_THROW(superElastixFilter = SuperElastixFilter::New());
// Register the components we want to have available in SuperElastix
RegisterFactoriesByTypeList< RegisterComponents >::Register();
// Instantiate SuperElastixFilter before each test and
// register the components we want to have available in SuperElastix
EXPECT_NO_THROW(superElastixFilter = SuperElastixFilterCustomComponents<RegisterComponents>::New());
SuperElastixFilterBlueprintPointer superElastixFilterBlueprint = SuperElastixFilterBlueprintType::New();
superElastixFilterBlueprint->Set( blueprint );
......@@ -184,10 +185,9 @@ TEST_F( SuperElastixFilterTest, TooManyInputs )
blueprint->SetComponent( "Source_A", { { "NameOfClass", { "ItkImageSourceComponent" } } } );
// Instantiate SuperElastixFilter before each test
EXPECT_NO_THROW(superElastixFilter = SuperElastixFilter::New());
// Register the components we want to have available in SuperElastix
RegisterFactoriesByTypeList< RegisterComponents >::Register();
// Instantiate SuperElastixFilter before each test and
// register the components we want to have available in SuperElastix
EXPECT_NO_THROW(superElastixFilter = SuperElastixFilterCustomComponents<RegisterComponents>::New());
SuperElastixFilterBlueprintPointer superElastixFilterBlueprint = SuperElastixFilterBlueprintType::New();
superElastixFilterBlueprint->Set( blueprint );
......@@ -211,10 +211,9 @@ TEST_F( SuperElastixFilterTest, TooManySources )
blueprint->SetComponent( "Source_A", { { "NameOfClass", { "ItkImageSourceComponent" } } } );
blueprint->SetComponent( "Source_B", { { "NameOfClass", { "ItkImageSourceComponent" } } } );
// Instantiate SuperElastixFilter before each test
EXPECT_NO_THROW(superElastixFilter = SuperElastixFilter::New());
// Register the components we want to have available in SuperElastix
RegisterFactoriesByTypeList< RegisterComponents >::Register();
// Instantiate SuperElastixFilter before each test and
// register the components we want to have available in SuperElastix
EXPECT_NO_THROW(superElastixFilter = SuperElastixFilterCustomComponents<RegisterComponents>::New());
SuperElastixFilterBlueprintPointer superElastixFilterBlueprint = SuperElastixFilterBlueprintType::New();
superElastixFilterBlueprint->Set( blueprint );
......@@ -235,10 +234,9 @@ TEST_F( SuperElastixFilterTest, TooManyOutputs )
blueprint->SetComponent( "Sink_A", { { "NameOfClass", { "ItkImageSinkComponent" } } } );
// Instantiate SuperElastixFilter before each test
EXPECT_NO_THROW(superElastixFilter = SuperElastixFilter::New());
// Register the components we want to have available in SuperElastix
RegisterFactoriesByTypeList< RegisterComponents >::Register();
// Instantiate SuperElastixFilter before each test and
// register the components we want to have available in SuperElastix
EXPECT_NO_THROW(superElastixFilter = SuperElastixFilterCustomComponents<RegisterComponents>::New());
SuperElastixFilterBlueprintPointer superElastixFilterBlueprint = SuperElastixFilterBlueprintType::New();
superElastixFilterBlueprint->Set( blueprint );
......@@ -259,10 +257,9 @@ TEST_F( SuperElastixFilterTest, TooManySinks )
blueprint->SetComponent( "Sink_A", { { "NameOfClass", { "ItkImageSinkComponent" } } } );
blueprint->SetComponent( "Sink_B", { { "NameOfClass", { "ItkImageSinkComponent" } } } );
// Instantiate SuperElastixFilter before each test
EXPECT_NO_THROW(superElastixFilter = SuperElastixFilter::New());
// Register the components we want to have available in SuperElastix
RegisterFactoriesByTypeList< RegisterComponents >::Register();
// Instantiate SuperElastixFilter before each test and
// register the components we want to have available in SuperElastix
EXPECT_NO_THROW(superElastixFilter = SuperElastixFilterCustomComponents<RegisterComponents>::New());
SuperElastixFilterBlueprintPointer superElastixFilterBlueprint = SuperElastixFilterBlueprintType::New();
superElastixFilterBlueprint->Set( blueprint );
......
......@@ -17,8 +17,7 @@
*
*=========================================================================*/
#include "selxSuperElastixFilter.h"
#include "selxRegisterComponentFactoriesByTypeList.h"
#include "selxSuperElastixFilterCustomComponents.h"
#include "selxItkSmoothingRecursiveGaussianImageFilterComponent.h"
#include "selxItkImageSink.h"
......@@ -70,10 +69,11 @@ 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();
// Instantiate SuperElastixFilter before each test and
// register the components we want to have available in SuperElastix
superElastixFilter = SuperElastixFilterCustomComponents< RegisterComponents >::New();
dataManager = DataManagerType::New();
/** make example blueprint configuration */
......
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