From: Leonardo Florez-Valencia Date: Mon, 11 Apr 2016 23:15:11 +0000 (-0500) Subject: ... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=aaeabf9e79b8db1b97bc3381e95e46c77da4d891;p=FrontAlgorithms.git ... --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 785164b..c022af8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,87 +1,32 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +INCLUDE(cmake/fpa_Policies.cmake) -## ============ -## = Policies = -## ============ - -SET( - policies - CMP0015 - CMP0020 - CMP0042 - ) -FOREACH(policy ${policies}) - IF(POLICY ${policy}) - CMAKE_POLICY(SET ${policy} NEW) - ENDIF(POLICY ${policy}) -ENDFOREACH(policy) - -## ================ -## = Project name = -## ================ +## ================== +## == Project name == +## ================== PROJECT(FrontAlgorithms) SET(prj_MAJ_VER "0") -SET(prj_MIN_VER "0") -SET(prj_REL_VER "1") +SET(prj_MIN_VER "1") +SET(prj_REL_VER "0") SET(prj_VER "${prj_MAJ_VER}.${prj_MIN_VER}.${prj_REL_VER}") SET(prj_sVER "${prj_MAJ_VER}") -## =========== -## = Options = -## =========== - -## OPTION(BUILD_EXAMPLES "Build examples" OFF) -OPTION(BUILD_PLUGINS "Build plugins" OFF) - -## ============ -## = Packages = -## ============ +## ===================== +## == Main dependency == +## ===================== -# NOTE: It seems that by default on Visual Studio Compiler supports c++11, -# so it only need to be test on other O.S. -IF(NOT MSVC) - INCLUDE(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) - CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) - IF(COMPILER_SUPPORTS_CXX11) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - ELSEIF(COMPILER_SUPPORTS_CXX0X) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - ELSE() - MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") - ENDIF() -ENDIF(NOT MSVC) - -# Prepare header to build shared libs (windows) -INCLUDE(GenerateExportHeader) - -# Find cpPlugins FIND_PACKAGE(cpPlugins REQUIRED) -## ================================================ -## = Do not allow to build inside the source tree = -## ================================================ - -IF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR}) - MESSAGE(FATAL_ERROR "Building in the source tree is not allowed") -ENDIF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR}) +## ============= +## == Options == +## ============= -## ===================================== -## = Where to put executables and libs = -## ===================================== - -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}) -SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}) -MARK_AS_ADVANCED( - CMAKE_BACKWARDS_COMPATIBILITY - EXECUTABLE_OUTPUT_PATH - LIBRARY_OUTPUT_PATH - ) +OPTION(BUILD_PLUGINS "Build plugins" ON) -## ============================== -## = Subdirs containing headers = -## ============================== +## ========================= +## == Include directories == +## ========================= INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR} @@ -94,19 +39,15 @@ INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR}/plugins ) -## =========================== -## = Subdirs containing code = -## =========================== +## ============================= +## == Subdirs containing code == +## ============================= SUBDIRS( cmake lib - appli + plugins + # appli ) -IF(BUILD_PLUGINS) - SUBDIRS( - plugins - ) -ENDIF(BUILD_PLUGINS) ## eof - $RCSfile$ diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index fc65c38..44467ab 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -5,7 +5,7 @@ CONFIGURE_FILE( ) ## ======================== -## -- Installation rules -- +## == Installation rules == ## ======================== INSTALL( diff --git a/cmake/FrontAlgorithmsConfig.cmake.in b/cmake/FrontAlgorithmsConfig.cmake.in index c22d4ae..e84ecba 100644 --- a/cmake/FrontAlgorithmsConfig.cmake.in +++ b/cmake/FrontAlgorithmsConfig.cmake.in @@ -1,15 +1,17 @@ # ========================= -# -- Include directories -- +# == Include directories == # ========================= INCLUDE_DIRECTORIES( @PROJECT_SOURCE_DIR@/lib @PROJECT_BINARY_DIR@/lib + @PROJECT_SOURCE_DIR@/lib/fpa_Instances + @PROJECT_BINARY_DIR@/lib/fpa_Instances @CMAKE_INSTALL_PREFIX@/include ) # ========================= -# -- Library directories -- +# == Library directories == # ========================= IF(MSVC) @@ -27,7 +29,7 @@ ELSE(MSVC) ENDIF(MSVC) # =================== -# -- Library names -- +# == Library names == # =================== SET(FrontAlgorithms_LIBRARY FrontAlgorithms) diff --git a/cmake/fpa_Policies.cmake b/cmake/fpa_Policies.cmake new file mode 100644 index 0000000..a26f448 --- /dev/null +++ b/cmake/fpa_Policies.cmake @@ -0,0 +1,13 @@ +SET( + policies + CMP0015 + CMP0020 + CMP0042 + ) +FOREACH(policy ${policies}) + IF(POLICY ${policy}) + CMAKE_POLICY(SET ${policy} NEW) + ENDIF(POLICY ${policy}) +ENDFOREACH(policy) + +## eof - $RCSfile$ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 3efe1bc..feb186e 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,113 +1,7 @@ -SET(lib_NAME fpa) - -## ================ -## = Source files = -## ================ - -CONFIGURE_FILE( - fpa/Common.cxx.in - ${PROJECT_BINARY_DIR}/lib/fpa/Common.cxx - ) - -FILE(GLOB ${lib_NAME}_HEADERS "fpa/*.h" "fpa/*.hxx") -FILE(GLOB ${lib_NAME}_BASE_HEADERS "fpa/Base/*.h" "fpa/Base/*.hxx") -FILE(GLOB ${lib_NAME}_IO_HEADERS "fpa/IO/*.h" "fpa/IO/*.hxx") -FILE(GLOB ${lib_NAME}_IMAGE_HEADERS "fpa/Image/*.h" "fpa/Image/*.hxx") - -FILE(GLOB ${lib_NAME}_SOURCES "fpa/*.cxx") -FILE(GLOB ${lib_NAME}_BASE_SOURCES "fpa/Base/*.cxx") -FILE(GLOB ${lib_NAME}_IO_SOURCES "fpa/IO/*.cxx") -FILE(GLOB ${lib_NAME}_IMAGE_SOURCES "fpa/Image/*.cxx") - -FILE(GLOB ${lib_NAME}_VTK_HEADERS "fpa/VTK/*.h" "fpa/VTK/*.hxx") -FILE(GLOB ${lib_NAME}_VTK_SOURCES "fpa/VTK/*.cxx") - -SET( - ${lib_NAME}_ALL_SOURCES - ${PROJECT_BINARY_DIR}/lib/fpa/Common.cxx - ${${lib_NAME}_SOURCES} - ${${lib_NAME}_BASE_SOURCES} - ${${lib_NAME}_IO_SOURCES} - ${${lib_NAME}_IMAGE_SOURCES} - ${${lib_NAME}_VTK_SOURCES} - ) - -## ============= -## = Libraries = -## ============= - -SET( - ${lib_NAME}_LINK_LIBRARIES - ${ITK_LIBRARIES} - ${VTK_LIBRARIES} - ) - -## ===================== -## = Compilation rules = -## ===================== - -ADD_LIBRARY( - ${lib_NAME} - SHARED - ${${lib_NAME}_ALL_SOURCES} - ) -SET_TARGET_PROPERTIES( - ${lib_NAME} PROPERTIES - VERSION "${prj_VER}" - SOVERSION "${prj_sVER}" - ) -GENERATE_EXPORT_HEADER( - ${lib_NAME} - BASE_NAME ${lib_NAME} - EXPORT_MACRO_NAME ${lib_NAME}_EXPORT - EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/fpa/${lib_NAME}_Export.h - STATIC_DEFINE ${lib_NAME}_BUILT_AS_STATIC - ) -TARGET_LINK_LIBRARIES( - ${lib_NAME} - ${${lib_NAME}_LINK_LIBRARIES} - ) - -## ======================== -## -- Installation rules -- -## ======================== - -INSTALL( - TARGETS ${lib_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib/static - ) -SET( - local_install_dirs - fpa - ) -FOREACH(dir ${local_install_dirs}) - INSTALL( - DIRECTORY ${dir} - DESTINATION include - FILES_MATCHING PATTERN "*.h" +IF(BUILD_PLUGINS) + SUBDIRS( + fpa_Instances ) - INSTALL( - DIRECTORY ${dir} - DESTINATION include - FILES_MATCHING PATTERN "*.hxx" - ) - INSTALL( - DIRECTORY ${dir} - DESTINATION include - FILES_MATCHING PATTERN "*.hpp" - ) -ENDFOREACH(dir) - -INSTALL( - FILES - ${PROJECT_BINARY_DIR}/lib/fpa/${lib_NAME}_Export.h - DESTINATION include/fpa - ) - -SUBDIRS( - fpa_Instances - ) +ENDIF(BUILD_PLUGINS) -## eof - $RCSfile$ +# ## eof - $RCSfile$ diff --git a/lib/fpa/Base/RegionGrow.hxx b/lib/fpa/Base/RegionGrow.hxx index 1760ac1..8542f30 100644 --- a/lib/fpa/Base/RegionGrow.hxx +++ b/lib/fpa/Base/RegionGrow.hxx @@ -26,7 +26,7 @@ _CheckMembership( const TVertex& v ) const if( this->m_GrowingFunction.IsNotNull( ) ) return( this->m_GrowingFunction->Evaluate( v ) ); else - return( false ); + return( true ); } // ------------------------------------------------------------------------- diff --git a/lib/fpa/Image/RegionGrow.hxx b/lib/fpa/Image/RegionGrow.hxx index 9b5b0f7..a56c919 100644 --- a/lib/fpa/Image/RegionGrow.hxx +++ b/lib/fpa/Image/RegionGrow.hxx @@ -22,7 +22,8 @@ void fpa::Image::RegionGrow< I, O >:: _InitResults( ) { this->Superclass::_InitResults( ); - this->m_GrowingFunction->SetSpace( this->GetInput( ) ); + if( this->m_GrowingFunction.IsNotNull( ) ) + this->m_GrowingFunction->SetSpace( this->GetInput( ) ); this->GetOutput( )->FillBuffer( this->m_OutsideValue ); } diff --git a/lib/fpa/VTK/Image/Observer2D.h b/lib/fpa/VTK/Image/Observer2D.h new file mode 100644 index 0000000..8abbecf --- /dev/null +++ b/lib/fpa/VTK/Image/Observer2D.h @@ -0,0 +1,88 @@ +#ifndef __FPA__VTK__IMAGE__OBSERVER2D__H__ +#define __FPA__VTK__IMAGE__OBSERVER2D__H__ + +#include +#include +#include +#include +#include +#include +#include + +namespace fpa +{ + namespace VTK + { + namespace Image + { + /** + */ + template< class F, class R > + class Observer2D + : public itk::Command + { + public: + typedef Observer2D Self; + typedef itk::Command Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef F TFilter; + typedef R TRenderWindow; + typedef typename TFilter::TInputImage TImage; + typedef typename TFilter::TVertex TVertex; + + typedef std::set< TVertex > TVertices; + + public: + itkNewMacro( Self ); + itkTypeMacro( Observer2D, itkCommand ); + + itkGetConstMacro( RenderPercentage, double ); + itkSetMacro( RenderPercentage, double ); + + public: + void SetRenderWindow( R* rw ); + void SetPixel( + typename TImage::IndexType idx, + unsigned char red, + unsigned char green, + unsigned char blue, + unsigned char alpha + ); + void Render( ); + void Execute( itk::Object* c, const itk::EventObject& e ) ITK_OVERRIDE + { this->Execute( ( const itk::Object* )( c ), e ); } + void Execute( const itk::Object* c, const itk::EventObject& e ) ITK_OVERRIDE; + + protected: + Observer2D( ); + virtual ~Observer2D( ); + + private: + Observer2D( const Self& ); // Not impl. + void operator=( const Self& ); // Not impl. + + protected: + vtkSmartPointer< vtkImageData > m_Stencil; + vtkSmartPointer< vtkImageActor > m_StencilActor; + + R* m_RenderWindow; + unsigned long m_Count; + unsigned long m_RenderCount; + double m_RenderPercentage; + }; + + } // ecapseman + + } // ecapseman + +} // ecapseman + +#ifndef ITK_MANUAL_INSTANTIATION +#include +#endif // ITK_MANUAL_INSTANTIATION + +#endif // __FPA__VTK__IMAGE__OBSERVER2D__H__ + +// eof - $RCSfile$ diff --git a/lib/fpa/VTK/Image2DObserver.hxx b/lib/fpa/VTK/Image/Observer2D.hxx similarity index 93% rename from lib/fpa/VTK/Image2DObserver.hxx rename to lib/fpa/VTK/Image/Observer2D.hxx index 61ea5a9..da4c7bf 100644 --- a/lib/fpa/VTK/Image2DObserver.hxx +++ b/lib/fpa/VTK/Image/Observer2D.hxx @@ -1,5 +1,5 @@ -#ifndef __FPA__VTK__IMAGE2DOBSERVER__HXX__ -#define __FPA__VTK__IMAGE2DOBSERVER__HXX__ +#ifndef __FPA__VTK__IMAGE__OBSERVER2D__HXX__ +#define __FPA__VTK__IMAGE__OBSERVER2D__HXX__ #include #include @@ -11,7 +11,7 @@ // ------------------------------------------------------------------------- template< class F, class R > -void fpa::VTK::Image2DObserver< F, R >:: +void fpa::VTK::Image::Observer2D< F, R >:: SetRenderWindow( R* rw ) { this->m_RenderWindow = rw; @@ -19,7 +19,7 @@ SetRenderWindow( R* rw ) // ------------------------------------------------------------------------- template< class F, class R > -void fpa::VTK::Image2DObserver< F, R >:: +void fpa::VTK::Image::Observer2D< F, R >:: SetPixel( typename TImage::IndexType idx, unsigned char red, @@ -42,7 +42,7 @@ SetPixel( // ------------------------------------------------------------------------- template< class F, class R > -void fpa::VTK::Image2DObserver< F, R >:: +void fpa::VTK::Image::Observer2D< F, R >:: Render( ) { if( this->m_RenderWindow != NULL ) @@ -51,7 +51,7 @@ Render( ) // ------------------------------------------------------------------------- template< class F, class R > -void fpa::VTK::Image2DObserver< F, R >:: +void fpa::VTK::Image::Observer2D< F, R >:: Execute( const itk::Object* c, const itk::EventObject& e ) { typedef typename F::TStartEvent _TStartEvent; @@ -204,8 +204,8 @@ Execute( const itk::Object* c, const itk::EventObject& e ) // ------------------------------------------------------------------------- template< class F, class R > -fpa::VTK::Image2DObserver< F, R >:: -Image2DObserver( ) +fpa::VTK::Image::Observer2D< F, R >:: +Observer2D( ) : Superclass( ), m_RenderWindow( NULL ), m_RenderPercentage( double( 0.01 ) ) @@ -216,11 +216,11 @@ Image2DObserver( ) // ------------------------------------------------------------------------- template< class F, class R > -fpa::VTK::Image2DObserver< F, R >:: -~Image2DObserver( ) +fpa::VTK::Image::Observer2D< F, R >:: +~Observer2D( ) { } -#endif // __FPA__VTK__IMAGE2DOBSERVER__HXX__ +#endif // __FPA__VTK__IMAGE__OBSERVER2D__HXX__ // eof - $RCSfile$ diff --git a/lib/fpa/VTK/Image/Observer3D.h b/lib/fpa/VTK/Image/Observer3D.h new file mode 100644 index 0000000..ce3c053 --- /dev/null +++ b/lib/fpa/VTK/Image/Observer3D.h @@ -0,0 +1,86 @@ +#ifndef __FPA__VTK__IMAGE__OBSERVER3D__H__ +#define __FPA__VTK__IMAGE__OBSERVER3D__H__ + +#include + +#include + +#include +#include +#include +#include + +namespace fpa +{ + namespace VTK + { + namespace Image + { + /** + */ + template< class F, class R > + class Observer3D + : public itk::Command + { + public: + typedef Observer3D Self; + typedef itk::Command Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef F TFilter; + typedef R TRenderWindow; + typedef typename TFilter::TInputImage TImage; + typedef typename TFilter::TVertex TVertex; + typedef typename TFilter::TVertexCompare TVertexCompare; + + typedef std::set< TVertex > TVertices; + + public: + itkNewMacro( Self ); + itkTypeMacro( Observer3D, itkCommand ); + + itkGetConstMacro( RenderPercentage, double ); + itkSetMacro( RenderPercentage, double ); + + public: + void SetRenderWindow( R* rw ); + void Render( ); + void Execute( itk::Object* c, const itk::EventObject& e ) ITK_OVERRIDE + { this->Execute( ( const itk::Object* )( c ), e ); } + void Execute( const itk::Object* c, const itk::EventObject& e ) ITK_OVERRIDE; + + protected: + Observer3D( ); + virtual ~Observer3D( ); + + private: + Observer3D( const Self& ); // Not impl. + void operator=( const Self& ); // Not impl. + + protected: + vtkSmartPointer< vtkPolyData > m_PolyData; + vtkSmartPointer< vtkPolyDataMapper > m_PolyDataMapper; + vtkSmartPointer< vtkActor > m_PolyDataActor; + std::map< TVertex, unsigned long, TVertexCompare > m_PointsToReplace; + std::map< TVertex, unsigned long, TVertexCompare > m_PointsInFront; + + R* m_RenderWindow; + unsigned long m_Count; + unsigned long m_RenderCount; + double m_RenderPercentage; + }; + + } // ecapseman + + } // ecapseman + +} // ecapseman + +#ifndef ITK_MANUAL_INSTANTIATION +#include +#endif // ITK_MANUAL_INSTANTIATION + +#endif // __FPA__VTK__IMAGE__OBSERVER3D__H__ + +// eof - $RCSfile$ diff --git a/lib/fpa/VTK/Image3DObserver.hxx b/lib/fpa/VTK/Image/Observer3D.hxx similarity index 94% rename from lib/fpa/VTK/Image3DObserver.hxx rename to lib/fpa/VTK/Image/Observer3D.hxx index 6efa120..871142b 100644 --- a/lib/fpa/VTK/Image3DObserver.hxx +++ b/lib/fpa/VTK/Image/Observer3D.hxx @@ -1,5 +1,5 @@ -#ifndef __FPA__VTK__IMAGE3DOBSERVER__HXX__ -#define __FPA__VTK__IMAGE3DOBSERVER__HXX__ +#ifndef __FPA__VTK__IMAGE__OBSERVER3D__HXX__ +#define __FPA__VTK__IMAGE__OBSERVER3D__HXX__ #include #include @@ -11,7 +11,7 @@ // ------------------------------------------------------------------------- template< class F, class R > -void fpa::VTK::Image3DObserver< F, R >:: +void fpa::VTK::Image::Observer3D< F, R >:: SetRenderWindow( R* rw ) { this->m_RenderWindow = rw; @@ -19,7 +19,7 @@ SetRenderWindow( R* rw ) // ------------------------------------------------------------------------- template< class F, class R > -void fpa::VTK::Image3DObserver< F, R >:: +void fpa::VTK::Image::Observer3D< F, R >:: Render( ) { if( this->m_RenderWindow != NULL ) @@ -28,7 +28,7 @@ Render( ) // ------------------------------------------------------------------------- template< class F, class R > -void fpa::VTK::Image3DObserver< F, R >:: +void fpa::VTK::Image::Observer3D< F, R >:: Execute( const itk::Object* c, const itk::EventObject& e ) { typedef typename F::TStartEvent _TStartEvent; @@ -178,8 +178,8 @@ Execute( const itk::Object* c, const itk::EventObject& e ) // ------------------------------------------------------------------------- template< class F, class R > -fpa::VTK::Image3DObserver< F, R >:: -Image3DObserver( ) +fpa::VTK::Image::Observer3D< F, R >:: +Observer3D( ) : Superclass( ), m_RenderWindow( NULL ), m_RenderPercentage( double( 0.001 ) ) @@ -201,11 +201,11 @@ Image3DObserver( ) // ------------------------------------------------------------------------- template< class F, class R > -fpa::VTK::Image3DObserver< F, R >:: -~Image3DObserver( ) +fpa::VTK::Image::Observer3D< F, R >:: +~Observer3D( ) { } -#endif // __FPA__VTK__IMAGE3DOBSERVER__HXX__ +#endif // __FPA__VTK__IMAGE__OBSERVER3D__HXX__ // eof - $RCSfile$ diff --git a/lib/fpa/VTK/Image2DObserver.h b/lib/fpa/VTK/Image2DObserver.h deleted file mode 100644 index c70b2af..0000000 --- a/lib/fpa/VTK/Image2DObserver.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef __FPA__VTK__IMAGE2DOBSERVER__H__ -#define __FPA__VTK__IMAGE2DOBSERVER__H__ - -#include -#include -#include -#include -#include -#include -#include - -namespace fpa -{ - namespace VTK - { - /** - */ - template< class F, class R > - class Image2DObserver - : public itk::Command - { - public: - typedef Image2DObserver Self; - typedef itk::Command Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - typedef F TFilter; - typedef R TRenderWindow; - typedef typename TFilter::TInputImage TImage; - typedef typename TFilter::TVertex TVertex; - - typedef std::set< TVertex > TVertices; - - public: - itkNewMacro( Self ); - itkTypeMacro( Image2DObserver, itkCommand ); - - itkGetConstMacro( RenderPercentage, double ); - itkSetMacro( RenderPercentage, double ); - - public: - void SetRenderWindow( R* rw ); - void SetPixel( - typename TImage::IndexType idx, - unsigned char red, - unsigned char green, - unsigned char blue, - unsigned char alpha - ); - void Render( ); - void Execute( itk::Object* c, const itk::EventObject& e ) ITK_OVERRIDE - { this->Execute( ( const itk::Object* )( c ), e ); } - void Execute( const itk::Object* c, const itk::EventObject& e ) ITK_OVERRIDE; - - protected: - Image2DObserver( ); - virtual ~Image2DObserver( ); - - private: - Image2DObserver( const Self& ); // Not impl. - void operator=( const Self& ); // Not impl. - - protected: - vtkSmartPointer< vtkImageData > m_Stencil; - vtkSmartPointer< vtkImageActor > m_StencilActor; - - R* m_RenderWindow; - unsigned long m_Count; - unsigned long m_RenderCount; - double m_RenderPercentage; - }; - - } // ecapseman - -} // ecapseman - -#ifndef ITK_MANUAL_INSTANTIATION -#include -#endif // ITK_MANUAL_INSTANTIATION - -#endif // __FPA__VTK__IMAGE2DOBSERVER__H__ - -// eof - $RCSfile$ diff --git a/lib/fpa/VTK/Image3DObserver.h b/lib/fpa/VTK/Image3DObserver.h deleted file mode 100644 index a237696..0000000 --- a/lib/fpa/VTK/Image3DObserver.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef __FPA__VTK__IMAGE3DOBSERVER__H__ -#define __FPA__VTK__IMAGE3DOBSERVER__H__ - -#include - -#include - -#include -#include -#include -#include - -namespace fpa -{ - namespace VTK - { - /** - */ - template< class F, class R > - class Image3DObserver - : public itk::Command - { - public: - typedef Image3DObserver Self; - typedef itk::Command Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - typedef F TFilter; - typedef R TRenderWindow; - typedef typename TFilter::TInputImage TImage; - typedef typename TFilter::TVertex TVertex; - typedef typename TFilter::TVertexCompare TVertexCompare; - - typedef std::set< TVertex > TVertices; - - public: - itkNewMacro( Self ); - itkTypeMacro( Image3DObserver, itkCommand ); - - itkGetConstMacro( RenderPercentage, double ); - itkSetMacro( RenderPercentage, double ); - - public: - void SetRenderWindow( R* rw ); - void Render( ); - void Execute( itk::Object* c, const itk::EventObject& e ) ITK_OVERRIDE - { this->Execute( ( const itk::Object* )( c ), e ); } - void Execute( const itk::Object* c, const itk::EventObject& e ) ITK_OVERRIDE; - - protected: - Image3DObserver( ); - virtual ~Image3DObserver( ); - - private: - Image3DObserver( const Self& ); // Not impl. - void operator=( const Self& ); // Not impl. - - protected: - vtkSmartPointer< vtkPolyData > m_PolyData; - vtkSmartPointer< vtkPolyDataMapper > m_PolyDataMapper; - vtkSmartPointer< vtkActor > m_PolyDataActor; - std::map< TVertex, unsigned long, TVertexCompare > m_PointsToReplace; - std::map< TVertex, unsigned long, TVertexCompare > m_PointsInFront; - - R* m_RenderWindow; - unsigned long m_Count; - unsigned long m_RenderCount; - double m_RenderPercentage; - }; - - } // ecapseman - -} // ecapseman - -#ifndef ITK_MANUAL_INSTANTIATION -#include -#endif // ITK_MANUAL_INSTANTIATION - -#endif // __FPA__VTK__IMAGE3DOBSERVER__H__ - -// eof - $RCSfile$ diff --git a/lib/fpa_Instances/Backtracking.i b/lib/fpa_Instances/Backtracking.i new file mode 100644 index 0000000..aa162ee --- /dev/null +++ b/lib/fpa_Instances/Backtracking.i @@ -0,0 +1,17 @@ +d #dims=2;3 +d #floats=float;double +d #mst=fpa::Image::MinimumSpanningTree +d #path=ExtractPathFromMinimumSpanningTree +d #ebc=ExtractEndPointsAndBifurcationsFromMinimumSpanningTree + +f fpa_Instances/Instances.h + +t fpa/Base/#path.h +t fpa/Base/#ebc.h +t fpa/Image/#ebc.h + +c fpa::Base::#path< #mst< #dims > > +c fpa::Base::#ebc< #mst< #dims > > +c fpa::Image::#ebc< itk::Image< #floats, #dims >, #mst< #dims > > + +* eof - $RCSfile$ diff --git a/lib/fpa_Instances/CMakeLists.txt b/lib/fpa_Instances/CMakeLists.txt index 17d6826..b0c5525 100644 --- a/lib/fpa_Instances/CMakeLists.txt +++ b/lib/fpa_Instances/CMakeLists.txt @@ -1,77 +1,24 @@ -FILE( - GLOB libs_DEFS RELATIVE - "${CMAKE_CURRENT_SOURCE_DIR}" - "${CMAKE_CURRENT_SOURCE_DIR}/*.i" - ) +## ================================= +## == Compile instances libraries == +## ================================= + +SET(pfx "fpa_") +SET(arg ${pfx} ${prj_VER} ${prj_sVER}) -SET(aux_ALL_INSTANCES) -FOREACH(i ${libs_DEFS}) - GET_FILENAME_COMPONENT(l_DEF ${i} NAME_WE) - SET(i_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${l_DEF}.i") - SET(h_FILE "${CMAKE_CURRENT_BINARY_DIR}/${l_DEF}.h") - SET(s_FILE "${CMAKE_CURRENT_BINARY_DIR}/${l_DEF}.cxx") - SET(o_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${l_DEF}_extra.cxx") - SET(l_NAME "fpa_${l_DEF}") - SET(aux_ALL_INSTANCES ${aux_ALL_INSTANCES} ${l_NAME}) - ADD_CUSTOM_COMMAND( - OUTPUT ${h_FILE} ${s_FILE} - DEPENDS ${cpPlugins_CreateInstances} ${i_FILE} - COMMAND ${cpPlugins_CreateInstances} ${i_FILE} ${l_NAME} ${h_FILE} ${s_FILE} - ) - IF(EXISTS ${o_FILE}) - ADD_LIBRARY(${l_NAME} SHARED ${s_FILE} ${o_FILE}) - ELSE(EXISTS ${o_FILE}) - ADD_LIBRARY(${l_NAME} SHARED ${s_FILE}) - ENDIF(EXISTS ${o_FILE}) - SET_TARGET_PROPERTIES( - ${l_NAME} PROPERTIES - VERSION "${prj_VER}" - SOVERSION "${prj_sVER}" - ) - GENERATE_EXPORT_HEADER( - ${l_NAME} - BASE_NAME ${l_NAME} - EXPORT_MACRO_NAME ${l_NAME}_EXPORT - EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/${l_NAME}_Export.h - STATIC_DEFINE ${l_NAME}_BUILT_AS_STATIC - ) -ENDFOREACH(i) +cpPlugins_WrapInstances(Instances ${arg} ${cpPlugins_LIBRARIES}) +cpPlugins_WrapInstances(Functors ${arg} ${pfx}Instances) +cpPlugins_WrapInstances(Filters ${arg} ${pfx}Instances) +cpPlugins_WrapInstances(Backtracking ${arg} ${pfx}Instances) +cpPlugins_WrapInstances(Observers ${arg} ${pfx}Filters) SET( - fpa_ALL_INSTANCES - ${aux_ALL_INSTANCES} - CACHE STRING "All instances libraries." + fpa_LIBRARIES + ${pfx}Instances + ${pfx}Functors + ${pfx}Filters + ${pfx}Backtracking + ${pfx}Observers + CACHE INTERNAL "All valid instances." FORCE ) -## Target links -TARGET_LINK_LIBRARIES(fpa_Instances ${cpPlugins_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES}) -TARGET_LINK_LIBRARIES(fpa_Filters fpa_Instances) -TARGET_LINK_LIBRARIES(fpa_Observers fpa_Filters) - -# TARGET_LINK_LIBRARIES(fpa_Transforms ${ITK_LIBRARIES} fpa_Base) -# TARGET_LINK_LIBRARIES(fpa_Paths fpa_Base) -# TARGET_LINK_LIBRARIES(fpa_Mesh fpa_Base) -# TARGET_LINK_LIBRARIES(fpa_Image fpa_Base) -# TARGET_LINK_LIBRARIES(fpa_ImageIterators ${ITK_LIBRARIES} fpa_Image) -# TARGET_LINK_LIBRARIES(fpa_ImageFiltersBase fpa_Image) -# TARGET_LINK_LIBRARIES(fpa_InPlaceImageFiltersBase fpa_ImageFiltersBase) -# TARGET_LINK_LIBRARIES(fpa_ImageITK2VTK fpa_ImageFiltersBase ${VTK_LIBRARIES}) -# TARGET_LINK_LIBRARIES(fpa_ThresholdFilters fpa_InPlaceImageFiltersBase fpa_ImageIterators) -# TARGET_LINK_LIBRARIES(fpa_DistanceMapFilters fpa_ThresholdFilters) -# TARGET_LINK_LIBRARIES(fpa_ResamplingFilters fpa_ImageFiltersBase fpa_ImageIterators fpa_Transforms) -# TARGET_LINK_LIBRARIES(fpa_GaussianImageFilters fpa_ImageFiltersBase fpa_ImageIterators) -# TARGET_LINK_LIBRARIES(fpa_ImageIO fpa_ImageFiltersBase fpa_ImageIterators) - -# INSTALL( -# TARGETS ${l_NAME} -# RUNTIME DESTINATION bin -# LIBRARY DESTINATION lib -# ARCHIVE DESTINATION lib/static -# ) -# INSTALL( -# FILES -# ${lib_HEADERS} -# DESTINATION include/${lib_DIR} -# ) - ## eof - $RCSfile$ diff --git a/lib/fpa_Instances/Filters.i b/lib/fpa_Instances/Filters.i index 0dfb9ff..6452df0 100644 --- a/lib/fpa_Instances/Filters.i +++ b/lib/fpa_Instances/Filters.i @@ -1,17 +1,41 @@ f fpa_Instances/Instances.h -t fpa/Image/RegionGrow.h -t fpa/Image/Dijkstra.h -t fpa/Image/Algorithm.h t fpa/Base/Algorithm.h t fpa/Base/RegionGrow.h t fpa/Base/Dijkstra.h +t fpa/Image/Algorithm.h +t fpa/Image/RegionGrow.h +t fpa/Image/Dijkstra.h + d #dims=2;3 d #int=char;short;int;long d #uint=unsigned #int d #float=float;double d #pixels=#int;#uint;#float +d #b=fpa::Base +d #i=fpa::Image +d #mst=MinimumSpanningTree +d #rg_ins=#pixels +d #rg_outs=unsigned short;unsigned char +d #d_ins=#pixels +d #d_outs=#float +d #inputs=#pixels +d #outputs=#pixels + +* ===================== +* == Base algorithms == +* ===================== + +c #b::Algorithm< itk::Index< #dims >, #inputs, #outputs, itk::Image< #inputs, #dims >, itk::Functor::IndexLexicographicCompare< #dims >, itk::ImageToImageFilter< itk::Image< #inputs, #dims >, itk::Image< #outputs, #dims > > > + +c #i::Algorithm< itk::Image< #rg_ins, #dims >, itk::Image< #rg_outs, #dims >, fpa::Base::RegionGrow< itk::Index< #dims >, #rg_ins, #rg_outs, itk::Image< #rg_ins, #dims >, itk::Functor::IndexLexicographicCompare< #dims >, itk::ImageToImageFilter< itk::Image< #rg_ins, #dims >, itk::Image< #rg_outs, #dims > > > > + +* ====================== +* == Image algorithms == +* ====================== + +c #i::RegionGrow< itk::Image< #rg_ins, #dims >, itk::Image< #rg_outs, #dims > > +c #i::Dijkstra< itk::Image< #d_ins, #dims >, itk::Image< #d_outs, #dims > > -c fpa::Image::RegionGrow< itk::Image< #pixels, #dims >, itk::Image< #uint, #dims > > -c fpa::Image::Dijkstra< itk::Image< #pixels, #dims >, itk::Image< #float, #dims > > +* eof - $RCSfile$ diff --git a/lib/fpa_Instances/Functors.i b/lib/fpa_Instances/Functors.i new file mode 100644 index 0000000..0bb83ff --- /dev/null +++ b/lib/fpa_Instances/Functors.i @@ -0,0 +1,31 @@ +d #functors=GulsunTekMedialness;FluxMedialness;MFluxMedialness +d #filter=cpExtensions::Algorithms::ImageFunctionFilter +d #vectors=itk::CovariantVector +d #k=itk::Image + +f fpa_Instances/Instances.h + +t itkImageFunction.h +t fpa/Image/Functors/#functors.h +t fpa/Image/Functors/GradientImageFunctionBase.h +t cpExtensions/Algorithms/ImageFunctionFilter.h + +d #dims=2;3 +d #int=char;short;int;long +d #uint=unsigned #int +d #float=float;double +d #pixels=#int;#uint;#float +d #b=fpa::Base +d #i=fpa::Image +d #mst=MinimumSpanningTree +d #rg_ins=#pixels +d #rg_outs=unsigned short;unsigned char +d #d_ins=#pixels +d #d_outs=#float +d #inputs=#pixels +d #outputs=#pixels + +c #i::Functors::#functors< #k< #vectors< #float, #dims >, #dims > > +c #filter< #k< #vectors< #float, #dims >, #dims >, #k< #float, #dims >, #i::Functors::#functors< #k< #vectors< #float, #dims >, #dims > > > + +* eof - $RCSfile$ diff --git a/lib/fpa_Instances/Instances.i b/lib/fpa_Instances/Instances.i index c1d57ec..5263046 100644 --- a/lib/fpa_Instances/Instances.i +++ b/lib/fpa_Instances/Instances.i @@ -1,23 +1,41 @@ f cpPlugins_Instances/ScalarImagesBaseFilters.h -t fpa/Image/MinimumSpanningTree.h t fpa/Base/MinimumSpanningTree.h -t fpa/Base/RegionGrow.h -t fpa/Base/Dijkstra.h -t fpa/Base/Algorithm.h -t itkImportImageContainer.h +t fpa/Image/MinimumSpanningTree.h +t fpa/IO/MinimumSpanningTreeReader.h +t fpa/IO/MinimumSpanningTreeWriter.h + t itkImage.h +t itkImportImageContainer.h +t itkImageRegionConstIteratorWithIndex.h +t itkImageConstIteratorWithIndex.h d #dims=2;3 d #int=char;short;int;long d #uint=unsigned #int d #float=float;double d #pixels=#int;#uint;#float +d #b=fpa::Base +d #i=fpa::Image +d #mst=MinimumSpanningTree +d #rg_ins=#pixels +d #rg_outs=unsigned short;unsigned char +d #d_ins=#pixels +d #d_outs=#float +d #inputs=#pixels +d #outputs=#pixels + +* ================ +* == Base types == +* ================ + +c itk::ImportImageContainer< unsigned long, #i::{#mst}Data< #dims > > +c itk::Image< #i::{#mst}Data< #dims >, #dims > +c #b::#mst< itk::Image< #i::{#mst}Data< #dims >, #dims >, itk::Index< #dims > > +c #i::#mst@{Data;{}}< #dims > + +c itk::ImageConstIteratorWithIndex< #i::#mst< #dims > > +c itk::ImageRegionConstIteratorWithIndex< #i::#mst< #dims > > +c fpa::IO::MinimumSpanningTree@{Reader;Writer}< #i::#mst< #dims > > -c itk::ImportImageContainer< unsigned long, fpa::Image::MinimumSpanningTreeData< #dims > > -c itk::Image< fpa::Image::MinimumSpanningTreeData< #dims >, #dims > -c fpa::Base::MinimumSpanningTree< itk::Image< fpa::Image::MinimumSpanningTreeData< #dims >, #dims >, itk::Index< #dims > > -c fpa::Image::MinimumSpanningTree< #dims > -c fpa::Base::Algorithm< itk::Index< #dims >, #pixels, #pixels, itk::Image< #pixels, #dims >, itk::Functor::IndexLexicographicCompare< #dims >, itk::ImageToImageFilter< itk::Image< #pixels, #dims >, itk::Image< #pixels, #dims > > > -c fpa::Base::Dijkstra< itk::Index< #dims >, #pixels, #float, itk::Image< #pixels, #dims >, itk::Functor::IndexLexicographicCompare< #dims >, fpa::Image::MinimumSpanningTree< #dims >, itk::ImageToImageFilter< itk::Image< #pixels, #dims >, itk::Image< #float, #dims> > > -c fpa::Base::RegionGrow< itk::Index< #dims >, #pixels, #uint, itk::Image< #pixels, #dims >, itk::Functor::IndexLexicographicCompare< #dims >, itk::ImageToImageFilter< itk::Image< #pixels, #dims >, itk::Image< #uint, #dims > > > +* eof - $RCSfile$ diff --git a/lib/fpa_Instances/Observers.i b/lib/fpa_Instances/Observers.i index a7aa67b..247788b 100644 --- a/lib/fpa_Instances/Observers.i +++ b/lib/fpa_Instances/Observers.i @@ -1,15 +1,24 @@ -f fpa_Instances/Filters.h - -i vtkRenderWindow.h - -t fpa/VTK/Image2DObserver.h -t fpa/VTK/Image3DObserver.h - d #dims=2;3 d #int=char;short;int;long d #uint=unsigned #int d #float=float;double d #pixels=#int;#uint;#float +d #rg_ins=#pixels +d #rg_outs=unsigned short;unsigned char +d #d_ins=#pixels +d #d_outs=#float +d #cls=fpa::VTK::Image::Observer +d #i=fpa::Image +d #k=itk::Image + +f fpa_Instances/Filters.h + +i vtkRenderWindow.h + +t fpa/VTK/Image/Observer2D.h +t fpa/VTK/Image/Observer3D.h + +c {#cls}{#dims}D< #i::RegionGrow< #k< #rg_ins, #dims >, #k< #rg_outs, #dims > >, vtkRenderWindow > +c {#cls}{#dims}D< #i::Dijkstra< #k< #d_ins, #dims >, #k< #d_outs, #dims > >, vtkRenderWindow > -c @{fpa::VTK::Image2DObserver;fpa::VTK::Image3DObserver}< fpa::Image::RegionGrow< itk::Image< #pixels, #dims >, itk::Image< #uint, #dims > >, vtkRenderWindow > -c @{fpa::VTK::Image2DObserver;fpa::VTK::Image3DObserver}< fpa::Image::Dijkstra< itk::Image< #pixels, #dims >, itk::Image< #float, #dims > >, vtkRenderWindow > +* eof - $RCSfile$ diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index df80a25..fd17844 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,5 +1,7 @@ -SUBDIRS( - fpa - ) +IF(BUILD_PLUGINS) + SUBDIRS( + fpa + ) +ENDIF(BUILD_PLUGINS) ## eof - $RCSfile$ diff --git a/plugins/fpa/BaseImageFilter.cxx b/plugins/fpa/BaseImageFilter.cxx index f10d067..88e80f3 100644 --- a/plugins/fpa/BaseImageFilter.cxx +++ b/plugins/fpa/BaseImageFilter.cxx @@ -1,6 +1,5 @@ #include "BaseImageFilter.h" #include -//#include // ------------------------------------------------------------------------- bool fpaPlugins::BaseImageFilter:: diff --git a/plugins/fpa/BaseImageFilter.hxx b/plugins/fpa/BaseImageFilter.hxx index 9db580a..6bce1d5 100644 --- a/plugins/fpa/BaseImageFilter.hxx +++ b/plugins/fpa/BaseImageFilter.hxx @@ -1,33 +1,23 @@ #ifndef __FPAPLUGINS__BASEIMAGEFILTER__HXX__ #define __FPAPLUGINS__BASEIMAGEFILTER__HXX__ +#include #include -#include -/* TODO - #include - #include - #include - #include - - #include - #include -*/ // ------------------------------------------------------------------------- template< class _TFilter > _TFilter* fpaPlugins::BaseImageFilter:: _ConfigureFilter( ) { - typedef typename _TFilter::TInputImage _TImage; - typedef typename _TImage::IndexType _TIndex; - typedef itk::Point< double, _TImage::ImageDimension > _TPoint; - typedef itk::SimpleDataObjectDecorator< std::vector< _TPoint > > _TPoints; - typedef itk::SimpleDataObjectDecorator< std::vector< _TIndex > > _TIndexes; + typedef typename _TFilter::TInputImage _TImage; + static const unsigned int Dim = _TImage::ImageDimension; + typedef + cpExtensions::DataStructures::ImageIndexesContainer< Dim > + _TIndexes; auto image = this->GetInputData( "Input" )->GetITK< _TImage >( ); if( image == NULL ) return( NULL ); - auto points = this->GetInputData( "Seeds" )->GetITK< _TPoints >( ); auto indexes = this->GetInputData( "Seeds" )->GetITK< _TIndexes >( ); // Create filter and connect input @@ -42,27 +32,10 @@ _ConfigureFilter( ) // Assign seeds filter->ClearSeeds( ); - if( points != NULL ) - { - for( - auto pIt = points->Get( ).begin( ); - pIt != points->Get( ).end( ); - ++pIt - ) - { - _TIndex idx; - if( image->TransformPhysicalPointToIndex( *pIt, idx ) ) - filter->AddSeed( idx, 0 ); - - } // rof - } - else if( indexes != NULL ) + if( indexes != NULL ) { - for( - auto iIt = indexes->Get( ).begin( ); - iIt != indexes->Get( ).end( ); - ++iIt - ) + auto iIt = indexes->Get( ).begin( ); + for( ; iIt != indexes->Get( ).end( ); ++iIt ) filter->AddSeed( *iIt, 0 ); } // fi @@ -92,8 +65,8 @@ void fpaPlugins::BaseImageFilter:: _ConfigureDebugger( _TFilter* filter ) { typedef typename _TFilter::TInputImage _TImage; - typedef fpa::VTK::Image2DObserver< _TFilter, vtkRenderWindow > _2D; - typedef fpa::VTK::Image3DObserver< _TFilter, vtkRenderWindow > _3D; + typedef fpa::VTK::Image::Observer2D< _TFilter, vtkRenderWindow > _2D; + typedef fpa::VTK::Image::Observer3D< _TFilter, vtkRenderWindow > _3D; this->m_Observers.clear( ); if( this->m_Parameters.GetBool( "VisualDebug" ) ) diff --git a/plugins/fpa/CMakeLists.txt b/plugins/fpa/CMakeLists.txt index 18f6377..cc21d76 100644 --- a/plugins/fpa/CMakeLists.txt +++ b/plugins/fpa/CMakeLists.txt @@ -1,98 +1,57 @@ SET(lib_NAME fpaPlugins) -SET(lib_DIR fpa) - -## =============== -## = Source code = -## =============== - SET( - base_HEADERS_H - ${CMAKE_CURRENT_SOURCE_DIR}/BaseImageFilter.h - ${CMAKE_CURRENT_SOURCE_DIR}/MinimumSpanningTree.h - ) - -SET( - filters_HEADERS_H - #${CMAKE_CURRENT_SOURCE_DIR}/MinimumSpanningTreeReader.h - #${CMAKE_CURRENT_SOURCE_DIR}/MinimumSpanningTreeWriter.h + lib_HEADERS + ${CMAKE_CURRENT_SOURCE_DIR}/GradientBaseImageFunctionSource.h ${CMAKE_CURRENT_SOURCE_DIR}/ImageRegionGrow.h ${CMAKE_CURRENT_SOURCE_DIR}/ImageDijkstra.h + ${CMAKE_CURRENT_SOURCE_DIR}/MinimumSpanningTreeReader.h + ${CMAKE_CURRENT_SOURCE_DIR}/MinimumSpanningTreeWriter.h + ${CMAKE_CURRENT_SOURCE_DIR}/RegionGrowThresholdFunction.h + ${CMAKE_CURRENT_SOURCE_DIR}/InvertCostFunction.h ${CMAKE_CURRENT_SOURCE_DIR}/ExtractPathFromMinimumSpanningTree.h ${CMAKE_CURRENT_SOURCE_DIR}/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.h - #${CMAKE_CURRENT_SOURCE_DIR}/RegionGrowThresholdFunction.h - ${CMAKE_CURRENT_SOURCE_DIR}/InvertCostFunction.h - #${CMAKE_CURRENT_SOURCE_DIR}/GradientBaseImageFunctionSource.h - ) - -SET( - base_HEADERS_HXX - ${CMAKE_CURRENT_SOURCE_DIR}/BaseImageFilter.hxx - ) - -SET( - base_SOURCES_CXX - ${CMAKE_CURRENT_SOURCE_DIR}/BaseImageFilter.cxx - ${CMAKE_CURRENT_SOURCE_DIR}/MinimumSpanningTree.cxx ) - SET( - filters_SOURCES_CXX - #${CMAKE_CURRENT_SOURCE_DIR}/MinimumSpanningTreeReader.cxx - #${CMAKE_CURRENT_SOURCE_DIR}/MinimumSpanningTreeWriter.cxx + lib_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/GradientBaseImageFunctionSource.cxx ${CMAKE_CURRENT_SOURCE_DIR}/ImageRegionGrow.cxx ${CMAKE_CURRENT_SOURCE_DIR}/ImageDijkstra.cxx + ${CMAKE_CURRENT_SOURCE_DIR}/MinimumSpanningTreeReader.cxx + ${CMAKE_CURRENT_SOURCE_DIR}/MinimumSpanningTreeWriter.cxx + ${CMAKE_CURRENT_SOURCE_DIR}/RegionGrowThresholdFunction.cxx + ${CMAKE_CURRENT_SOURCE_DIR}/InvertCostFunction.cxx ${CMAKE_CURRENT_SOURCE_DIR}/ExtractPathFromMinimumSpanningTree.cxx ${CMAKE_CURRENT_SOURCE_DIR}/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.cxx - #${CMAKE_CURRENT_SOURCE_DIR}/RegionGrowThresholdFunction.cxx - ${CMAKE_CURRENT_SOURCE_DIR}/InvertCostFunction.cxx - #${CMAKE_CURRENT_SOURCE_DIR}/GradientBaseImageFunctionSource.cxx ) - SET( - target_LIBRARIES - ${fpa_ALL_INSTANCES} - ${cpExtensions_LIBRARY} + lib_OTHER_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/BaseImageFilter.h + ${CMAKE_CURRENT_SOURCE_DIR}/BaseImageFilter.hxx + ${CMAKE_CURRENT_SOURCE_DIR}/BaseImageFilter.cxx + ${CMAKE_CURRENT_SOURCE_DIR}/MinimumSpanningTree.h + ${CMAKE_CURRENT_SOURCE_DIR}/MinimumSpanningTree.cxx ) +SET(lib_QT4_HEADERS "") -## ===================== -## = Compilation rules = -## ===================== - -ADD_CUSTOM_COMMAND( - OUTPUT ${lib_NAME}_Host.cxx - DEPENDS ${cpPlugins_HostCreator} ${filters_HEADERS_H} - COMMAND ${cpPlugins_HostCreator} ${lib_NAME}_Host.cxx ${filters_HEADERS_H} - ) -ADD_LIBRARY( - ${lib_NAME} - SHARED - ${lib_NAME}_Host.cxx - ${base_SOURCES_CXX} - ${filters_SOURCES_CXX} - ) -SET_TARGET_PROPERTIES( - ${lib_NAME} PROPERTIES - VERSION "${prj_VER}" - SOVERSION "${prj_sVER}" - ) -GENERATE_EXPORT_HEADER( - ${lib_NAME} - BASE_NAME ${lib_NAME} - EXPORT_MACRO_NAME ${lib_NAME}_EXPORT - EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/plugins/${lib_DIR}/${lib_NAME}_Export.h - STATIC_DEFINE ${lib_NAME}_BUILT_AS_STATIC +cpPlugins_WrapPlugins( + ${lib_NAME} ${prj_VER} ${prj_sVER} + "${lib_HEADERS}" + "${lib_SOURCES}" + "${lib_OTHER_SOURCES}" + "${lib_QT4_HEADERS}" + ${cpExtensions_LIBRARY} + ${fpa_LIBRARIES} ) -TARGET_LINK_LIBRARIES(${lib_NAME} ${target_LIBRARIES}) ## ======================== ## -- Installation rules -- ## ======================== -INSTALL( - TARGETS ${lib_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib/static - ) +#INSTALL( +# TARGETS ${lib_NAME} +# RUNTIME DESTINATION bin +# LIBRARY DESTINATION lib +# ARCHIVE DESTINATION lib/static +# ) ## eof - $RCSfile$ diff --git a/plugins/fpa/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.cxx b/plugins/fpa/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.cxx index 0b1d597..793493b 100644 --- a/plugins/fpa/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.cxx +++ b/plugins/fpa/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.cxx @@ -1,12 +1,8 @@ #include "ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.h" +#include #include #include -#include -#include -#include -#include -#include // ------------------------------------------------------------------------- fpaPlugins::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree:: diff --git a/plugins/fpa/ExtractPathFromMinimumSpanningTree.cxx b/plugins/fpa/ExtractPathFromMinimumSpanningTree.cxx index db5332a..c263b9c 100644 --- a/plugins/fpa/ExtractPathFromMinimumSpanningTree.cxx +++ b/plugins/fpa/ExtractPathFromMinimumSpanningTree.cxx @@ -1,15 +1,7 @@ #include "ExtractPathFromMinimumSpanningTree.h" -#include - -#include -#include -#include -#include -#include -#include #include -#include -#include +#include +#include // ------------------------------------------------------------------------- fpaPlugins::ExtractPathFromMinimumSpanningTree:: @@ -52,9 +44,10 @@ template< class _TMST > std::string fpaPlugins::ExtractPathFromMinimumSpanningTree:: _GD0( _TMST* mst ) { - typedef fpa::Base::ExtractPathFromMinimumSpanningTree< _TMST > _TFilter; - typedef typename _TMST::TVertex _TVertex; - typedef itk::SimpleDataObjectDecorator< std::vector< _TVertex > > _TVertices; + typedef fpa::Base::ExtractPathFromMinimumSpanningTree< _TMST > _TFilter; + typedef + cpExtensions::DataStructures::ImageIndexesContainer< _TMST::Dimension > + _TVertices; if( mst == NULL ) return( "fpaPlugins::ExtractPathFromMinimumSpanningTree: No valid input tree." diff --git a/plugins/fpa/GradientBaseImageFunctionSource.cxx b/plugins/fpa/GradientBaseImageFunctionSource.cxx index 129968e..926523d 100644 --- a/plugins/fpa/GradientBaseImageFunctionSource.cxx +++ b/plugins/fpa/GradientBaseImageFunctionSource.cxx @@ -1,19 +1,7 @@ #include "GradientBaseImageFunctionSource.h" + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include // ------------------------------------------------------------------------- fpaPlugins::GradientBaseImageFunctionSource:: diff --git a/plugins/fpa/ImageDijkstra.cxx b/plugins/fpa/ImageDijkstra.cxx index b5b3a62..b906a21 100644 --- a/plugins/fpa/ImageDijkstra.cxx +++ b/plugins/fpa/ImageDijkstra.cxx @@ -3,14 +3,6 @@ #include #include -#include - -#include -#include -#include -#include -#include -#include // ------------------------------------------------------------------------- fpaPlugins::ImageDijkstra:: @@ -44,10 +36,12 @@ template< class _TImage > std::string fpaPlugins::ImageDijkstra:: _GD0( _TImage* image ) { - typedef fpa::Image::Dijkstra< _TImage, _TImage > _TFilter; - typedef typename _TFilter::TResult _TCost; - typedef itk::FunctionBase< _TCost, _TCost > _TCostFunctor; - typedef typename _TFilter::TMinimumSpanningTree _TMST; + typedef float _TPixel; + typedef itk::Image< _TPixel, _TImage::ImageDimension > _TOutImage; + typedef fpa::Image::Dijkstra< _TImage, _TOutImage > _TFilter; + typedef typename _TFilter::TResult _TCost; + typedef itk::FunctionBase< _TCost, _TCost > _TCostFunctor; + typedef typename _TFilter::TMinimumSpanningTree _TMST; if( image == NULL ) return( "fpaPlugins::ImageDijkstra: Invalid image type." ); diff --git a/plugins/fpa/ImageRegionGrow.cxx b/plugins/fpa/ImageRegionGrow.cxx index 27d5eca..8ee71ca 100644 --- a/plugins/fpa/ImageRegionGrow.cxx +++ b/plugins/fpa/ImageRegionGrow.cxx @@ -2,14 +2,6 @@ #include #include -#include - -#include -#include -#include -#include -#include -#include // ------------------------------------------------------------------------- fpaPlugins::ImageRegionGrow:: @@ -44,25 +36,24 @@ template< class _TImage > std::string fpaPlugins::ImageRegionGrow:: _GD0( _TImage* image ) { - typedef fpa::Image::RegionGrow< _TImage, _TImage > _TFilter; - typedef typename _TFilter::TGrowingFunction _TGrowFunctor; - typedef typename _TFilter::TResult _TResult; + typedef unsigned short _TPixel; + typedef itk::Image< _TPixel, _TImage::ImageDimension > _TOutImage; + typedef fpa::Image::RegionGrow< _TImage, _TOutImage > _TFilter; + typedef typename _TFilter::TGrowingFunction _TGrowFunctor; + typedef typename _TFilter::TResult _TResult; if( image == NULL ) return( "fpaPlugins::ImageRegionGrow: Invalid image type." ); - // Get functor (if any) + // Create filter + _TFilter* filter = this->_ConfigureFilter< _TFilter >( ); + typename _TGrowFunctor::Pointer functor; auto wrap_functor = this->GetInputData( "GrowFunctor" ); if( wrap_functor != NULL ) functor = wrap_functor->GetITK< _TGrowFunctor >( ); if( functor.IsNull( ) ) - functor = - fpa::Image::Functors::RegionGrowAllBelongsFunction< _TImage >::New( ); - - // Create filter - _TFilter* filter = this->_ConfigureFilter< _TFilter >( ); - filter->SetGrowingFunction( functor ); + filter->SetGrowingFunction( functor ); filter->SetInsideValue( _TResult( this->m_Parameters.GetUint( "InsideValue" ) ) ); diff --git a/plugins/fpa/MinimumSpanningTreeReader.cxx b/plugins/fpa/MinimumSpanningTreeReader.cxx index 98ef989..8326dfb 100644 --- a/plugins/fpa/MinimumSpanningTreeReader.cxx +++ b/plugins/fpa/MinimumSpanningTreeReader.cxx @@ -1,8 +1,7 @@ #include "MinimumSpanningTreeReader.h" #include "MinimumSpanningTree.h" -#include -#include +#include // ------------------------------------------------------------------------- fpaPlugins::MinimumSpanningTreeReader:: diff --git a/plugins/fpa/MinimumSpanningTreeWriter.cxx b/plugins/fpa/MinimumSpanningTreeWriter.cxx index 90fd428..9757006 100644 --- a/plugins/fpa/MinimumSpanningTreeWriter.cxx +++ b/plugins/fpa/MinimumSpanningTreeWriter.cxx @@ -1,8 +1,7 @@ #include "MinimumSpanningTreeWriter.h" #include "MinimumSpanningTree.h" -#include -#include +#include // ------------------------------------------------------------------------- fpaPlugins::MinimumSpanningTreeWriter::