Skip to content
Snippets Groups Projects
Commit a998d526 authored by Kasper Marstal's avatar Kasper Marstal
Browse files

ENH: ELASTIX-9 Update elastix module api

parent 54a1c805
No related branches found
No related tags found
No related merge requests found
......@@ -16,28 +16,25 @@ macro( _elxmodule_enable MODULE )
_elxmodule_check_name( ${MODULE} )
if( NOT ${MODULE}_ENABLED )
set( "${MODULE}_ENABLED" ON )
set( USE_${MODULE} ON )
add_subdirectory( "${${MODULE}_SOURCE_DIR}" )
include( ${${MODULE}_FILE} )
if( ${MODULE}_INCLUDE_DIRS )
include_directories( ${${MODULE}_INCLUDE_DIRS} )
endif()
add_subdirectory( ${${MODULE}_SOURCE_DIR} )
if( ${MODULE}_LIBRARIES )
link_directories( ${${MODULE}_LIBRARY_DIR} )
endif()
link_directories( ${${MODULE}_LIBRARY_DIRS} )
if( ${${MODULE}_LIBRARIES} )
list( APPEND ELASTIX_LIBRARIES
${${MODULE}_LIBRARIES}
)
endif()
# TODO: Add recursive dependency walk
# foreach( DEPENDENCY IN LISTS ${MODULE}_DEPENDS )
# _elxmodule_enable( ${DEPENDENCY} )
# endforeach()
endif()
endmacro()
......@@ -49,7 +46,7 @@ macro( _elxmodules_initialize )
set( ELXMODULE_ALL )
file( GLOB MODULE_FILES RELATIVE "${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/Modules/*/ELXMODULE_*.cmake"
"${CMAKE_SOURCE_DIR}/Modules/*/elxModule*.cmake"
)
message( STATUS "Found the following elastix modules:")
......@@ -59,10 +56,14 @@ macro( _elxmodules_initialize )
message( STATUS " ${MODULE}" )
option( "USE_${MODULE}" OFF )
set( "${MODULE}_FILE" ${CMAKE_SOURCE_DIR}/${MODULE_FILE} )
set( "${MODULE}_ENABLED" OFF )
set( ${MODULE}_SOURCE_DIR ${CMAKE_SOURCE_DIR}/${MODULE_PATH} )
set( ${MODULE}_BINARY_DIR ${CMAKE_BINARY_DIR}/${MODULE_PATH} )
set( ${MODULE}_INCLUDE_DIRS )
set( ${MODULE}_LIBRARY_DIRS )
set( ${MODULE}_LIBRARIES )
list(APPEND ELXMODULE_ALL ${MODULE} )
......@@ -75,8 +76,12 @@ _elxmodules_initialize()
# Public interface
macro( elxmodule_enable MODULE )
option( USE_${MODULE} ON )
_elxmodule_enable( ${MODULE} )
endmacro()
macro( elxmodule_compile MODULE )
project( "${MODULE}" )
add_library( ${MODULE} STATIC "${${MODULE}_SOURCE_FILES}" )
target_link_libraries( ${MODULE} ${ELASTIX_LIBRARIES} )
list( APPEND ${MODULE}_LIBRARIES ${MODULE} )
endmacro()
......@@ -7,10 +7,15 @@ set( MSVC_INCREMENTAL_DEFAULT ON )
# ---------------------------------------------------------------------
project( Elastix )
# Place libraries and executables in the bin directory
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/bin"
)
# Include SuperElastix CMake scripts
set( CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/CMake"
${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/CMake"
)
if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC" )
......@@ -27,26 +32,14 @@ include( "${CMAKE_CURRENT_SOURCE_DIR}/CMake/elxITKRequiredModules.cmake" )
# ---------------------------------------------------------------------
# Boost Graph Library
find_package( Boost REQUIRED graph )
include_directories(${Boost_INCLUDE_DIRS})
include_directories( ${Boost_INCLUDE_DIRS} )
# ---------------------------------------------------------------------
# Build Elastix
set( ELASTIX_COMMON_INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/Modules/Core/Common/include
)
set( ELASTIX_CORE_INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/Modules/Core/Blueprints/include
)
set( ELASTIX_INCLUDE_DIRECTORIES
${ELASTIX_COMMON_INCLUDE_DIRECTORIES}
${ELASTIX_CORE_INCLUDE_DIRECTORIES}
)
include_directories( ${ELASTIX_INCLUDE_DIRECTORIES} )
add_subdirectory( Modules )
# For now we just enable all modules
include( "${CMAKE_CURRENT_SOURCE_DIR}/CMake/elxModules.cmake" )
elxmodule_enable( elxModuleCore )
# ---------------------------------------------------------------------
# Testing
......
include_directories( include )
add_subdirectory( src )
......@@ -2,6 +2,7 @@
#define __ComponentDescriptor_h
#include "elxMacro.h"
#include "itkObjectFactory.h"
#include "itkDataObject.h"
namespace elx {
......@@ -15,6 +16,9 @@ public:
// Identifier to find component in the component database
typedef std::string ComponentNameType;
ComponentDescriptor( void ) { this->SetComponentName( ComponentNameType() ); }
ComponentDescriptor( const ComponentNameType componentName );
// TODO: Setter should validate ComponentName exists in ComponentDatabase
itkSetMacro( ComponentName, ComponentNameType );
itkGetMacro( ComponentName, ComponentNameType );
......
message( STATUS "In directory ${CMAKE_CURRENT_LIST_DIR}" )
add_library( Blueprints
elxComponentDescriptor.cxx
elxBlueprint.cxx
)
\ No newline at end of file
......@@ -5,16 +5,10 @@
#include "elxBlueprint.h"
namespace elastix {
namespace elx {
void
Blueprint< ComponentDescriptor >
::Blueprint( void )
{
this->SetGraph( GraphType );
}
ComponentDescriptorType
/*
Blueprint< ComponentDescriptor >::ComponentDescriptorType
Blueprint< ComponentDescriptor >
::AddComponent( ComponentDescriptorType component )
{
......@@ -70,11 +64,14 @@ Blueprint< ComponentDescriptor >
// boost::write_graphviz(std::cout, this->m_Graph);
std::cout << "Printed graph" << std::endl;
}
void
*/
template<>
int
Blueprint< ComponentDescriptor >
::TestFunction( void )
{ return 0; }
}
} // namespace elx
#endif // __Blueprint_hxx
\ No newline at end of file
#ifndef __ComponentDescriptor_hxx
#define __ComponentDescriptor_hxx
#ifndef __ComponentDescriptor_cxx
#define __ComponentDescriptor_cxx
#include "elxComponentDescriptor.h"
......@@ -11,36 +11,8 @@ ComponentDescriptor
::ComponentDescriptor( const ComponentNameType componentName )
{
this->SetComponentName( componentName );
this->SetComponentUniqueId( this->GenerateUniqueId() );
this->SetParameterMap( this->ParameterMapType() );
}
ComponentDescriptor
::ComponentDescriptor( const ComponentNameType componentName,
const ComponentUniqueIdType componentUniqueId )
{
this->SetComponentName( componentName );
this->SetComponentUniqueId( componentUniqueId );
this->SetParameterMap( this->ParameterMapType() );
}
ComponentDescriptor
::ComponentDescriptor( const ComponentNameType componentName,
const ComponentIdType componentUniqueId,
const ParameterMapType parameterMap )
{
this->SetComponentName( componentName );
this->SetComponentUniqueId( componentUniqueId );
this->SetParameterMap( parameterMap );
}
ComponentDescriptor::ComponentIdType
ComponentDescriptor
::GenerateUniqueId()
{
}
} // namespace elx
#endif // __ComponentDescriptor_hxx
\ No newline at end of file
#endif // __ComponentDescriptor_cxx
\ No newline at end of file
project( ELXMODULE_CORE )
# TODO: Include directures using the module API
include_directories(
Common/include
Blueprints/include
)
add_subdirectory( Common )
add_subdirectory( Blueprints )
set( "${PROJECT_NAME}_LIBRARIES"
Blueprints
)
elxmodule_compile( ${MODULE} )
include_directories( include )
set( DOCUMENTATION
"This module contains the core components of elastix library such as the component database and component pipeline instantiation functionality."
)
elxmodule_enable( ELXMODULE_CORE
DEPENDS
ELXMODULE_COMMON
DESCRIPTION
"${DOCUMENTATION}"
)
set( ${MODULE}_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/${MODULE_PATH}/Common/include
${CMAKE_SOURCE_DIR}/${MODULE_PATH}/Blueprints/include
)
set( ${MODULE}_SOURCE_FILES
${CMAKE_SOURCE_DIR}/${MODULE_PATH}/Blueprints/src/elxComponentDescriptor.cxx
${CMAKE_SOURCE_DIR}/${MODULE_PATH}/Blueprints/src/elxBlueprint.cxx
)
set( ${MODULE}_LIBRARIES
elxModuleCore
)
\ No newline at end of file
......@@ -24,4 +24,4 @@ TEST( Blueprint, Instantiation )
ASSERT_TRUE( true );
}
} // namespace elx
\ No newline at end of file
} // namespace elx
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment