Commit b106c745 authored by Floris Berendsen's avatar Floris Berendsen
Browse files

ENH: added RegistrationController Component

parent 623070be
......@@ -93,6 +93,7 @@ selxmodule_enable( ModuleSinksAndSources )
selxmodule_enable( ModuleItkSmoothingRecursiveGaussianImageFilter )
selxmodule_enable( ModuleItkImageRegistrationMethodv4 )
selxmodule_enable( ModuleElastixComponent )
selxmodule_enable( ModuleController )
#selxmodule_enable( ModuleCommandLine )
include(${CMAKE_SOURCE_DIR}/Modules/CommandLine/CommandLine.cmake)
# TODO: Build tests depending on enabled modules
......
#=========================================================================
#
# 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.
#
#=========================================================================
set( MODULE ModuleController )
# Export include files
set( ${MODULE}_INCLUDE_DIRS
${${MODULE}_SOURCE_DIR}/include
)
# Collect header files for Visual Studio Project
file(GLOB ${MODULE}_HEADER_FILES "${${MODULE}_SOURCE_DIR}/include/*.*")
# Export libraries
set( ${MODULE}_LIBRARIES
${MODULE}
)
# Export tests
set( ${MODULE}_TESTS
)
# Module source files
set( ${MODULE}_SOURCE_FILES
${${MODULE}_SOURCE_DIR}/src/selxRegistrationController.cxx
)
# Compile library
add_library( ${MODULE} STATIC "${${MODULE}_SOURCE_FILES}" ${${MODULE}_HEADER_FILES})
target_link_libraries( ${MODULE} ${SUPERELASTIX_LIBRARIES} )
/*=========================================================================
*
* 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 selxRegistrationController_h
#define selxRegistrationController_h
#include "ComponentBase.h"
#include "Interfaces.h"
#include <string.h>
#include "selxMacro.h"
namespace selx
{
template<bool dummy = true>
class RegistrationControllerComponent :
public Implements <
Accepting< RunRegistrationInterface, ReconnectTransformInterface, AfterRegistrationInterface >,
Providing < RegistrationControllerStartInterface >
>
{
public:
selxNewMacro(RegistrationControllerComponent, ComponentBase);
//itkStaticConstMacro(Dimensionality, unsigned int, Dimensionality);
RegistrationControllerComponent();
virtual ~RegistrationControllerComponent();
// Accepting Interfaces:
virtual int Set(RunRegistrationInterface*) override;
virtual int Set(ReconnectTransformInterface*) override;
virtual int Set(AfterRegistrationInterface*) override;
// Providing Interfaces:
virtual void RegistrationControllerStart(void) override;
virtual bool MeetsCriterion(const ComponentBase::CriterionType &criterion) override;
static const char * GetDescription() { return "RegistrationController Component"; };
private:
RunRegistrationInterface* m_RunRegistrationInterface;
ReconnectTransformInterface* m_ReconnectTransformInterface;
AfterRegistrationInterface* m_AfterRegistrationInterface;
protected:
};
} //end namespace selx
#ifndef ITK_MANUAL_INSTANTIATION
#include "selxRegistrationController.hxx"
#endif
#endif // #define selxRegistrationController_h
\ No newline at end of file
/*=========================================================================
*
* 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.
*
*=========================================================================*/
#include "selxRegistrationController.h"
namespace selx
{
template<bool dummy>
RegistrationControllerComponent< dummy>::RegistrationControllerComponent() :
m_RunRegistrationInterface(nullptr), m_ReconnectTransformInterface(nullptr), m_AfterRegistrationInterface(nullptr)
{
}
template<bool dummy>
RegistrationControllerComponent< dummy>::~RegistrationControllerComponent()
{
}
template<bool dummy>
int RegistrationControllerComponent< dummy>::Set(RunRegistrationInterface* other)
{
this->m_RunRegistrationInterface = other;
return 0;
}
template<bool dummy>
int RegistrationControllerComponent< dummy>::Set(ReconnectTransformInterface* other)
{
this->m_ReconnectTransformInterface = other;
return 0;
}
template<bool dummy>
int RegistrationControllerComponent< dummy>::Set(AfterRegistrationInterface* other)
{
this->m_AfterRegistrationInterface = other;
return 0;
}
template<bool dummy>
void RegistrationControllerComponent< dummy>::RegistrationControllerStart()
{
this->m_RunRegistrationInterface->RunRegistration();
this->m_ReconnectTransformInterface->ReconnectTransform();
this->m_AfterRegistrationInterface->AfterRegistration();
}
template<bool dummy>
bool RegistrationControllerComponent< dummy>::MeetsCriterion(const ComponentBase::CriterionType &criterion)
{
bool hasUndefinedCriteria(false);
bool meetsCriteria(false);
if (criterion.first == "ComponentProperty")
{
meetsCriteria = true;
for (auto const & criterionValue : criterion.second) // auto&& preferred?
{
if (criterionValue != "SomeProperty") // e.g. "GradientDescent", "SupportsSparseSamples
{
meetsCriteria = false;
}
}
}
return meetsCriteria;
}
} //end namespace selx
/*=========================================================================
*
* 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.
*
*=========================================================================*/
#include "selxRegistrationController.h"
......@@ -48,13 +48,6 @@ namespace selx
return 0;
}
//template<int Dimensionality, class TPixel>
//int ItkImageSinkComponent< Dimensionality, TPixel>::Set(GetItkImageInterface<Dimensionality, TPixel>* other)
//{
// this->m_ProvidingGetItkImageInterface = other;
// return 0;
//}
template<int Dimensionality, class TPixel>
void ItkImageSinkComponent< Dimensionality, TPixel>::AfterRegistration()
{
......
......@@ -42,6 +42,8 @@
#include "selxItkImageSourceFixed.h"
#include "selxItkImageSourceMoving.h"
#include "selxRegistrationController.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
......@@ -94,7 +96,8 @@ public:
ItkTransformDisplacementFilterComponent<2, float, double >,
ItkTransformDisplacementFilterComponent<3, double, double >,
ItkResampleFilterComponent<2, float, double >,
ItkResampleFilterComponent<3, double, double >> RegisterComponents;
ItkResampleFilterComponent<3, double, double >,
RegistrationControllerComponent<>> RegisterComponents;
typedef SuperElastixFilter<RegisterComponents> SuperElastixFilterType;
......
......@@ -198,6 +198,14 @@ struct InterfaceName < itkTransformInterface <InternalComputationValueType, D> >
}
};
template <>
struct InterfaceName < RegistrationControllerStartInterface >
{
static const char* Get()
{
return "RegistrationControllerStartInterface";
}
};
template <>
struct InterfaceName < RunRegistrationInterface >
......
......@@ -137,30 +137,34 @@ namespace selx
virtual DataObjectPointer GetInitializedOutput(void) = 0;
};
class RunRegistrationInterface {
class RegistrationControllerStartInterface {
// A special interface: the Overlord checks components for this type of interface.
// This interface is for to control the execution of the network
// This interface is to control the execution of the network
public:
virtual void RegistrationControllerStart() = 0;
};
class RunRegistrationInterface {
// This interface is to control the execution of the network
public:
virtual void RunRegistration() = 0;
};
class AfterRegistrationInterface {
// A special interface: the Overlord checks components for this type of interface.
// This interface is for to control the execution of the network
// This interface is to control the execution of the network
public:
virtual void AfterRegistration() = 0;
};
class RunResolutionInterface {
// A special interface: the Overlord checks components for this type of interface.
// This interface is for to control the execution of the network
// This interface is to control the execution of the network
public:
virtual bool RunResolution() = 0;
};
class ReconnectTransformInterface {
// A special interface: the Overlord checks components for this type of interface.
// This interface is for to control the execution of the network
// This interface is to control the execution of the network
public:
virtual void ReconnectTransform() = 0;
};
......
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