Commit a25787fb authored by Kasper Marstal's avatar Kasper Marstal
Browse files

ENH: Blueprint refactor fully ported to tests

parent 163c9265
......@@ -43,12 +43,12 @@ class ElastixComponentTest : public ::testing::Test
{
public:
typedef std::unique_ptr< Blueprint > BlueprintPointer;
typedef itk::AutoPointerDataObjectDecorator< Blueprint > BlueprintITKType;
typedef BlueprintITKType::Pointer BlueprintITKPointer;
typedef Blueprint::ParameterMapType ParameterMapType;
typedef Blueprint::ParameterValueType ParameterValueType;
typedef DataManager DataManagerType;
typedef std::shared_ptr< Blueprint > BlueprintPointer;
typedef itk::SharedPointerDataObjectDecorator< Blueprint > BlueprintITKType;
typedef BlueprintITKType::Pointer BlueprintITKPointer;
typedef Blueprint::ParameterMapType ParameterMapType;
typedef Blueprint::ParameterValueType ParameterValueType;
typedef DataManager DataManagerType;
/** Make a list of components to be registered for this test*/
typedef TypeList< ElastixComponent< 2, float >,
......@@ -150,7 +150,7 @@ TEST_F( ElastixComponentTest, ImagesOnly )
resultImageWriter->SetInput( superElastixFilter->GetOutput< Image2DType >( "ResultImageSink" ) );
BlueprintITKPointer ITKBlueprint = BlueprintITKType::New();
ITKBlueprint->Set( blueprint.get() );
ITKBlueprint->Set( blueprint );
EXPECT_NO_THROW( superElastixFilter->SetBlueprint( ITKBlueprint ) );
//Optional Update call
......@@ -215,7 +215,7 @@ TEST_F( ElastixComponentTest, MonolithicElastixTransformix )
resultImageWriter->SetInput( superElastixFilter->GetOutput< Image2DType >( "ResultImageSink" ) );
BlueprintITKPointer ITKBlueprint = BlueprintITKType::New();
ITKBlueprint->Set( blueprint.get() );
ITKBlueprint->Set( blueprint );
EXPECT_NO_THROW( superElastixFilter->SetBlueprint( ITKBlueprint ) );
//Optional Update call
......
......@@ -105,7 +105,10 @@ public:
typedef SuperElastixFilter< RegisterComponents > SuperElastixFilterType;
typedef std::unique_ptr< Blueprint > BlueprintPointer;
typedef std::shared_ptr< Blueprint > BlueprintPointer;
typedef itk::SharedPointerDataObjectDecorator< Blueprint > BlueprintITKType;
typedef BlueprintITKType::Pointer BlueprintITKPointer;
typedef SuperElastixFilterType::BlueprintType SuperElastixFilterBlueprintType;
typedef SuperElastixFilterType::Pointer SuperElastixFilterBlueprintPointer;
typedef SuperElastixFilterType::ConstPointer SuperElastixFilterBlueprintConstPointer;
......@@ -200,8 +203,8 @@ TEST_F( RegistrationItkv4Test, DISABLED_3DImagesOnly )
superElastixFilter->SetInput( "MovingImageSource", movingImageReader->GetOutput() );
resultImageWriter->SetInput( superElastixFilter->GetOutput< Image3DType >( "ResultImageSink" ) );
itk::AutoPointerDataObjectDecorator< Blueprint >::Pointer superElastixFilterBlueprint = itk::AutoPointerDataObjectDecorator< Blueprint >::New();
superElastixFilterBlueprint->Set( blueprint.get() );
BlueprintITKPointer superElastixFilterBlueprint = BlueprintITKType::New();
superElastixFilterBlueprint->Set( blueprint );
EXPECT_NO_THROW( superElastixFilter->SetBlueprint( superElastixFilterBlueprint ) );
//Optional Update call
......@@ -291,8 +294,8 @@ TEST_F( RegistrationItkv4Test, DISABLED_3DANTSCCMetric )
superElastixFilter->SetInput( "MovingImageSource", movingImageReader->GetOutput() );
resultImageWriter->SetInput( superElastixFilter->GetOutput< Image3DType >( "ResultImageSink" ) );
itk::AutoPointerDataObjectDecorator< Blueprint >::Pointer superElastixFilterBlueprint = itk::AutoPointerDataObjectDecorator< Blueprint >::New();
superElastixFilterBlueprint->Set( blueprint.get() );
BlueprintITKPointer superElastixFilterBlueprint = BlueprintITKType::New();
superElastixFilterBlueprint->Set( blueprint );
EXPECT_NO_THROW( superElastixFilter->SetBlueprint( superElastixFilterBlueprint ) );
//Optional Update call
......@@ -382,8 +385,8 @@ TEST_F( RegistrationItkv4Test, DISABLED_3DMeanSquaresMetric )
superElastixFilter->SetInput( "MovingImageSource", movingImageReader->GetOutput() );
resultImageWriter->SetInput( superElastixFilter->GetOutput< Image3DType >( "ResultImageSink" ) );
itk::AutoPointerDataObjectDecorator< Blueprint >::Pointer superElastixFilterBlueprint = itk::AutoPointerDataObjectDecorator< Blueprint >::New();
superElastixFilterBlueprint->Set( blueprint.get() );
BlueprintITKPointer superElastixFilterBlueprint = BlueprintITKType::New();
superElastixFilterBlueprint->Set( blueprint );
EXPECT_NO_THROW( superElastixFilter->SetBlueprint( superElastixFilterBlueprint ) );
//Optional Update call
......@@ -512,8 +515,8 @@ TEST_F( RegistrationItkv4Test, FullyConfigured3d )
resultImageWriter->SetInput( superElastixFilter->GetOutput< Image3DType >( "ResultImageSink" ) );
resultDisplacementWriter->SetInput( superElastixFilter->GetOutput< DisplacementImage3DType >( "ResultDisplacementFieldSink" ) );
itk::AutoPointerDataObjectDecorator< Blueprint >::Pointer superElastixFilterBlueprint = itk::AutoPointerDataObjectDecorator< Blueprint >::New();
superElastixFilterBlueprint->Set( blueprint.get() );
BlueprintITKPointer superElastixFilterBlueprint = BlueprintITKType::New();
superElastixFilterBlueprint->Set( blueprint );
EXPECT_NO_THROW( superElastixFilter->SetBlueprint( superElastixFilterBlueprint ) );
//Optional Update call
......@@ -637,8 +640,8 @@ TEST_F( RegistrationItkv4Test, FullyConfigured3dAffine )
resultImageWriter->SetInput( superElastixFilter->GetOutput< Image3DType >( "ResultImageSink" ) );
resultDisplacementWriter->SetInput( superElastixFilter->GetOutput< DisplacementImage3DType >( "ResultDisplacementFieldSink" ) );
itk::AutoPointerDataObjectDecorator< Blueprint >::Pointer superElastixFilterBlueprint = itk::AutoPointerDataObjectDecorator< Blueprint >::New();
superElastixFilterBlueprint->Set( blueprint.get() );
BlueprintITKPointer superElastixFilterBlueprint = BlueprintITKType::New();
superElastixFilterBlueprint->Set( blueprint );
EXPECT_NO_THROW( superElastixFilter->SetBlueprint( superElastixFilterBlueprint ) );
//Optional Update call
......@@ -740,8 +743,8 @@ TEST_F(RegistrationItkv4Test, CompositeTransform)
resultImageWriter->SetInput(superElastixFilter->GetOutput< Image2DType >("ResultImageSink"));
itk::AutoPointerDataObjectDecorator< Blueprint >::Pointer superElastixFilterBlueprint = itk::AutoPointerDataObjectDecorator< Blueprint >::New();
superElastixFilterBlueprint->Set( blueprint.get() );
BlueprintITKPointer superElastixFilterBlueprint = BlueprintITKType::New();
superElastixFilterBlueprint->Set( blueprint );
EXPECT_NO_THROW( superElastixFilter->SetBlueprint( superElastixFilterBlueprint ) );
//Optional Update call
......
......@@ -61,7 +61,9 @@ class SyNRegistrationItkv4Test : public ::testing::Test
{
public:
typedef std::unique_ptr< Blueprint > BlueprintPointer;
typedef std::shared_ptr< Blueprint > BlueprintPointer;
typedef itk::SharedPointerDataObjectDecorator< Blueprint > BlueprintITKType;
typedef BlueprintITKType::Pointer BlueprintITKPointer;
typedef Blueprint::ParameterMapType ParameterMapType;
typedef Blueprint::ParameterValueType ParameterValueType;
typedef DataManager DataManagerType;
......@@ -232,10 +234,11 @@ TEST_F( SyNRegistrationItkv4Test, FullyConfigured3d )
resultImageWriter->SetInput( superElastixFilter->GetOutput< Image3DType >( "ResultImageSink" ) );
resultDisplacementWriter->SetInput( superElastixFilter->GetOutput< DisplacementImage3DType >( "ResultDisplacementFieldSink" ) );
itk::AutoPointerDataObjectDecorator< Blueprint >::Pointer superElastixFilterBlueprint = itk::AutoPointerDataObjectDecorator< Blueprint >::New();
superElastixFilterBlueprint->Set( blueprint.get() );
BlueprintITKPointer superElastixFilterBlueprint = BlueprintITKType::New();
superElastixFilterBlueprint->Set( blueprint );
EXPECT_NO_THROW( superElastixFilter->SetBlueprint( superElastixFilterBlueprint ) );
//Optional Update call
//superElastixFilter->Update();
......@@ -350,8 +353,8 @@ TEST_F( SyNRegistrationItkv4Test, WBIRDemo )
resultImageWriter->SetInput( superElastixFilter->GetOutput< Image2DType >( "ResultImageSink" ) );
resultDisplacementWriter->SetInput( superElastixFilter->GetOutput< DisplacementImage2DType >( "ResultDisplacementFieldSink" ) );
itk::AutoPointerDataObjectDecorator< Blueprint >::Pointer superElastixFilterBlueprint = itk::AutoPointerDataObjectDecorator< Blueprint >::New();
superElastixFilterBlueprint->Set( blueprint.get() );
BlueprintITKPointer superElastixFilterBlueprint = BlueprintITKType::New();
superElastixFilterBlueprint->Set( blueprint );
EXPECT_NO_THROW( superElastixFilter->SetBlueprint( superElastixFilterBlueprint ) );
//Optional Update call
......
......@@ -52,9 +52,7 @@ namespace itk
{
if ( m_Component != val )
{
// store the pointer and take ownership of the memory
ComponentPointer aPointer(val);
m_Component = aPointer;
m_Component = val;
this->Modified();
}
}
......
......@@ -46,7 +46,7 @@ namespace selx
class itkImageFilterTest : public ::testing::Test
{
public:
using BlueprintITKType = itk::AutoPointerDataObjectDecorator< Blueprint >;
using BlueprintITKType = itk::SharedPointerDataObjectDecorator< Blueprint >;
typedef BlueprintITKType::Pointer BlueprintITKPointer;
typedef std::shared_ptr< Blueprint > BlueprintPointer;
......@@ -111,7 +111,7 @@ public:
blueprint->SetConnection( "SecondStageFilter", "Sink", connectionParameters );
BlueprintITKPointer ITKBlueprint = BlueprintITKType::New();
ITKBlueprint->Set( blueprint.get() );
ITKBlueprint->Set( blueprint );
}
......
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