From: Leonardo Flórez-Valencia Date: Fri, 11 Nov 2016 00:55:10 +0000 (-0500) Subject: ... X-Git-Tag: v0.1~52 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=cpPlugins.git;a=commitdiff_plain;h=514419c89876aa75880cabee60c14f7582b1d33c ... --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ad24e39..7263959 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,20 +38,14 @@ SET(prj_SHORT_VERSION "${prj_MAJOR_VERSION}") INCLUDE(cmake/Restrictions.cmake) INCLUDE(cmake/Options.cmake) INCLUDE(cmake/KitwareTools.cmake) -OPTION(USE_QT4 "Build Qt4-based code" OFF) -IF(USE_QT4) - INCLUDE(cmake/QtTools.cmake) - SET( - cpPlugins_Qt4_VTKWidget QVTKWidget - CACHE STRING "Base Qt4-based vtkRenderWindow" - ) -ENDIF(USE_QT4) +INCLUDE(cmake/QtTools.cmake) INCLUDE(cmake/Functions.cmake) ## =========================== ## == Build different parts == ## =========================== -SUBDIRS(appli cmake lib plugins) +#SUBDIRS(appli cmake lib plugins) +SUBDIRS(appli lib plugins) ## eof - $RCSfile$ diff --git a/appli/bash/CMakeLists.txt b/appli/bash/CMakeLists.txt index 53037b8..8efd6f8 100644 --- a/appli/bash/CMakeLists.txt +++ b/appli/bash/CMakeLists.txt @@ -7,7 +7,6 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/appli ${PROJECT_BINARY_DIR}/appli ) - SET( _bash_APPS CreateRealConfig diff --git a/appli/examples/plugins/CMakeLists.txt b/appli/examples/plugins/CMakeLists.txt index e1f396b..89190b6 100644 --- a/appli/examples/plugins/CMakeLists.txt +++ b/appli/examples/plugins/CMakeLists.txt @@ -21,7 +21,7 @@ FOREACH(_src ${all_SOURCE_CXX_FILES}) ADD_EXECUTABLE(${_pfx}_${_name} ${_src}) TARGET_LINK_LIBRARIES( ${_pfx}_${_name} - cpPlugins + cpPlugins cpExtensions ) ENDFOREACH(_src) diff --git a/cmake/KitwareTools.cmake b/cmake/KitwareTools.cmake index a120bb2..b4493d2 100644 --- a/cmake/KitwareTools.cmake +++ b/cmake/KitwareTools.cmake @@ -3,9 +3,9 @@ # ====================== FIND_PACKAGE(ITK REQUIRED) -INCLUDE(${ITK_USE_FILE}) - FIND_PACKAGE(VTK REQUIRED) + +INCLUDE(${ITK_USE_FILE}) INCLUDE(${VTK_USE_FILE}) # =================================================== diff --git a/cmake/Options.cmake b/cmake/Options.cmake index c745a7b..edd8126 100644 --- a/cmake/Options.cmake +++ b/cmake/Options.cmake @@ -3,7 +3,6 @@ ## =============================== SET(cpPlugins_CONFIG_NUMBER_OF_FILES "10" CACHE STRING "Number of compiled files.") -SET(cpPlugins_CONFIG_BOOLEAN_TYPES "bool" CACHE STRING "Accepted boolean types.") SET(cpPlugins_CONFIG_INTEGER_TYPES "char;short;int;long" CACHE STRING "Accepted integer types.") SET(cpPlugins_CONFIG_REAL_TYPES "float;double" CACHE STRING "Accepted real types.") SET(cpPlugins_CONFIG_PROCESS_DIMENSIONS "1;2;3;4" CACHE STRING "Accepted processing dimensions.") @@ -15,7 +14,6 @@ SET(cpPlugins_CONFIG_MATRICES "Matrix" CACHE STRING "Accepted matrices.") SET( _all_configs - cpPlugins_CONFIG_BOOLEAN_TYPES cpPlugins_CONFIG_INTEGER_TYPES cpPlugins_CONFIG_REAL_TYPES cpPlugins_CONFIG_PROCESS_DIMENSIONS diff --git a/cmake/QtTools.cmake b/cmake/QtTools.cmake index a49b3d5..8e884b0 100644 --- a/cmake/QtTools.cmake +++ b/cmake/QtTools.cmake @@ -2,14 +2,14 @@ ## == Find Qt4 and check if it was well configured == ## ================================================== -SET(QT4_FOUND "0") +OPTION(USE_QT4 "Build Qt4-based code" OFF) IF(USE_QT4) + SET(QT4_FOUND "0") FIND_PACKAGE(Qt4 REQUIRED) INCLUDE(${QT_USE_FILE}) SET( _modules vtkGUISupportQt - vtkGUISupportQtOpenGL ) FOREACH(_m ${_modules}) IF(NOT ${_m}_LOADED) @@ -18,6 +18,11 @@ IF(USE_QT4) ENDIF(NOT ${_m}_LOADED) ENDFOREACH(_m) SET(QT4_FOUND "1") + SET( + cpPlugins_Qt4_VTKWidget + QVTKWidget + CACHE STRING "Base Qt4-based vtkRenderWindow" + ) ENDIF(USE_QT4) ## eof - $RCSfile$ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index a6a7f21..e222646 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,22 +1,19 @@ -## ==================== -## == Base libraries == -## ==================== + +## ===================== +## == Build instances == +## ===================== + +SUBDIRS(Instances) + +## =========================== +## == Third party libraries == +## =========================== CompileLibFromDir(cp_tinyxml2 SHARED tinyxml2) IF(USE_QT4) CompileLibFromDir(cp_QCustomPlot SHARED QCustomPlot) TARGET_LINK_LIBRARIES(cp_QCustomPlot ${QT_LIBRARIES}) ENDIF(USE_QT4) -CompileLibFromDir(cpExtensions SHARED cpExtensions) -TARGET_LINK_LIBRARIES( - cpExtensions ${QT_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES} - ) - -## =============== -## == Instances == -## =============== - -SUBDIRS(Instances) ## ================== ## == Main library == @@ -28,70 +25,32 @@ ADD_CUSTOM_COMMAND( COMMAND ${cpPlugins_bash_CreateRealConfig_APP} ${CMAKE_CURRENT_BINARY_DIR}/cpPlugins/RealConfig.h DEPENDS ${cpPlugins_bash_CreateRealConfig_APP} ) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/Instances) -CompileLibFromDir(cpPlugins SHARED cpPlugins ${CMAKE_CURRENT_BINARY_DIR}/cpPlugins/RealConfig.h) +CompileLibFromDir( + cpPlugins SHARED cpPlugins + ${CMAKE_CURRENT_BINARY_DIR}/cpPlugins/RealConfig.h + ) TARGET_LINK_LIBRARIES( cpPlugins cp_tinyxml2 - cpExtensions ${QT_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES} ${cpPlugins_Instances} ) -## ========================= -## == Even more libraries == -## ========================= - -CompileLibFromDir(cpBaseQtApplication SHARED cpBaseQtApplication) -TARGET_LINK_LIBRARIES(cpBaseQtApplication cpPlugins) - -## ==================== -## == Base libraries == -## ==================== +## ===================== +## == Other libraries == +## ===================== +CompileLibFromDir(cpExtensions SHARED cpExtensions) +TARGET_LINK_LIBRARIES( + cpExtensions + ${QT_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES} + ) IF(USE_QT4) - SET( - cpPlugins_BaseLibraries - cp_tinyxml2 - cp_QCustomPlot - cpExtensions - cpPlugins - CACHE INTERNAL "All locally compiled libraries." FORCE - ) -ELSE(USE_QT4) - SET( - cpPlugins_BaseLibraries - cp_tinyxml2 - cpExtensions - cpPlugins - CACHE INTERNAL "All locally compiled libraries." FORCE - ) + CompileLibFromDir(cpBaseQtApplication SHARED cpBaseQtApplication) + TARGET_LINK_LIBRARIES( + cpBaseQtApplication + cpPlugins cpExtensions + ) ENDIF(USE_QT4) -## =================================== -## == Libraries to dynamically load == -## =================================== - -SET(_pre ${CMAKE_SHARED_LIBRARY_PREFIX}) -SET(_suf ${CMAKE_SHARED_LIBRARY_SUFFIX}) - -SET(cpPlugins_DynLibs "${CMAKE_INSTALL_PREFIX}/bin/${_pre}cpExtensions${_suf}") -LIST(APPEND cpPlugins_DynLibs "${CMAKE_INSTALL_PREFIX}/lib/${_pre}cpExtensions${_suf}") -LIST(APPEND cpPlugins_DynLibs "${LIBRARY_OUTPUT_PATH}/${_pre}cpExtensions${_suf}") -FOREACH(_lib ${cpPlugins_Instances}) - LIST(APPEND cpPlugins_DynLibs "${CMAKE_INSTALL_PREFIX}/bin/${_pre}${_lib}${_suf}") - LIST(APPEND cpPlugins_DynLibs "${CMAKE_INSTALL_PREFIX}/lib/${_pre}${_lib}${_suf}") - LIST(APPEND cpPlugins_DynLibs "${LIBRARY_OUTPUT_PATH}/${_pre}${_lib}${_suf}") -ENDFOREACH(_lib) -LIST(APPEND cpPlugins_DynLibs "${VTK_INSTALL_PREFIX}/bin/*vtk*${_suf}") -LIST(APPEND cpPlugins_DynLibs "${VTK_INSTALL_PREFIX}/lib/*vtk*${_suf}") -LIST(APPEND cpPlugins_DynLibs "${ITK_INSTALL_PREFIX}/bin/*itk*${_suf}") -LIST(APPEND cpPlugins_DynLibs "${ITK_INSTALL_PREFIX}/lib/*itk*${_suf}") -LIST(APPEND cpPlugins_DynLibs "${ITK_INSTALL_PREFIX}/bin/*ITK*${_suf}") -LIST(APPEND cpPlugins_DynLibs "${ITK_INSTALL_PREFIX}/lib/*ITK*${_suf}") -FILE(WRITE ${PROJECT_BINARY_DIR}/cpPlugins_Libraries.config "") -FOREACH(_lib ${cpPlugins_DynLibs}) - FILE(APPEND ${PROJECT_BINARY_DIR}/cpPlugins_Libraries.config "${_lib}\n") -ENDFOREACH(_lib) - -## eof - $RCSfilfe$ +## eof - $RCSfile$ diff --git a/lib/Instances/BaseObjects.i b/lib/Instances/BaseObjects.i index 9525c8b..8575d66 100644 --- a/lib/Instances/BaseObjects.i +++ b/lib/Instances/BaseObjects.i @@ -1,34 +1,32 @@ header #define ITK_MANUAL_INSTANTIATION -define other_dims=6;8;10 +define arrays=Array2D;Array;#color_pixels# +define fixed_dims=#process_dims#;8 -tinclude itkArray2D:h|hxx -tinclude itkArray:h|hxx +tinclude itk#arrays#:h|hxx tinclude itkFixedArray:h|hxx -tinclude itk#color_pixels#:h|hxx +tinclude itk#diff_tensors#:h|hxx tinclude itk#vectors#:h|hxx tinclude itk#matrices#:h|hxx -tinclude itk#diff_tensors#:h|hxx tinclude itkSymmetricEigenAnalysis:h|hxx tinclude itkSimpleDataObjectDecorator:h|hxx tinclude itkVariableLengthVector:h|hxx -instances itk::Array2D< #scalar_pixels# > -instances itk::Array< #scalar_pixels# > -instances itk::FixedArray< #scalar_pixels#, #process_dims# > -instances itk::FixedArray< #scalar_pixels#, #other_dims# > -instances itk::#color_pixels#< #scalar_pixels# > -instances itk::#vectors#< #real_types#, #process_dims# > +instances itk::SimpleDataObjectDecorator< #scalar_pixels# > +instances itk::VariableLengthVector< #scalar_pixels# > + +instances itk::#arrays#< #scalar_pixels# > +instances itk::FixedArray< #scalar_pixels#, #fixed_dims# > instances itk::#diff_tensors#< #real_types# > +instances itk::#vectors#< #real_types#, #process_dims# > instances itk::#matrices#< #real_types#, #process_dims#, #process_dims# > -instances itk::SymmetricEigenAnalysis< itk::Matrix< #real_types#, #process_dims#, #process_dims# >, itk::FixedArray< #real_types#, #process_dims# >, itk::Matrix< #real_types#, #process_dims#, #process_dims# > > -instances itk::SimpleDataObjectDecorator< #scalar_pixels# > -instances itk::VariableLengthVector< #scalar_pixels# > +instances itk::SymmetricEigenAnalysis< itk::Matrix< #real_types#, #process_dims#, #process_dims# >, itk::FixedArray< #real_types#, #process_dims# >, itk::Matrix< #real_types#, #process_dims#, #process_dims# > > define my_vectors=FixedArray;Vector;Point minstances #_export_# std::ostream& itk::operator<< < #real_types#, #process_dims# >( std::ostream& a, itk::#my_vectors#< #real_types#, #process_dims# > const& b ) -minstances void #_export_# itk::VariableLengthVector< #real_types# >::SetSize< itk::VariableLengthVector< #real_types# >::AlwaysReallocate, itk::VariableLengthVector< #real_types# >::KeepOldValues >( unsigned int, itk::VariableLengthVector< #real_types# >::AlwaysReallocate, itk::VariableLengthVector< #real_types# >::KeepOldValues ) + +*minstances void #_export_# itk::VariableLengthVector< #real_types# >::SetSize< itk::VariableLengthVector< #real_types# >::AlwaysReallocate, itk::VariableLengthVector< #real_types# >::KeepOldValues >( unsigned int, itk::VariableLengthVector< #real_types# >::AlwaysReallocate, itk::VariableLengthVector< #real_types# >::KeepOldValues ) ** eof - $RCSfile$ diff --git a/lib/Instances/CMakeLists.txt b/lib/Instances/CMakeLists.txt index 623325a..c418df6 100644 --- a/lib/Instances/CMakeLists.txt +++ b/lib/Instances/CMakeLists.txt @@ -1,42 +1,44 @@ +SET(_p cpInstances) SET( _all_defs BaseObjects - SimpleImages - ImageIterators - ImageNeighborhoodIterators + BoundingBoxes + Meshes + Images + SimpleIterators + NeighborhoodIterators ImageFiltersBases ImageComplexFilters ImageInterpolators - BoundingBoxes - Meshes - Paths Transforms + Paths ) SET(_all_libs) FOREACH(_def ${_all_defs}) + SET(_name ${_p}${_def}) CompileInstances( - cpInstances_${_def} + ${_name} ${_def}.i ${cpPlugins_CONFIG_NUMBER_OF_FILES} ) - LIST(APPEND _all_libs cpInstances_${_def}) + LIST(APPEND _all_libs ${_name}) ENDFOREACH(_def) SET( cpPlugins_Instances ${_all_libs} CACHE INTERNAL "All valid instances." FORCE ) -TARGET_LINK_LIBRARIES(cpInstances_BaseObjects ${ITK_LIBRARIES}) -TARGET_LINK_LIBRARIES(cpInstances_SimpleImages cpInstances_BaseObjects) -TARGET_LINK_LIBRARIES(cpInstances_ImageIterators cpInstances_SimpleImages) -TARGET_LINK_LIBRARIES(cpInstances_ImageNeighborhoodIterators cpInstances_SimpleImages) -TARGET_LINK_LIBRARIES(cpInstances_ImageFiltersBases cpInstances_SimpleImages) -TARGET_LINK_LIBRARIES(cpInstances_ImageComplexFilters cpInstances_ImageFiltersBases cpInstances_ImageIterators) -TARGET_LINK_LIBRARIES(cpInstances_ImageInterpolators cpInstances_BaseObjects) -TARGET_LINK_LIBRARIES(cpInstances_BoundingBoxes cpInstances_BaseObjects) -TARGET_LINK_LIBRARIES(cpInstances_Meshes cpInstances_BoundingBoxes) -TARGET_LINK_LIBRARIES(cpInstances_Paths cpInstances_BaseObjects ${VTK_LIBRARIES}) -TARGET_LINK_LIBRARIES(cpInstances_Transforms cpInstances_BaseObjects) +TARGET_LINK_LIBRARIES(${_p}BaseObjects ${ITK_LIBRARIES}) +TARGET_LINK_LIBRARIES(${_p}BoundingBoxes ${_p}BaseObjects) +TARGET_LINK_LIBRARIES(${_p}Meshes ${_p}BoundingBoxes) +TARGET_LINK_LIBRARIES(${_p}Images ${_p}BaseObjects) +TARGET_LINK_LIBRARIES(${_p}SimpleIterators ${_p}Images) +TARGET_LINK_LIBRARIES(${_p}NeighborhoodIterators ${_p}Images) +TARGET_LINK_LIBRARIES(${_p}ImageFiltersBases ${_p}Images) +TARGET_LINK_LIBRARIES(${_p}ImageComplexFilters ${_p}ImageFiltersBases ${_p}SimpleIterators) +TARGET_LINK_LIBRARIES(${_p}ImageInterpolators ${_p}BaseObjects) +TARGET_LINK_LIBRARIES(${_p}Transforms ${_p}BaseObjects) +TARGET_LINK_LIBRARIES(${_p}Paths ${_p}BaseObjects) ## eof - $RCSfilfe$ diff --git a/lib/Instances/ImageComplexFilters.i b/lib/Instances/ImageComplexFilters.i index 961364c..aca8b31 100644 --- a/lib/Instances/ImageComplexFilters.i +++ b/lib/Instances/ImageComplexFilters.i @@ -1,16 +1,20 @@ header #define ITK_MANUAL_INSTANTIATION +define filters=ImageToImageFilter;InPlaceImageFilter + cinclude itkCovariantVector.h tinclude itkImageToImageFilter:h|hxx tinclude itkInPlaceImageFilter:h|hxx tinclude itkRecursiveSeparableImageFilter:h|hxx -instances itk::ImageToImageFilter< itk::Image< #scalar_pixels#, 3 >, itk::Image< #scalar_pixels#, 2 > > -instances itk::ImageToImageFilter< itk::Image< #scalar_pixels#, 2 >, itk::Image< #scalar_pixels#, 3 > > -instances itk::InPlaceImageFilter< itk::Image< #scalar_pixels#, 3 >, itk::Image< #scalar_pixels#, 2 > > -instances itk::InPlaceImageFilter< itk::Image< #scalar_pixels#, 2 >, itk::Image< #scalar_pixels#, 3 > > +instances itk::#filters#< itk::Image< #scalar_pixels#, 3 >, itk::Image< #scalar_pixels#, 2 > > +instances itk::#filters#< itk::Image< #scalar_pixels#, 2 >, itk::Image< #scalar_pixels#, 3 > > +instances itk::#filters#< itk::Image< itk::#color_pixels#< #in_scalar# >, #process_dims# >, itk::Image< #out_scalar#, #process_dims# > > +instances itk::#filters#< itk::Image< #in_scalar#, #process_dims# >, itk::Image< itk::#color_pixels#< #out_scalar# >, #process_dims# > > +instances itk::#filters#< itk::Image< itk::#vectors#< #in_real#, #process_dims# >, #process_dims# >, itk::Image< #out_real#, #process_dims# > > +instances itk::#filters#< itk::Image< #in_real#, #process_dims# >, itk::Image< itk::#vectors#< #out_real#, #process_dims# >, #process_dims# > > instances itk::ImageToImageFilter< itk::Image< #scalar_pixels#, #process_dims# >, itk::Image< itk::CovariantVector< #real_types#, #process_dims# >, #process_dims# > > instances itk::ImageToImageFilter< itk::Image< itk::CovariantVector< #real_types#, #process_dims# >, #process_dims# >, itk::Image< #scalar_pixels#, #process_dims# > > instances itk::RecursiveSeparableImageFilter< itk::Image< #scalar_pixels#, #process_dims# >, itk::Image< #real_types#, #process_dims# > > diff --git a/lib/Instances/ImageFiltersBases.i b/lib/Instances/ImageFiltersBases.i index ba3c732..fffbd89 100644 --- a/lib/Instances/ImageFiltersBases.i +++ b/lib/Instances/ImageFiltersBases.i @@ -1,9 +1,9 @@ header #define ITK_MANUAL_INSTANTIATION -define in_scalar_pixels=#scalar_pixels# -define out_scalar_pixels=#scalar_pixels# -define in_real_pixels=#real_types# -define out_real_pixels=#real_types# +define in_scalar=#scalar_pixels# +define out_scalar=#scalar_pixels# +define in_real=#real_types# +define out_real=#real_types# define filters=ImageToImageFilter;InPlaceImageFilter tinclude itkImageSource:h|hxx @@ -15,16 +15,16 @@ cinclude itk#vectors#.h cinclude itk#diff_tensors#.h cinclude itk#matrices#.h -instances itk::ImageSource< itk::Image< #scalar_pixels#, #process_dims# > > -instances itk::ImageSource< itk::Image< std::complex< #real_types# >, #process_dims# > > -instances itk::ImageSource< itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# > > +define scalars=#scalar_pixels#;std::complex< #real_types# >;itk::#color_pixels#< #scalar_pixels# > + +instances itk::ImageSource< itk::Image< #scalars#, #process_dims# > > instances itk::ImageSource< itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# > > instances itk::ImageSource< itk::Image< itk::#diff_tensors#< #real_types# >, 3 > > instances itk::ImageSource< itk::Image< itk::#matrices#< #real_types#, #process_dims#, #process_dims# >, #process_dims# > > instances itk::ImageSource< itk::Image< itk::Offset< #process_dims# >, #process_dims# > > -instances itk::#filters#< itk::Image< #in_scalar_pixels#, #process_dims# >, itk::Image< #out_scalar_pixels#, #process_dims# > > -instances itk::#filters#< itk::Image< itk::#color_pixels#< #in_scalar_pixels# >, #process_dims# >, itk::Image< itk::#color_pixels#< #out_scalar_pixels# >, #process_dims# > > -instances itk::#filters#< itk::Image< itk::#vectors#< #in_real_pixels#, #process_dims# >, #process_dims# >, itk::Image< itk::#vectors#< #out_real_pixels#, #process_dims# >, #process_dims# > > +instances itk::#filters#< itk::Image< #in_scalar#, #process_dims# >, itk::Image< #out_scalar#, #process_dims# > > +instances itk::#filters#< itk::Image< itk::#color_pixels#< #in_scalar# >, #process_dims# >, itk::Image< itk::#color_pixels#< #out_scalar# >, #process_dims# > > +instances itk::#filters#< itk::Image< itk::#vectors#< #in_real#, #process_dims# >, #process_dims# >, itk::Image< itk::#vectors#< #out_real#, #process_dims# >, #process_dims# > > ** eof - $RCSfile$ diff --git a/lib/Instances/ImageInterpolators.i b/lib/Instances/ImageInterpolators.i index f4464fd..c9214b4 100644 --- a/lib/Instances/ImageInterpolators.i +++ b/lib/Instances/ImageInterpolators.i @@ -2,13 +2,16 @@ header #define ITK_MANUAL_INSTANTIATION define i_real=#real_types# define o_real=#real_types# +define interp=Linear tinclude itkImageFunction:h|hxx -tinclude itkLinearInterpolateImageFunction:h|hxx +tinclude itk#interp#InterpolateImageFunction:h|hxx + +NearestNeighbor cinclude itkImage.h instances itk::ImageFunction< itk::Image< #scalar_pixels#, #process_dims# >, #i_real#, #o_real# > -instances itk::LinearInterpolateImageFunction< itk::Image< #scalar_pixels#, #process_dims# >, #real_types# > +instances itk::#interp#InterpolateImageFunction< itk::Image< #scalar_pixels#, #process_dims# >, #real_types# > ** eof - $RCSfile$ diff --git a/lib/Instances/SimpleImages.i b/lib/Instances/Images.i similarity index 73% rename from lib/Instances/SimpleImages.i rename to lib/Instances/Images.i index 6d20764..7621b81 100644 --- a/lib/Instances/SimpleImages.i +++ b/lib/Instances/Images.i @@ -1,9 +1,9 @@ header #define ITK_MANUAL_INSTANTIATION -tinclude itkImageRegion:h|hxx -tinclude itkImageBase:h|hxx -tinclude itkImage:h|hxx tinclude itkImportImageContainer:h|hxx +tinclude itkImage:h|hxx +tinclude itkImageBase:h|hxx +tinclude itkImageRegion:h|hxx cinclude complex cinclude itk#color_pixels#.h @@ -11,19 +11,18 @@ cinclude itk#vectors#.h cinclude itk#diff_tensors#.h cinclude itk#matrices#.h -instances itk::ImportImageContainer< unsigned long, #scalar_pixels# > -instances itk::ImportImageContainer< unsigned long, std::complex< #real_types# > > -instances itk::ImportImageContainer< unsigned long, itk::#color_pixels#< #scalar_pixels# > > +define scalars=#scalar_pixels#;std::complex< #real_types# >;itk::#color_pixels#< #scalar_pixels# > + +instances itk::ImportImageContainer< unsigned long, #scalars# > instances itk::ImportImageContainer< unsigned long, itk::#vectors#< #real_types#, #process_dims# > > instances itk::ImportImageContainer< unsigned long, itk::#diff_tensors#< #real_types# > > instances itk::ImportImageContainer< unsigned long, itk::#matrices#< #real_types#, #process_dims#, #process_dims# > > instances itk::ImportImageContainer< unsigned long, itk::Offset< #process_dims# > > + instances itk::ImageRegion< #process_dims# > instances itk::ImageBase< #process_dims# > -instances itk::Image< #scalar_pixels#, #process_dims# > -instances itk::Image< std::complex< #real_types# >, #process_dims# > -instances itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# > +instances itk::Image< #scalars#, #process_dims# > instances itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# > instances itk::Image< itk::#diff_tensors#< #real_types# >, 3 > instances itk::Image< itk::#matrices#< #real_types#, #process_dims#, #process_dims# >, #process_dims# > diff --git a/lib/Instances/ImageNeighborhoodIterators.i b/lib/Instances/NeighborhoodIterators.i similarity index 100% rename from lib/Instances/ImageNeighborhoodIterators.i rename to lib/Instances/NeighborhoodIterators.i diff --git a/lib/Instances/Paths.i b/lib/Instances/Paths.i index ccacd8f..a9dcd21 100644 --- a/lib/Instances/Paths.i +++ b/lib/Instances/Paths.i @@ -3,18 +3,11 @@ header #define ITK_MANUAL_INSTANTIATION tinclude itkPath:h|hxx tinclude itkParametricPath:h|hxx tinclude itkPolyLineParametricPath:h|hxx -tinclude cpExtensions/DataStructures/PolyLineParametricPath:h|hxx -tinclude cpExtensions/DataStructures/Skeleton:h|hxx -tinclude cpExtensions/Algorithms/BezierCurveFunction:h|hxx cinclude itkVectorContainer.hxx -cinclude cpExtensions/DataStructures/Graph.hxx -instances cpExtensions::Algorithms::BezierCurveFunction< itk::Vector< #real_types#, #process_dims# > > instances itk::Path< #real_types#, itk::ContinuousIndex< #real_types#, #process_dims# >, #process_dims# > instances itk::ParametricPath< #process_dims# > instances itk::PolyLineParametricPath< #process_dims# > -instances cpExtensions::DataStructures::PolyLineParametricPath< #process_dims# > -instances cpExtensions::DataStructures::Skeleton< #process_dims# > ** eof - $RCSfile$ diff --git a/lib/Instances/ImageIterators.i b/lib/Instances/SimpleIterators.i similarity index 100% rename from lib/Instances/ImageIterators.i rename to lib/Instances/SimpleIterators.i diff --git a/lib/cpPlugins/BaseObjects/DataObject.cxx b/lib/cpPlugins/BaseObjects/DataObject.cxx index aeb24cd..2b53a32 100644 --- a/lib/cpPlugins/BaseObjects/DataObject.cxx +++ b/lib/cpPlugins/BaseObjects/DataObject.cxx @@ -45,8 +45,8 @@ void cpPlugins::BaseObjects::DataObject:: DisconnectFromPipeline( ) { // Disconnect input pipelines (ITK) - itk::DataObject* itk_obj = this->GetITK< itk::DataObject >( ); - if( itk_obj != NULL ) + itk::DataObject::Pointer itk_obj = this->GetITK< itk::DataObject >( ); + if( itk_obj.IsNotNull( ) ) itk_obj->DisconnectPipeline( ); // Disconnect input pipelines (VTK) diff --git a/lib/cpPlugins/BaseObjects/DataObject.h b/lib/cpPlugins/BaseObjects/DataObject.h index a09ccdf..672b746 100644 --- a/lib/cpPlugins/BaseObjects/DataObject.h +++ b/lib/cpPlugins/BaseObjects/DataObject.h @@ -40,7 +40,7 @@ namespace cpPlugins virtual ~DataObject( ); template< class _TType > - inline bool _DisconnectVTK( ); + inline bool _DisconnectVTK( ); private: // Purposely not implemented diff --git a/lib/cpPlugins/BaseObjects/Object.cxx b/lib/cpPlugins/BaseObjects/Object.cxx index 89d7fe6..e372c99 100644 --- a/lib/cpPlugins/BaseObjects/Object.cxx +++ b/lib/cpPlugins/BaseObjects/Object.cxx @@ -23,7 +23,7 @@ SetViewCoords( float x, float y ) { this->m_ViewX = x; this->m_ViewY = y; - // WARNING: do not call "this->Modified( )" -> It could lead to a + // WARNING: do not call "this->Modified( )" -> It could lead to // re-execution of all pipeline } @@ -51,8 +51,8 @@ GetMTime( ) const else if( i != NULL && v != NULL ) { auto iTime = i->GetMTime( ); - auto vTime = i->GetMTime( ); - return( itk::ModifiedTimeType( ( iTime > vTime )? iTime: vTime ) ); + auto vTime = v->GetMTime( ); + return( itk::ModifiedTimeType( ( iTime < vTime )? vTime: iTime ) ); } else return( this->Superclass::GetMTime( ) ); diff --git a/lib/cpPlugins/BaseObjects/Object.h b/lib/cpPlugins/BaseObjects/Object.h index 4d0ab88..6dcfae1 100644 --- a/lib/cpPlugins/BaseObjects/Object.h +++ b/lib/cpPlugins/BaseObjects/Object.h @@ -42,16 +42,28 @@ namespace cpPlugins virtual void SetVTK( vtkObjectBase* o ); template< class _TType = itk::LightObject > - inline _TType* GetITK( ); + inline _TType* GetITK( ) + { return( dynamic_cast< _TType* >( this->m_ITK.GetPointer( ) ) ); } template< class _TType = itk::LightObject > - inline const _TType* GetITK( ) const; + inline const _TType* GetITK( ) const + { + return( + dynamic_cast< const _TType* >( this->m_ITK.GetPointer( ) ) + ); + } template< class _TType = vtkObjectBase > - inline _TType* GetVTK( ); + inline _TType* GetVTK( ) + { return( dynamic_cast< _TType* >( this->m_VTK.GetPointer( ) ) ); } template< class _TType = vtkObjectBase > - inline const _TType* GetVTK( ) const; + inline const _TType* GetVTK( ) const + { + return( + dynamic_cast< const _TType* >( this->m_VTK.GetPointer( ) ) + ); + } protected: Object( ); @@ -74,8 +86,6 @@ namespace cpPlugins } // ecapseman -#include - #endif // __cpPlugins__BaseObjects__Object__h__ // eof - $RCSfile$ diff --git a/lib/cpPlugins/BaseObjects/Object.hxx b/lib/cpPlugins/BaseObjects/Object.hxx deleted file mode 100644 index b07c3c7..0000000 --- a/lib/cpPlugins/BaseObjects/Object.hxx +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __cpPlugins__BaseObjects__Object__hxx__ -#define __cpPlugins__BaseObjects__Object__hxx__ - -// ------------------------------------------------------------------------- -template< class _TType > -_TType* cpPlugins::BaseObjects::Object:: -GetITK( ) -{ - return( dynamic_cast< _TType* >( this->m_ITK.GetPointer( ) ) ); -} - -// ------------------------------------------------------------------------- -template< class _TType > -const _TType* cpPlugins::BaseObjects::Object:: -GetITK( ) const -{ - return( dynamic_cast< const _TType* >( this->m_ITK.GetPointer( ) ) ); -} - -// ------------------------------------------------------------------------- -template< class _TType > -_TType* cpPlugins::BaseObjects::Object:: -GetVTK( ) -{ - return( dynamic_cast< _TType* >( this->m_VTK.GetPointer( ) ) ); -} - -// ------------------------------------------------------------------------- -template< class _TType > -const _TType* cpPlugins::BaseObjects::Object:: -GetVTK( ) const -{ - return( dynamic_cast< const _TType* >( this->m_VTK.GetPointer( ) ) ); -} - -#endif // __cpPlugins__BaseObjects__Object__hxx__ - -// eof - $RCSfile$ diff --git a/lib/cpPlugins/BaseObjects/Parameters.cxx b/lib/cpPlugins/BaseObjects/Parameters.cxx index 662d827..d3adec4 100644 --- a/lib/cpPlugins/BaseObjects/Parameters.cxx +++ b/lib/cpPlugins/BaseObjects/Parameters.cxx @@ -1,5 +1,5 @@ #include -#include +#include #include // ------------------------------------------------------------------------- @@ -678,7 +678,7 @@ _GetList( const std::string& name ) const if( i->second.first == ( Self::Type )( _Enum ) ) { std::vector< std::string > tokens; - cpExtensions::Tokenize( tokens, i->second.second, "#" ); + cpPlugins::Tokenize( tokens, i->second.second, "#" ); for( auto t = tokens.begin( ); t != tokens.end( ); ++t ) { if( typeid( _Type ) != typeid( std::string ) ) diff --git a/lib/cpPlugins/BaseObjects/ProcessObject.cxx b/lib/cpPlugins/BaseObjects/ProcessObject.cxx index 7f8533a..f9845f7 100644 --- a/lib/cpPlugins/BaseObjects/ProcessObject.cxx +++ b/lib/cpPlugins/BaseObjects/ProcessObject.cxx @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -198,9 +198,9 @@ Update( ) } // fi - auto t_start = cpExtensions_CHRONO; + auto t_start = cpPlugins_CHRONO; this->_GenerateData( ); - auto t_end = cpExtensions_CHRONO; + auto t_end = cpPlugins_CHRONO; this->m_LastExecutionSpan = long( t_end - t_start ); this->m_LastExecutionTime = this->GetMTime( ); diff --git a/lib/cpPlugins/BaseObjects/ProcessObject.h b/lib/cpPlugins/BaseObjects/ProcessObject.h index 18c9b2d..dbc822b 100644 --- a/lib/cpPlugins/BaseObjects/ProcessObject.h +++ b/lib/cpPlugins/BaseObjects/ProcessObject.h @@ -62,32 +62,32 @@ namespace cpPlugins bool IsInputMultiple( const std::string& n ) const; template< class _TType = DataObject > - _TType* GetInput( const std::string& n, unsigned int i = 0 ); + inline _TType* GetInput( const std::string& n, unsigned int i = 0 ); template< class _TType = DataObject > - const _TType* GetInput( - const std::string& n, unsigned int i = 0 - ) const; + inline const _TType* GetInput( + const std::string& n, unsigned int i = 0 + ) const; template< class _TType = itk::LightObject > - _TType* GetInputData( const std::string& n, unsigned int i = 0 ); + inline _TType* GetInputData( const std::string& n, unsigned int i = 0 ); template< class _TType = itk::LightObject > - const _TType* GetInputData( - const std::string& n, unsigned int i = 0 - ) const; + inline const _TType* GetInputData( + const std::string& n, unsigned int i = 0 + ) const; template< class _TType = DataObject > - _TType* GetOutput( const std::string& n ); + inline _TType* GetOutput( const std::string& n ); template< class _TType = DataObject > - const _TType* GetOutput( const std::string& n ) const; + inline const _TType* GetOutput( const std::string& n ) const; template< class _TType = itk::LightObject > - _TType* GetOutputData( const std::string& n ); + inline _TType* GetOutputData( const std::string& n ); template< class _TType = itk::LightObject > - const _TType* GetOutputData( const std::string& n ) const; + inline const _TType* GetOutputData( const std::string& n ) const; // "Setters" virtual void AddInput( const std::string& n, DataObject* o ); @@ -117,18 +117,18 @@ namespace cpPlugins // For configuration purposes template< class _TType = DataObject > - void _ConfigureInput( - const std::string& name, bool required, bool multiple - ); + inline void _ConfigureInput( + const std::string& name, bool required, bool multiple + ); template< class _TType = DataObject > - void _ConfigureOutput( const std::string& name ); + inline void _ConfigureOutput( const std::string& name ); template< class _TFilter > - _TFilter* _CreateITK( ); + inline _TFilter* _CreateITK( ); template< class _TFilter > - _TFilter* _CreateVTK( ); + inline _TFilter* _CreateVTK( ); virtual void _GenerateData( ) = 0; diff --git a/lib/cpPlugins/Config.h.in b/lib/cpPlugins/Config.h.in index 1540cb0..105f8b5 100644 --- a/lib/cpPlugins/Config.h.in +++ b/lib/cpPlugins/Config.h.in @@ -1,8 +1,8 @@ -#ifndef __@prj_NAME@__Config__h__ -#define __@prj_NAME@__Config__h__ +#ifndef __cpPlugins__Config__h__ +#define __cpPlugins__Config__h__ #define ITK_MANUAL_INSTANTIATION -#include <@prj_NAME@_Export.h> +#include #include #include @@ -11,31 +11,31 @@ * Identify OS * ========================================================================= */ -#define @prj_NAME@_OS_@CMAKE_SYSTEM_NAME@ -#ifdef @prj_NAME@_OS_Windows -# define @prj_NAME@_LIB_PREFIX "" -# define @prj_NAME@_ENV_SEPARATOR ";" -# define @prj_NAME@_PATH_SEPARATOR '\\' -# define @prj_NAME@_LIB_EXT ".dll" -#else // @prj_NAME@_OS_Windows -# define @prj_NAME@_LIB_PREFIX "lib" -# define @prj_NAME@_ENV_SEPARATOR ":" -# define @prj_NAME@_PATH_SEPARATOR '/' -# ifdef @prj_NAME@_OS_Linux -# define @prj_NAME@_LIB_EXT ".so" -# else // @prj_NAME@_OS_Linux -# define @prj_NAME@_LIB_EXT ".dylib" -# endif // @prj_NAME@_OS_Linux -#endif // @prj_NAME@_OS_Windows +#define cpPlugins_OS_@CMAKE_SYSTEM_NAME@ +#ifdef cpPlugins_OS_Windows +# define cpPlugins_LIB_PREFIX "" +# define cpPlugins_ENV_SEPARATOR ";" +# define cpPlugins_PATH_SEPARATOR '\\' +# define cpPlugins_LIB_EXT ".dll" +#else // cpPlugins_OS_Windows +# define cpPlugins_LIB_PREFIX "lib" +# define cpPlugins_ENV_SEPARATOR ":" +# define cpPlugins_PATH_SEPARATOR '/' +# ifdef cpPlugins_OS_Linux +# define cpPlugins_LIB_EXT ".so" +# else // cpPlugins_OS_Linux +# define cpPlugins_LIB_EXT ".dylib" +# endif // cpPlugins_OS_Linux +#endif // cpPlugins_OS_Windows -#ifdef @prj_NAME@_OS_Windows +#ifdef cpPlugins_OS_Windows # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # endif // WIN32_LEAN_AND_MEAN # define NOMINMAX # include # include -#endif // @prj_NAME@_OS_Windows +#endif // cpPlugins_OS_Windows /* * ========================================================================= @@ -43,16 +43,16 @@ * ========================================================================= */ -#define @prj_NAME@_PATHS "@prj_NAME@_PATHS" -#define @prj_NAME@_CONFIG "@prj_NAME@_Libraries.config" -#define @prj_NAME@_QT4_USED @QT4_FOUND@ -#if @prj_NAME@_QT4_USED == 1 -# define @prj_NAME@_QT4 -# define @prj_NAME@_QVTKWidget @cpPlugins_Qt4_VTKWidget@ +#define cpPlugins_PATHS "cpPlugins_PATHS" +#define cpPlugins_CONFIG "cpPlugins_Libraries.config" +#define cpPlugins_QT4_USED @QT4_FOUND@ +#if cpPlugins_QT4_USED == 1 +# define cpPlugins_QT4 +# define cpPlugins_QVTKWidget @cpPlugins_Qt4_VTKWidget@ # include <@cpPlugins_Qt4_VTKWidget@.h> -#else // @prj_NAME@_QT4_USED == 1 -# undef @prj_NAME@_QT4 -#endif // @prj_NAME@_QT4_USED == 1 +#else // cpPlugins_QT4_USED == 1 +# undef cpPlugins_QT4 +#endif // cpPlugins_QT4_USED == 1 /* * ========================================================================= @@ -60,12 +60,12 @@ * ========================================================================= */ -#define @prj_NAME@_MAJOR_VERSION @prj_MAJ_VER@ -#define @prj_NAME@_MINOR_VERSION @prj_MIN_VER@ -#define @prj_NAME@_RELEASE_VERSION @prj_REL_VER@ -#define @prj_NAME@_VERSION "@prj_VERSION@" -#define @prj_NAME@_SHORT_VERSION "@prj_SHORT_VERSION@" -#define @prj_NAME@_OpenGL_BackEnd_@VTK_RENDERING_BACKEND@ +#define cpPlugins_MAJOR_VERSION @prj_MAJ_VER@ +#define cpPlugins_MINOR_VERSION @prj_MIN_VER@ +#define cpPlugins_RELEASE_VERSION @prj_REL_VER@ +#define cpPlugins_VERSION "@prj_VERSION@" +#define cpPlugins_SHORT_VERSION "@prj_SHORT_VERSION@" +#define cpPlugins_OpenGL_BackEnd_@VTK_RENDERING_BACKEND@ /* * ========================================================================= @@ -74,17 +74,17 @@ */ #if __cplusplus >= 201103L -# define @prj_NAME@_OVERRIDE override -# define @prj_NAME@_DELETE_FUNCTION =delete -# define @prj_NAME@_NULLPTR nullptr -# define @prj_NAME@_NOEXCEPT noexcept -# define @prj_NAME@_HAS_CXX11_STATIC_ASSERT -# define @prj_NAME@_HAS_CXX11_RVREF +# define cpPlugins_OVERRIDE override +# define cpPlugins_DELETE_FUNCTION =delete +# define cpPlugins_NULLPTR nullptr +# define cpPlugins_NOEXCEPT noexcept +# define cpPlugins_HAS_CXX11_STATIC_ASSERT +# define cpPlugins_HAS_CXX11_RVREF #else // __cplusplus >= 201103L -# define @prj_NAME@_OVERRIDE -# define @prj_NAME@_DELETE_FUNCTION -# define @prj_NAME@_NULLPTR NULL -# define @prj_NAME@_NOEXCEPT throw() +# define cpPlugins_OVERRIDE +# define cpPlugins_DELETE_FUNCTION +# define cpPlugins_NULLPTR NULL +# define cpPlugins_NOEXCEPT throw() #endif // __cplusplus >= 201103L /* @@ -93,14 +93,14 @@ * ========================================================================= */ -#define @prj_NAME@_Id_Macro( _class, _category ) \ +#define cpPlugins_Id_Macro( _class, _category ) \ public: \ - virtual const char* GetClassName( ) const @prj_NAME@_OVERRIDE \ + virtual const char* GetClassName( ) const cpPlugins_OVERRIDE \ { return( #_class ); } \ - virtual const char* GetClassCategory( ) const @prj_NAME@_OVERRIDE \ + virtual const char* GetClassCategory( ) const cpPlugins_OVERRIDE \ { return( #_category ); } -#define @prj_NAME@Object( _cls, _scls, _cat ) \ +#define cpPluginsObject( _cls, _scls, _cat ) \ public: \ typedef _cls Self; \ typedef _scls Superclass; \ @@ -110,26 +110,26 @@ itkNewMacro( Self ); \ itkTypeMacro( _cls, _scls ); \ public: \ - virtual const char* GetClassName( ) const @prj_NAME@_OVERRIDE \ + virtual const char* GetClassName( ) const cpPlugins_OVERRIDE \ { return( #_cls ); } \ - virtual const char* GetClassCategory( ) const @prj_NAME@_OVERRIDE \ + virtual const char* GetClassCategory( ) const cpPlugins_OVERRIDE \ { return( #_cat ); } \ protected: \ _cls( ); \ virtual ~_cls( ); \ - virtual void _GenerateData( ) @prj_NAME@_OVERRIDE; \ + virtual void _GenerateData( ) cpPlugins_OVERRIDE; \ private: \ _cls( const Self& ); \ Self& operator=( const Self& ) -#define @prj_NAME@_Compatibility_Macro \ +#define cpPlugins_Compatibility_Macro \ virtual bool IsCompatible( \ const DataObject* other \ - ) const @prj_NAME@_OVERRIDE \ + ) const cpPlugins_OVERRIDE \ { \ - return( dynamic_cast< const Self* >( other ) != NULL ); \ + return( dynamic_cast< const Self* >( other ) != NULL ); \ } -#endif // __@prj_NAME@__Config__h__ +#endif // __cpPlugins__Config__h__ // eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/BoundingBox.cxx b/lib/cpPlugins/DataObjects/BoundingBox.cxx deleted file mode 100644 index 6ecf3f2..0000000 --- a/lib/cpPlugins/DataObjects/BoundingBox.cxx +++ /dev/null @@ -1,190 +0,0 @@ -#include -#include -#include -#include -#include - -// ------------------------------------------------------------------------- -void cpPlugins::DataObjects::BoundingBox:: -SetDataObject( DataObject* o ) -{ - auto i = o->GetITK< itk::LightObject >( ); - auto v = o->GetVTK< vtkObjectBase >( ); - if( v != NULL ) this->SetVTK( v ); - else if( i != NULL ) this->SetITK( i ); -} - -// ------------------------------------------------------------------------- -void cpPlugins::DataObjects::BoundingBox:: -SetITK( itk::LightObject* o ) -{ - bool r = this->_ITKImage< 1 >( o ); - if( !r ) r = this->_ITKImage< 2 >( o ); - if( !r ) r = this->_ITKImage< 3 >( o ); - if( !r ) r = this->_ITKImage< 4 >( o ); - if( !r ) r = this->_ITKPointSet< float, 2 >( o ); - if( !r ) r = this->_ITKPointSet< double, 2 >( o ); - if( !r ) r = this->_ITKPointSet< float, 3 >( o ); - if( !r ) r = this->_ITKPointSet< double, 3 >( o ); - if( r ) - this->_UpdateVTK( ); -} - -// ------------------------------------------------------------------------- -void cpPlugins::DataObjects::BoundingBox:: -SetVTK( vtkObjectBase* o ) -{ - auto ds = dynamic_cast< vtkDataSet* >( o ); - if( ds != NULL ) - { - double bounds[ 6 ]; - ds->GetBounds( bounds ); - this->m_Points[ 0 ].clear( ); - this->m_Points[ 1 ].clear( ); - this->m_Points[ 0 ].push_back( bounds[ 0 ] ); - this->m_Points[ 1 ].push_back( bounds[ 1 ] ); - this->m_Points[ 0 ].push_back( bounds[ 2 ] ); - this->m_Points[ 1 ].push_back( bounds[ 3 ] ); - this->m_Points[ 0 ].push_back( bounds[ 4 ] ); - this->m_Points[ 1 ].push_back( bounds[ 5 ] ); - this->_UpdateVTK( ); - - } // fi -} - -// ------------------------------------------------------------------------- -void cpPlugins::DataObjects::BoundingBox:: -Copy( Self* other ) -{ - this->m_Points[ 0 ] = other->m_Points[ 0 ]; - this->m_Points[ 1 ] = other->m_Points[ 1 ]; - this->Modified( ); -} - -// ------------------------------------------------------------------------- -void cpPlugins::DataObjects::BoundingBox:: -Blend( Self* other ) -{ - if( this->m_Points[ 0 ].size( ) < other->m_Points[ 0 ].size( ) ) - this->m_Points[ 0 ].resize( - other->m_Points[ 0 ].size( ), - std::numeric_limits< double >::max( ) - ); - if( this->m_Points[ 1 ].size( ) < other->m_Points[ 1 ].size( ) ) - this->m_Points[ 1 ].resize( - other->m_Points[ 1 ].size( ), - -std::numeric_limits< double >::max( ) - ); - for( unsigned int d = 0; d < this->m_Points[ 0 ].size( ); ++d ) - if( other->m_Points[ 0 ][ d ] < this->m_Points[ 0 ][ d ] ) - this->m_Points[ 0 ][ d ] = other->m_Points[ 0 ][ d ]; - for( unsigned int d = 0; d < this->m_Points[ 1 ].size( ); ++d ) - if( other->m_Points[ 1 ][ d ] > this->m_Points[ 1 ][ d ] ) - this->m_Points[ 1 ][ d ] = other->m_Points[ 1 ][ d ]; - this->Modified( ); - this->_UpdateVTK( ); -} - -// ------------------------------------------------------------------------- -cpPlugins::DataObjects::BoundingBox:: -BoundingBox( ) - : Superclass( ) -{ - this->m_Points[ 0 ].push_back( double( 0 ) ); - this->m_Points[ 1 ].push_back( double( 0 ) ); - this->m_Outline = vtkSmartPointer< vtkOutlineSource >::New( ); - this->_UpdateVTK( ); -} - -// ------------------------------------------------------------------------- -cpPlugins::DataObjects::BoundingBox:: -~BoundingBox( ) -{ -} - -// ------------------------------------------------------------------------- -void cpPlugins::DataObjects::BoundingBox:: -_UpdateVTK( ) -{ - // Get bounds - double bounds[ 6 ] = { 0 }; - unsigned int dim = this->m_Points[ 0 ].size( ); - dim = ( this->m_Points[ 1 ].size( ) < dim )? this->m_Points[ 1 ].size( ): dim; - dim = ( dim < 3 )? dim: 3; - for( unsigned int d = 0; d < dim; ++d ) - { - bounds[ d << 1 ] = this->m_Points[ 0 ][ d ]; - bounds[ ( d << 1 ) + 1 ] = this->m_Points[ 1 ][ d ]; - - } // rof - - // Update vtk objects - this->m_Outline->SetBounds( bounds ); - this->m_Outline->Update( ); - this->m_VTK = this->m_Outline->GetOutput( ); -} - -// ------------------------------------------------------------------------- -template< unsigned int _NDim > -bool cpPlugins::DataObjects::BoundingBox:: -_ITKImage( itk::LightObject* o ) -{ - auto image = dynamic_cast< itk::ImageBase< _NDim >* >( o ); - if( image == NULL ) - return( false ); - - auto region = image->GetLargestPossibleRegion( ); - auto i0 = region.GetIndex( ); - auto i1 = i0 + region.GetSize( ); - - typename itk::ImageBase< _NDim >::PointType p0, p1; - image->TransformIndexToPhysicalPoint( i0, p0 ); - image->TransformIndexToPhysicalPoint( i1, p1 ); - this->m_Points[ 0 ].clear( ); - this->m_Points[ 1 ].clear( ); - - for( unsigned int d = 0; d < _NDim; ++d ) - { - this->m_Points[ 0 ].push_back( double( p0[ d ] ) ); - this->m_Points[ 1 ].push_back( double( p1[ d ] ) ); - - } // rof - this->Modified( ); - return( true ); -} - -// ------------------------------------------------------------------------- -template< class _TScalar, unsigned int _NDim > -bool cpPlugins::DataObjects::BoundingBox:: -_ITKPointSet( itk::LightObject* o ) -{ - typedef itk::PointSet< _TScalar, _NDim > _TPointSet; - typedef itk::BoundingBox< typename _TPointSet::PointIdentifier, _NDim, _TScalar, typename _TPointSet::PointsContainer > _TBBox; - - auto ps = dynamic_cast< _TPointSet* >( o ); - if( ps == NULL ) - return( false ); - - this->m_Points[ 0 ].clear( ); - this->m_Points[ 1 ].clear( ); - - typename _TBBox::Pointer bb = _TBBox::New( ); - bb->SetPoints( ps->GetPoints( ) ); - if( bb->ComputeBoundingBox( ) ) - { - auto p0 = bb->GetMinimum( ); - auto p1 = bb->GetMaximum( ); - for( unsigned int d = 0; d < _NDim; ++d ) - { - this->m_Points[ 0 ].push_back( double( p0[ d ] ) ); - this->m_Points[ 1 ].push_back( double( p1[ d ] ) ); - - } // rof - this->Modified( ); - return( true ); - } - else - return( false ); -} - -// eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/BoundingBox.h b/lib/cpPlugins/DataObjects/BoundingBox.h deleted file mode 100644 index 11cf8c2..0000000 --- a/lib/cpPlugins/DataObjects/BoundingBox.h +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef __cpPlugins__DataObjects__BoundingBox__h__ -#define __cpPlugins__DataObjects__BoundingBox__h__ - -#include -#include -#include -#include - -namespace cpPlugins -{ - namespace DataObjects - { - /** - */ - class cpPlugins_EXPORT BoundingBox - : public cpPlugins::BaseObjects::DataObject - { - public: - typedef BoundingBox Self; - typedef cpPlugins::BaseObjects::DataObject Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - public: - itkNewMacro( Self ); - itkTypeMacro( BoundingBox, DataObject ); - cpPlugins_Id_Macro( BoundingBox, Object ); - cpPlugins_Compatibility_Macro; - - public: - void SetDataObject( DataObject* o ); - virtual void SetITK( itk::LightObject* o ) cpPlugins_OVERRIDE; - virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE; - - void Copy( Self* other ); - void Blend( Self* other ); - - template< class _TPoint > - inline void SetMinimum( const _TPoint& p ) - { - this->_SetPoint( 0, p ); - } - - template< class _TPoint > - inline void SetMaximum( const _TPoint& p ) - { - this->_SetPoint( 1, p ); - } - - template< class _TPoint > - inline _TPoint GetMinimum( ) const - { - return( this->_GetPoint< _TPoint >( 0 ) ); - } - - template< class _TPoint > - inline _TPoint GetMaximum( ) const - { - return( this->_GetPoint< _TPoint >( 1 ) ); - } - - protected: - BoundingBox( ); - virtual ~BoundingBox( ); - - void _UpdateVTK( ); - - template< class _TPoint > - inline void _SetPoint( unsigned int m, const _TPoint& p ) - { - this->m_Points[ m ].clear( ); - for( unsigned int d = 0; d < _TPoint::PointDimension; ++d ) - this->m_Points[ m ].push_back( double( p[ d ] ) ); - this->_UpdateVTK( ); - this->Modified( ); - } - - template< class _TPoint > - inline _TPoint _GetPoint( unsigned int m ) const - { - unsigned int dim = this->m_Points[ m ].size( ); - dim = - ( _TPoint::PointDimension < dim )? _TPoint::PointDimension: dim; - _TPoint p; - p.Fill( 0 ); - for( unsigned int d = 0; d < dim; ++d ) - p[ d ] = this->m_Points[ m ][ d ]; - return( p ); - } - - template< unsigned int _NDim > - inline bool _ITKImage( itk::LightObject* o ); - - template< class _TScalar, unsigned int _NDim > - inline bool _ITKPointSet( itk::LightObject* o ); - - private: - // Purposely not implemented - BoundingBox( const Self& ); - Self& operator=( const Self& ); - - protected: - std::vector< double > m_Points[ 2 ]; - vtkSmartPointer< vtkOutlineSource > m_Outline; - }; - - } // ecapseman - -} // ecapseman - -// #include - -#endif // __cpPlugins__DataObjects__BoundingBox__h__ - -// eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/Image.cxx b/lib/cpPlugins/DataObjects/Image.cxx index 77e70f6..5453dce 100644 --- a/lib/cpPlugins/DataObjects/Image.cxx +++ b/lib/cpPlugins/DataObjects/Image.cxx @@ -1,7 +1,5 @@ #include #include -#include -#include #include #include diff --git a/lib/cpPlugins/DataObjects/Image.h b/lib/cpPlugins/DataObjects/Image.h index 54710e1..238135f 100644 --- a/lib/cpPlugins/DataObjects/Image.h +++ b/lib/cpPlugins/DataObjects/Image.h @@ -2,6 +2,7 @@ #define __cpPlugins__DataObjects__Image__h__ #include +#include #include namespace cpPlugins diff --git a/lib/cpPlugins/DataObjects/Mesh.cxx b/lib/cpPlugins/DataObjects/Mesh.cxx index ca2770b..de64924 100644 --- a/lib/cpPlugins/DataObjects/Mesh.cxx +++ b/lib/cpPlugins/DataObjects/Mesh.cxx @@ -1,5 +1,4 @@ #include -#include #include #include @@ -12,12 +11,10 @@ void cpPlugins::DataObjects::Mesh:: SetITK( itk::LightObject* o ) { this->Superclass::SetITK( o ); - cpPlugins_Demangle_Mesh_Meshes_1( o, _ITK_2_VTK, 2 ) - cpPlugins_Demangle_Mesh_Meshes_1( o, _ITK_2_VTK, 3 ) + cpPlugins_Demangle_Mesh_AllMeshes_1( o, _ITK_2_VTK ) { this->m_VTK = NULL; - - } // fi + } this->Modified( ); } @@ -25,6 +22,7 @@ SetITK( itk::LightObject* o ) void cpPlugins::DataObjects::Mesh:: SetVTK( vtkObjectBase* o ) { +#ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_3 typedef itk::Mesh< double, 3 > _TMesh; typedef _TMesh::CellType _TCell; typedef _TCell::CellAutoPointer _TCellAutoPointer; @@ -109,6 +107,7 @@ SetVTK( vtkObjectBase* o ) this->Modified( ); } // fi +#endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_3 } // ------------------------------------------------------------------------- diff --git a/lib/cpPlugins/DataObjects/Mesh.d b/lib/cpPlugins/DataObjects/Mesh.d index becc6b9..acd6a2c 100644 --- a/lib/cpPlugins/DataObjects/Mesh.d +++ b/lib/cpPlugins/DataObjects/Mesh.d @@ -1,3 +1,4 @@ +AllMeshes itk::Mesh< #real_types#, #visual_dims# > Meshes|d itk::Mesh< #real_types#, d > ** eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/Mesh.h b/lib/cpPlugins/DataObjects/Mesh.h index ce3f331..1350875 100644 --- a/lib/cpPlugins/DataObjects/Mesh.h +++ b/lib/cpPlugins/DataObjects/Mesh.h @@ -2,6 +2,7 @@ #define __cpPlugins__DataObjects__Mesh__h__ #include +#include namespace cpPlugins { diff --git a/lib/cpPlugins/DataObjects/OrthoNormalBase.cxx b/lib/cpPlugins/DataObjects/OrthoNormalBase.cxx deleted file mode 100644 index 602f8a2..0000000 --- a/lib/cpPlugins/DataObjects/OrthoNormalBase.cxx +++ /dev/null @@ -1,33 +0,0 @@ -#include - -// ------------------------------------------------------------------------- -void cpPlugins::DataObjects::OrthoNormalBase:: -SetITK( itk::LightObject* o ) -{ - // WARNING: Do nothing since itk::Matrix does not belong to the - // itk::LightObject hierarchy. -} - -// ------------------------------------------------------------------------- -void cpPlugins::DataObjects::OrthoNormalBase:: -SetVTK( vtkObjectBase* o ) -{ - auto matrix = dynamic_cast< vtkMatrix4x4* >( o ); - if( matrix != NULL ) - this->Superclass::SetVTK( matrix ); -} - -// ------------------------------------------------------------------------- -cpPlugins::DataObjects::OrthoNormalBase:: -OrthoNormalBase( ) - : Superclass( ) -{ -} - -// ------------------------------------------------------------------------- -cpPlugins::DataObjects::OrthoNormalBase:: -~OrthoNormalBase( ) -{ -} - -// eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/OrthoNormalBase.h b/lib/cpPlugins/DataObjects/OrthoNormalBase.h deleted file mode 100644 index f15e64a..0000000 --- a/lib/cpPlugins/DataObjects/OrthoNormalBase.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __cpPlugins__DataObjects__OrthoNormalBase__h__ -#define __cpPlugins__DataObjects__OrthoNormalBase__h__ - -#include - -namespace cpPlugins -{ - namespace DataObjects - { - /** - */ - class cpPlugins_EXPORT OrthoNormalBase - : public cpPlugins::BaseObjects::DataObject - { - public: - typedef OrthoNormalBase Self; - typedef cpPlugins::BaseObjects::DataObject Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - public: - itkNewMacro( Self ); - itkTypeMacro( OrthoNormalBase, DataObject ); - cpPlugins_Id_Macro( OrthoNormalBase, Object ); - cpPlugins_Compatibility_Macro; - - public: - virtual void SetITK( itk::LightObject* o ) cpPlugins_OVERRIDE; - virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE; - - template< class _TMatrix > - inline void SetITK( const _TMatrix& m ); - - template< class _TMatrix, class _TVector > - inline void SetITK( const _TMatrix& m, const _TVector& v ); - - protected: - OrthoNormalBase( ); - virtual ~OrthoNormalBase( ); - - private: - // Purposely not implemented - OrthoNormalBase( const Self& ); - Self& operator=( const Self& ); - }; - - } // ecapseman - -} // ecapseman - -#include - -#endif // __cpPlugins__DataObjects__OrthoNormalBase__h__ - -// eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/OrthoNormalBase.hxx b/lib/cpPlugins/DataObjects/OrthoNormalBase.hxx deleted file mode 100644 index 92a74e2..0000000 --- a/lib/cpPlugins/DataObjects/OrthoNormalBase.hxx +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __cpPlugins__DataObjects__OrthoNormalBase__hxx__ -#define __cpPlugins__DataObjects__OrthoNormalBase__hxx__ - -#include - -// ------------------------------------------------------------------------- -template< class _TMatrix > -void cpPlugins::DataObjects::OrthoNormalBase:: -SetITK( const _TMatrix& m ) -{ - vtkMatrix4x4* matrix = vtkMatrix4x4::New( ); - matrix->Identity( ); - for( unsigned int i = 0; i < 4; ++i ) - if( i < _TMatrix::RowDimensions ) - for( unsigned int j = 0; j < 4; ++j ) - if( j < _TMatrix::ColumnDimensions ) - matrix->SetElement( i, j, m[ i ][ j ] ); - this->m_VTK = matrix; -} - -// ------------------------------------------------------------------------- -template< class _TMatrix, class _TVector > -void cpPlugins::DataObjects::OrthoNormalBase:: -SetITK( const _TMatrix& m, const _TVector& v ) -{ - vtkMatrix4x4* matrix = vtkMatrix4x4::New( ); - matrix->Identity( ); - for( unsigned int i = 0; i < 3; ++i ) - if( i < _TMatrix::RowDimensions ) - for( unsigned int j = 0; j < 3; ++j ) - if( j < _TMatrix::ColumnDimensions ) - matrix->SetElement( i, j, m[ i ][ j ] ); - for( unsigned int i = 0; i < 3; ++i ) - if( i < _TVector::Dimension ) - matrix->SetElement( i, 3, v[ i ] ); - this->m_VTK = matrix; -} - -#endif // __cpPlugins__DataObjects__OrthoNormalBase__hxx__ - -// eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/PolyLineParametricPath.h b/lib/cpPlugins/DataObjects/PolyLineParametricPath.h deleted file mode 100644 index a5c0896..0000000 --- a/lib/cpPlugins/DataObjects/PolyLineParametricPath.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef __cpPlugins__DataObjects__PolyLineParametricPath__h__ -#define __cpPlugins__DataObjects__PolyLineParametricPath__h__ - -#include -#include - -// ------------------------------------------------------------------------- -class vtkPolyDataAlgorithm; - -// ------------------------------------------------------------------------- -namespace cpPlugins -{ - namespace DataObjects - { - /** - */ - class cpPlugins_EXPORT PolyLineParametricPath - : public cpPlugins::BaseObjects::DataObject - { - public: - typedef PolyLineParametricPath Self; - typedef cpPlugins::BaseObjects::DataObject Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - public: - itkNewMacro( Self ); - itkTypeMacro( - PolyLineParametricPath, cpPlugins::BaseObjects::DataObject - ); - cpPlugins_Id_Macro( PolyLineParametricPath, Object ); - cpPlugins_Compatibility_Macro; - - public: - virtual void SetITK( itk::LightObject* o ) cpPlugins_OVERRIDE; - virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE; - - protected: - PolyLineParametricPath( ); - virtual ~PolyLineParametricPath( ); - - template< class _TPolyLine > - inline void _ITK_2_VTK( _TPolyLine* pl ); - - private: - // Purposely not implemented - PolyLineParametricPath( const Self& ); - Self& operator=( const Self& ); - - protected: - vtkSmartPointer< vtkPolyDataAlgorithm > m_ITKvVTK; - }; - - } // ecapseman - -} // ecapseman - -#endif // __cpPlugins__DataObjects__PolyLineParametricPath__h__ - -// eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/Simple3DCurve.cxx b/lib/cpPlugins/DataObjects/Simple3DCurve.cxx deleted file mode 100644 index 7f79bba..0000000 --- a/lib/cpPlugins/DataObjects/Simple3DCurve.cxx +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include -#include - -#include - -// ------------------------------------------------------------------------- -void cpPlugins::DataObjects::Simple3DCurve:: -SetITK( itk::LightObject* o ) -{ - cpPlugins_Demangle_Simple3DCurve_All_1( o, _ITK_2_VTK ) - { - this->m_VTK = NULL; - this->m_ITKvVTK = NULL; - } -} - -// ------------------------------------------------------------------------- -void cpPlugins::DataObjects::Simple3DCurve:: -SetVTK( vtkObjectBase* o ) -{ - // Do nothing - this->m_ITK = NULL; - this->m_VTK = NULL; - this->m_ITKvVTK = NULL; -} - -// ------------------------------------------------------------------------- -cpPlugins::DataObjects::Simple3DCurve:: -Simple3DCurve( ) - : Superclass( ) -{ -} - -// ------------------------------------------------------------------------- -cpPlugins::DataObjects::Simple3DCurve:: -~Simple3DCurve( ) -{ -} - -// ------------------------------------------------------------------------- -template< class _TSimple3DCurve > -void cpPlugins::DataObjects::Simple3DCurve:: -_ITK_2_VTK( _TSimple3DCurve* curve ) -{ - typedef - cpExtensions::Visualization::Simple3DCurveToPolyData< _TSimple3DCurve > - _TFilter; - _TFilter* f = dynamic_cast< _TFilter* >( this->m_ITKvVTK.GetPointer( ) ); - if( f == NULL ) - { - _TFilter* nf = _TFilter::New( ); - this->m_ITKvVTK = nf; - f = nf; - - } // fi - f->SetInput( curve ); - f->Update( ); - - // Keep object track - this->m_ITK = curve; - this->m_VTK = f->GetOutput( ); -} - -// eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/Simple3DCurve.d b/lib/cpPlugins/DataObjects/Simple3DCurve.d deleted file mode 100644 index 998b791..0000000 --- a/lib/cpPlugins/DataObjects/Simple3DCurve.d +++ /dev/null @@ -1,4 +0,0 @@ - -All cpExtensions::DataStructures::Simple3DCurve< #real_types# > - -** eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/Simple3DCurve.h b/lib/cpPlugins/DataObjects/Simple3DCurve.h deleted file mode 100644 index 844146d..0000000 --- a/lib/cpPlugins/DataObjects/Simple3DCurve.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef __cpPlugins__DataObjects__Simple3DCurve__h__ -#define __cpPlugins__DataObjects__Simple3DCurve__h__ - -#include -#include - -// ------------------------------------------------------------------------- -class vtkPolyDataAlgorithm; - -// ------------------------------------------------------------------------- -namespace cpPlugins -{ - namespace DataObjects - { - /** - */ - class cpPlugins_EXPORT Simple3DCurve - : public cpPlugins::BaseObjects::DataObject - { - public: - typedef Simple3DCurve Self; - typedef cpPlugins::BaseObjects::DataObject Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - public: - itkNewMacro( Self ); - itkTypeMacro( - Simple3DCurve, cpPlugins::BaseObjects::DataObject - ); - cpPlugins_Id_Macro( Simple3DCurve, Object ); - cpPlugins_Compatibility_Macro; - - public: - virtual void SetITK( itk::LightObject* o ) cpPlugins_OVERRIDE; - virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE; - - protected: - Simple3DCurve( ); - virtual ~Simple3DCurve( ); - - template< class _TSimple3DCurve > - inline void _ITK_2_VTK( _TSimple3DCurve* curve ); - - private: - // Purposely not implemented - Simple3DCurve( const Self& ); - Self& operator=( const Self& ); - - protected: - vtkSmartPointer< vtkPolyDataAlgorithm > m_ITKvVTK; - }; - - } // ecapseman - -} // ecapseman - -#endif // __cpPlugins__DataObjects__Simple3DCurve__h__ - -// eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/Skeleton.h b/lib/cpPlugins/DataObjects/Skeleton.h deleted file mode 100644 index a924576..0000000 --- a/lib/cpPlugins/DataObjects/Skeleton.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef __cpPlugins__DataObjects__Skeleton__h__ -#define __cpPlugins__DataObjects__Skeleton__h__ - -#include -#include - -// ------------------------------------------------------------------------- -class vtkPolyDataAlgorithm; - -// ------------------------------------------------------------------------- -namespace cpPlugins -{ - namespace DataObjects - { - /** - */ - class cpPlugins_EXPORT Skeleton - : public cpPlugins::BaseObjects::DataObject - { - public: - typedef Skeleton Self; - typedef cpPlugins::BaseObjects::DataObject Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - public: - itkNewMacro( Self ); - itkTypeMacro( - Skeleton, cpPlugins::BaseObjects::DataObject - ); - cpPlugins_Id_Macro( Skeleton, Object ); - cpPlugins_Compatibility_Macro; - - public: - virtual void SetITK( itk::LightObject* o ) cpPlugins_OVERRIDE; - virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE; - - protected: - Skeleton( ); - virtual ~Skeleton( ); - - template< class _TSkeleton > - inline void _ITK_2_VTK( _TSkeleton* sk ); - - private: - // Purposely not implemented - Skeleton( const Self& ); - Self& operator=( const Self& ); - - protected: - vtkSmartPointer< vtkPolyDataAlgorithm > m_ITKvVTK; - }; - - } // ecapseman - -} // ecapseman - -#endif // __cpPlugins__DataObjects__Skeleton__h__ - -// eof - $RCSfile$ diff --git a/lib/cpPlugins/Interface/Plugins.cxx b/lib/cpPlugins/Interface/Plugins.cxx index eabd53e..81366c1 100644 --- a/lib/cpPlugins/Interface/Plugins.cxx +++ b/lib/cpPlugins/Interface/Plugins.cxx @@ -1,7 +1,7 @@ #include #include #include -#include +#include // ------------------------------------------------------------------------- cpPlugins::Interface::Plugins:: @@ -85,9 +85,9 @@ void cpPlugins::Interface::Plugins:: AddEnvironments( const std::string& env ) { std::vector< std::string > directories; - cpExtensions::Tokenize( directories, env, cpPlugins_ENV_SEPARATOR ); + cpPlugins::Tokenize( directories, env, cpPlugins_ENV_SEPARATOR ); for( auto dir = directories.begin( ); dir != directories.end( ); ++dir ) - this->m_Paths.insert( cpExtensions::CanonicalPath( *dir ) ); + this->m_Paths.insert( cpPlugins::CanonicalPath( *dir ) ); } // ------------------------------------------------------------------------- @@ -100,7 +100,7 @@ LoadEnvironments( ) std::stringstream fname; fname << *d << cpPlugins_PATH_SEPARATOR << cpPlugins_CONFIG; std::string buffer; - if( cpExtensions::Read( buffer, fname.str( ) ) ) + if( cpPlugins::Read( buffer, fname.str( ) ) ) { std::istringstream input( buffer ); for( std::string line; std::getline( input, line ); ) @@ -125,7 +125,7 @@ LoadEnvironments( ) for( auto l = libs.begin( ); l != libs.end( ); ++l ) { - std::string lib = cpExtensions::CanonicalPath( *l ); + std::string lib = cpPlugins::CanonicalPath( *l ); if( lib != "" ) { if( this->m_Libraries.find( lib ) == this->m_Libraries.end( ) ) @@ -148,11 +148,11 @@ LoadPaths( const std::string& dir ) { std::stringstream fname, envs; fname << dir; - if( !cpExtensions::IsPathSeparator( dir.back( ) ) ) - fname << cpExtensions_PATH_SEPARATOR; + if( !cpPlugins::IsPathSeparator( dir.back( ) ) ) + fname << cpPlugins_PATH_SEPARATOR; fname << cpPlugins_PATHS; std::string buffer; - if( cpExtensions::Read( buffer, fname.str( ) ) ) + if( cpPlugins::Read( buffer, fname.str( ) ) ) { std::istringstream input( buffer ); for( std::string line; std::getline( input, line ); ) @@ -173,10 +173,10 @@ SavePaths( const std::string& dir ) const std::stringstream fname; fname << dir; - if( !cpExtensions::IsPathSeparator( dir.back( ) ) ) - fname << cpExtensions_PATH_SEPARATOR; + if( !cpPlugins::IsPathSeparator( dir.back( ) ) ) + fname << cpPlugins_PATH_SEPARATOR; fname << cpPlugins_PATHS; - if( !cpExtensions::Write( buffer.str( ), fname.str( ) ) ) + if( !cpPlugins::Write( buffer.str( ), fname.str( ) ) ) throw std::runtime_error( "Error writing environment file." ); } @@ -185,7 +185,7 @@ void cpPlugins::Interface::Plugins:: LoadFile( const std::string& fname ) { // Resolve canonical filename - std::string can_name = cpExtensions::CanonicalPath( fname ); + std::string can_name = cpPlugins::CanonicalPath( fname ); if( can_name == "" ) throw std::runtime_error( std::string( "Loading file: can't find library \"" ) + @@ -307,8 +307,8 @@ LoadPlugin( const std::string& pname ) { std::stringstream dir; dir << *i; - if( !cpExtensions::IsPathSeparator( i->back( ) ) ) - dir << cpExtensions_PATH_SEPARATOR; + if( !cpPlugins::IsPathSeparator( i->back( ) ) ) + dir << cpPlugins_PATH_SEPARATOR; dir << fname.str( ); try { diff --git a/lib/cpPlugins/Utility.h b/lib/cpPlugins/Utility.h new file mode 100644 index 0000000..3fab862 --- /dev/null +++ b/lib/cpPlugins/Utility.h @@ -0,0 +1,136 @@ +#ifndef __cpPlugins__Utility__h__ +#define __cpPlugins__Utility__h__ + +#include +#include +#include +#include +#include + +// ------------------------------------------------------------------------- +#ifdef cpPlugins_OS_Windows +# define cpPlugins_STRTOK( A, B, N ) strtok_s( A, B, N ) +# define cpPlugins_SPRINTF( B, S, O ) sprintf_s( B, S, "%s", O ); +#else // cpPlugins_OS_Windows +# define cpPlugins_STRTOK( A, B, N ) std::strtok( A, B ) +# define cpPlugins_SPRINTF( B, S, O ) std::sprintf( B, "%s", O ); +#endif // cpPlugins_OS_Windows + +// ------------------------------------------------------------------------- +#define cpPlugins_CHRONO \ + std::chrono::duration_cast< std::chrono::milliseconds >( \ + std::chrono::system_clock::now( ).time_since_epoch( ) \ + ).count( ) + +// ------------------------------------------------------------------------- +namespace cpPlugins +{ + // ----------------------------------------------------------------------- + inline bool IsPathSeparator( char c ) + { +#ifdef cpPlugins_OS_Windows + return( c == '/' || c == cpPlugins_PATH_SEPARATOR ); +#else // cpPlugins_OS_Windows + return( c == cpPlugins_PATH_SEPARATOR ); +#endif // cpPlugins_OS_Windows + } + + // ----------------------------------------------------------------------- + inline bool IsBlank( const char& v ) + { + return( v == ' ' || v == '\t' || v == '\n' || v == '\r' ); + } + + // ----------------------------------------------------------------------- + template< class _TTokens > + inline void Tokenize( + _TTokens& tokens, const std::string& str, const std::string& delims + ) + { + tokens.clear( ); + if( str.size( ) > 0 ) + { + auto ssize = str.size( ); + char* buffer = new char[ ssize + 1 ]; + for( unsigned long i = 0; i < ssize; ++i ) + buffer[ i ] = str[ i ]; + buffer[ ssize ] = '\0'; + char* next; + char* it = cpPlugins_STRTOK( buffer, delims.c_str( ), &next ); + while( it != NULL ) + { + tokens.push_back( std::string( it ) ); + it = cpPlugins_STRTOK( NULL, delims.c_str( ), &next ); + + } // elihw + delete [] buffer; + + } // fi + } + + // ----------------------------------------------------------------------- + inline std::string Replace( + const std::string& str, const std::string& sub, const std::string& nsub + ) + { + std::string res = str; + size_t index; + while( ( index = res.find( sub ) ) != std::string::npos ) + res.replace( index, sub.size( ), nsub ); + return( res ); + } + + // ----------------------------------------------------------------------- + inline bool Read( std::string& buffer, const std::string& fname ) + { + buffer = ""; + std::ifstream file_stream( fname.c_str( ) ); + if( !file_stream ) + return( false ); + file_stream.seekg( 0, std::ios::end ); + buffer.reserve( ( unsigned int )( file_stream.tellg( ) ) ); + file_stream.seekg( 0, std::ios::beg ); + buffer.assign( + ( std::istreambuf_iterator< char >( file_stream ) ), + std::istreambuf_iterator< char >( ) + ); + file_stream.close( ); + return( true ); + } + + // ----------------------------------------------------------------------- + inline bool Write( const std::string& buffer, const std::string& fname ) + { + std::ofstream file_stream( fname.c_str( ), std::ofstream::binary ); + if( !file_stream ) + return( false ); + file_stream.write( buffer.c_str( ), buffer.size( ) ); + return( true ); + } + + // ----------------------------------------------------------------------- + inline std::string CanonicalPath( const std::string& path ) + { + std::string ret = ""; +#ifdef cpPlugins_OS_Windows + TCHAR buffer[ 4096 ] = TEXT( "" ); + TCHAR** lppPart = { NULL }; + GetFullPathName( path.c_str( ), 4096, buffer, lppPart ); + ret = std::string( buffer ); +#else // cpPlugins_OS_Windows + char* canonical_path = realpath( path.c_str( ), NULL ); + if( canonical_path != NULL ) + { + ret = canonical_path; + free( canonical_path ); + + } // fi +#endif // cpPlugins_OS_Windows + return( ret ); + } + +} // ecapseman + +#endif // __cpPlugins__Utility__h__ + +// eof - $RCSfile$ diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 1a97df6..c83c434 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -4,26 +4,27 @@ SET( _dirlist - AnisotropicDiffusion - GenericFilters - ImageArithmeticFilters - ImageBooleanFilters - ImageDistanceMaps - ImageGenericFilters - ImageGradientFilters - ImageMeshFilters - ImageSliceFilters - ImageSources - ImageThresholdFilters + Extensions + # AnisotropicDiffusion + # GenericFilters + # ImageArithmeticFilters + # ImageBooleanFilters + # ImageDistanceMaps + # ImageGenericFilters + # ImageGradientFilters + # ImageMeshFilters + # ImageSliceFilters + # ImageSources + # ImageThresholdFilters IO - MeshFilters - MeshSources + # MeshFilters + # MeshSources Widgets ) -IF(ParabolicMorphology_LOADED) - LIST(APPEND _dirlist ImageParaMorphologyFilters) -ENDIF(ParabolicMorphology_LOADED) +#IF(ParabolicMorphology_LOADED) +# LIST(APPEND _dirlist ImageParaMorphologyFilters) +#ENDIF(ParabolicMorphology_LOADED) ## =============================== ## == Build each plugin library == @@ -45,22 +46,27 @@ FOREACH(_dir ${_dirlist}) ENDFOREACH(_dir) TARGET_LINK_LIBRARIES( - cpPluginsImageDistanceMaps - cpPluginsImageThresholdFilters + cpPluginsIO + cpPluginsExtensions ) -TARGET_LINK_LIBRARIES( - cpPluginsImageSliceFilters - cpPluginsImageGenericFilters - ) -TARGET_LINK_LIBRARIES( - cpPluginsImageGradientFilters - cpPluginsImageGenericFilters - ) -IF(ParabolicMorphology_LOADED) - TARGET_LINK_LIBRARIES( - cpPluginsImageParaMorphologyFilters - cpPluginsImageThresholdFilters - ) -ENDIF(ParabolicMorphology_LOADED) + +#TARGET_LINK_LIBRARIES( +# cpPluginsImageDistanceMaps +# cpPluginsImageThresholdFilters +# ) +#TARGET_LINK_LIBRARIES( +# cpPluginsImageSliceFilters +# cpPluginsImageGenericFilters +# ) +#TARGET_LINK_LIBRARIES( +# cpPluginsImageGradientFilters +# cpPluginsImageGenericFilters +# ) +#IF(ParabolicMorphology_LOADED) +# TARGET_LINK_LIBRARIES( +# cpPluginsImageParaMorphologyFilters +# cpPluginsImageThresholdFilters +# ) +#ENDIF(ParabolicMorphology_LOADED) ## eof - $RSCfile$ diff --git a/plugins/Extensions/Extensions.i b/plugins/Extensions/Extensions.i new file mode 100644 index 0000000..e1b9fc5 --- /dev/null +++ b/plugins/Extensions/Extensions.i @@ -0,0 +1,13 @@ +header #define ITK_MANUAL_INSTANTIATION + +tinclude cpExtensions/DataStructures/PolyLineParametricPath:h|hxx +tinclude cpExtensions/DataStructures/Skeleton:h|hxx +tinclude cpExtensions/Algorithms/BezierCurveFunction:h|hxx + +cinclude cpExtensions/DataStructures/Graph.hxx + +instances cpExtensions::Algorithms::BezierCurveFunction< itk::Vector< #real_types#, #process_dims# > > +instances cpExtensions::DataStructures::PolyLineParametricPath< #process_dims# > +instances cpExtensions::DataStructures::Skeleton< #process_dims# > + +** eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/PolyLineParametricPath.cxx b/plugins/Extensions/PolyLineParametricPath.cxx similarity index 78% rename from lib/cpPlugins/DataObjects/PolyLineParametricPath.cxx rename to plugins/Extensions/PolyLineParametricPath.cxx index 357f38a..cb4a6be 100644 --- a/lib/cpPlugins/DataObjects/PolyLineParametricPath.cxx +++ b/plugins/Extensions/PolyLineParametricPath.cxx @@ -1,10 +1,9 @@ -#include +#include #include -#include #include // ------------------------------------------------------------------------- -void cpPlugins::DataObjects::PolyLineParametricPath:: +void cpPluginsExtensions::PolyLineParametricPath:: SetITK( itk::LightObject* o ) { this->Superclass::SetITK( o ); @@ -16,7 +15,7 @@ SetITK( itk::LightObject* o ) } // ------------------------------------------------------------------------- -void cpPlugins::DataObjects::PolyLineParametricPath:: +void cpPluginsExtensions::PolyLineParametricPath:: SetVTK( vtkObjectBase* o ) { // Do nothing @@ -26,21 +25,21 @@ SetVTK( vtkObjectBase* o ) } // ------------------------------------------------------------------------- -cpPlugins::DataObjects::PolyLineParametricPath:: +cpPluginsExtensions::PolyLineParametricPath:: PolyLineParametricPath( ) : Superclass( ) { } // ------------------------------------------------------------------------- -cpPlugins::DataObjects::PolyLineParametricPath:: +cpPluginsExtensions::PolyLineParametricPath:: ~PolyLineParametricPath( ) { } // ------------------------------------------------------------------------- template< class _TPolyLine > -void cpPlugins::DataObjects::PolyLineParametricPath:: +void cpPluginsExtensions::PolyLineParametricPath:: _ITK_2_VTK( _TPolyLine* pl ) { typedef diff --git a/lib/cpPlugins/DataObjects/PolyLineParametricPath.d b/plugins/Extensions/PolyLineParametricPath.d similarity index 100% rename from lib/cpPlugins/DataObjects/PolyLineParametricPath.d rename to plugins/Extensions/PolyLineParametricPath.d diff --git a/plugins/Extensions/PolyLineParametricPath.h b/plugins/Extensions/PolyLineParametricPath.h new file mode 100644 index 0000000..566a4be --- /dev/null +++ b/plugins/Extensions/PolyLineParametricPath.h @@ -0,0 +1,58 @@ +#ifndef __cpPluginsExtensions__PolyLineParametricPath__h__ +#define __cpPluginsExtensions__PolyLineParametricPath__h__ + +#include +#include +#include +#include + +// ------------------------------------------------------------------------- +class vtkPolyDataAlgorithm; + +// ------------------------------------------------------------------------- +namespace cpPluginsExtensions +{ + /** + */ + class cpPluginsExtensions_EXPORT PolyLineParametricPath + : public cpPlugins::BaseObjects::DataObject + { + public: + typedef PolyLineParametricPath Self; + typedef cpPlugins::BaseObjects::DataObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + public: + itkNewMacro( Self ); + itkTypeMacro( + PolyLineParametricPath, cpPlugins::BaseObjects::DataObject + ); + cpPlugins_Id_Macro( PolyLineParametricPath, Object ); + cpPlugins_Compatibility_Macro; + + public: + virtual void SetITK( itk::LightObject* o ) cpPlugins_OVERRIDE; + virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE; + + protected: + PolyLineParametricPath( ); + virtual ~PolyLineParametricPath( ); + + template< class _TPolyLine > + inline void _ITK_2_VTK( _TPolyLine* pl ); + + private: + // Purposely not implemented + PolyLineParametricPath( const Self& ); + Self& operator=( const Self& ); + + protected: + vtkSmartPointer< vtkPolyDataAlgorithm > m_ITKvVTK; + }; + +} // ecapseman + +#endif // __cpPluginsExtensions__PolyLineParametricPath__h__ + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/Skeleton.cxx b/plugins/Extensions/Skeleton.cxx similarity index 81% rename from lib/cpPlugins/DataObjects/Skeleton.cxx rename to plugins/Extensions/Skeleton.cxx index 098595a..9e17f62 100644 --- a/lib/cpPlugins/DataObjects/Skeleton.cxx +++ b/plugins/Extensions/Skeleton.cxx @@ -1,10 +1,9 @@ -#include +#include #include -#include #include // ------------------------------------------------------------------------- -void cpPlugins::DataObjects::Skeleton:: +void cpPluginsExtensions::Skeleton:: SetITK( itk::LightObject* o ) { cpPlugins_Demangle_Skeleton_All_1( o, _ITK_2_VTK ) @@ -15,7 +14,7 @@ SetITK( itk::LightObject* o ) } // ------------------------------------------------------------------------- -void cpPlugins::DataObjects::Skeleton:: +void cpPluginsExtensions::Skeleton:: SetVTK( vtkObjectBase* o ) { // Do nothing @@ -25,21 +24,21 @@ SetVTK( vtkObjectBase* o ) } // ------------------------------------------------------------------------- -cpPlugins::DataObjects::Skeleton:: +cpPluginsExtensions::Skeleton:: Skeleton( ) : Superclass( ) { } // ------------------------------------------------------------------------- -cpPlugins::DataObjects::Skeleton:: +cpPluginsExtensions::Skeleton:: ~Skeleton( ) { } // ------------------------------------------------------------------------- template< class _TSkeleton > -void cpPlugins::DataObjects::Skeleton:: +void cpPluginsExtensions::Skeleton:: _ITK_2_VTK( _TSkeleton* sk ) { typedef diff --git a/lib/cpPlugins/DataObjects/Skeleton.d b/plugins/Extensions/Skeleton.d similarity index 100% rename from lib/cpPlugins/DataObjects/Skeleton.d rename to plugins/Extensions/Skeleton.d diff --git a/plugins/Extensions/Skeleton.h b/plugins/Extensions/Skeleton.h new file mode 100644 index 0000000..839da17 --- /dev/null +++ b/plugins/Extensions/Skeleton.h @@ -0,0 +1,58 @@ +#ifndef __cpPluginsExtensions__Skeleton__h__ +#define __cpPluginsExtensions__Skeleton__h__ + +#include +#include +#include +#include + +// ------------------------------------------------------------------------- +class vtkPolyDataAlgorithm; + +// ------------------------------------------------------------------------- +namespace cpPluginsExtensions +{ + /** + */ + class cpPluginsExtensions_EXPORT Skeleton + : public cpPlugins::BaseObjects::DataObject + { + public: + typedef Skeleton Self; + typedef cpPlugins::BaseObjects::DataObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + public: + itkNewMacro( Self ); + itkTypeMacro( + Skeleton, cpPlugins::BaseObjects::DataObject + ); + cpPlugins_Id_Macro( Skeleton, Object ); + cpPlugins_Compatibility_Macro; + + public: + virtual void SetITK( itk::LightObject* o ) cpPlugins_OVERRIDE; + virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE; + + protected: + Skeleton( ); + virtual ~Skeleton( ); + + template< class _TSkeleton > + inline void _ITK_2_VTK( _TSkeleton* sk ); + + private: + // Purposely not implemented + Skeleton( const Self& ); + Self& operator=( const Self& ); + + protected: + vtkSmartPointer< vtkPolyDataAlgorithm > m_ITKvVTK; + }; + +} // ecapseman + +#endif // __cpPluginsExtensions__Skeleton__h__ + +// eof - $RCSfile$ diff --git a/plugins/IO/ImageJSkeletonWriter.cxx b/plugins/IO/ImageJSkeletonWriter.cxx index b6c279d..7d230db 100644 --- a/plugins/IO/ImageJSkeletonWriter.cxx +++ b/plugins/IO/ImageJSkeletonWriter.cxx @@ -1,8 +1,7 @@ #include -#include -#include #include +#include #include #include @@ -33,7 +32,9 @@ cpPluginsIO::ImageJSkeletonWriter:: ImageJSkeletonWriter( ) : Superclass( ) { - this->_ConfigureInput< cpPlugins::DataObjects::Skeleton >( "Input", true, false ); + typedef cpPluginsExtensions::Skeleton _TSkeleton; + this->_ConfigureInput< _TSkeleton >( "Input", true, false ); + this->m_Parameters.ConfigureAsSaveFileName( "FileName", "" ); this->m_Parameters.SetAcceptedFileExtensions( "FileName", diff --git a/plugins/IO/ImageWriter.cxx b/plugins/IO/ImageWriter.cxx index c5aa3df..55238a7 100644 --- a/plugins/IO/ImageWriter.cxx +++ b/plugins/IO/ImageWriter.cxx @@ -1,10 +1,9 @@ #include #include -#include #include -#include #include +#include #ifdef cpPlugins_QT4 # include