]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorDuvan Gomez <da.gomez16@uniandes.edu.co>
Tue, 9 May 2017 20:47:50 +0000 (15:47 -0500)
committerDuvan Gomez <da.gomez16@uniandes.edu.co>
Tue, 9 May 2017 20:47:50 +0000 (15:47 -0500)
139 files changed:
CMakeLists.txt
appli/CMakeLists.txt [deleted file]
appli/examples/CMakeLists.txt [deleted file]
appli/examples/ImageDijkstra.cxx [deleted file]
appli/experiments/CMakeLists.txt [deleted file]
appli/experiments/Hausdorff.cxx [deleted file]
appli/experiments/Skeleton_00.cxx [deleted file]
cmake/CMakeLists.txt [deleted file]
cmake/Functions.cmake [deleted file]
cmake/KitwareTools.cmake [deleted file]
cmake/QtTools.cmake [deleted file]
cmake/fpaBaseConfig.cmake [moved from cmake/BaseConfig.cmake with 56% similarity]
cmake/fpaConfig.cmake.in [new file with mode: 0644]
data/input_mori_binary.png [new file with mode: 0644]
data/ones_image.png [deleted file]
data/test_mori_2D.png [deleted file]
data/test_skeleton_2D.png [deleted file]
data/workspaces/workspace_airwaysappli.wxml [deleted file]
examples/BronchiiInitialSegmentationWithBinaryThresholdRegionGrow.cxx [new file with mode: 0644]
examples/BronchiiInitialSegmentationWithMori.cxx [new file with mode: 0644]
examples/CMakeLists.txt
examples/CreateMoriInputImage.cxx [new file with mode: 0644]
examples/Dijkstra_Maurer.cxx [new file with mode: 0644]
examples/FastMarching_00.cxx [deleted file]
examples/MoriRegionGrow_00.cxx [deleted file]
examples/RegionGrow_00.cxx [deleted file]
examples/RegionGrow_BinaryThreshold.cxx [new file with mode: 0644]
examples/RegionGrow_Mori.cxx [new file with mode: 0644]
examples/RegionGrow_Tautology.cxx [new file with mode: 0644]
examples/Skeleton_00.cxx [deleted file]
examples/sandbox.cxx [new file with mode: 0644]
lib/CMakeLists.txt
lib/fpa/Base/Algorithm.h [deleted file]
lib/fpa/Base/Algorithm.hxx [deleted file]
lib/fpa/Base/Dijkstra.h
lib/fpa/Base/Dijkstra.hxx
lib/fpa/Base/Events.h [deleted file]
lib/fpa/Base/FastMarching.h [deleted file]
lib/fpa/Base/FastMarching.hxx [deleted file]
lib/fpa/Base/Functors/GaussianModel.h [deleted file]
lib/fpa/Base/Functors/GaussianModel.hxx [deleted file]
lib/fpa/Base/Functors/Inverse.h [deleted file]
lib/fpa/Base/Functors/Inverse.hxx [deleted file]
lib/fpa/Base/Functors/InvertValue.h [new file with mode: 0644]
lib/fpa/Base/Functors/RegionGrow/Base.h [deleted file]
lib/fpa/Base/Functors/RegionGrow/Tautology.h [deleted file]
lib/fpa/Base/Functors/VertexCostFunctionBase.h [deleted file]
lib/fpa/Base/Functors/VertexParentBase.h [new file with mode: 0644]
lib/fpa/Base/MarksInterface.h [new file with mode: 0644]
lib/fpa/Base/MarksInterface.hxx [new file with mode: 0644]
lib/fpa/Base/MinimumSpanningTree.h
lib/fpa/Base/MinimumSpanningTree.hxx
lib/fpa/Base/MoriRegionGrow.h [new file with mode: 0644]
lib/fpa/Base/MoriRegionGrow.hxx [new file with mode: 0644]
lib/fpa/Base/PriorityQueueAlgorithm.hxx [deleted file]
lib/fpa/Base/QueueAlgorithm.h [deleted file]
lib/fpa/Base/QueueAlgorithm.hxx [deleted file]
lib/fpa/Base/RegionGrow.h
lib/fpa/Base/RegionGrow.hxx
lib/fpa/Base/SeedsInterface.h [new file with mode: 0644]
lib/fpa/Base/SeedsInterface.hxx [new file with mode: 0644]
lib/fpa/CMakeLists.txt [new file with mode: 0644]
lib/fpa/Config.h [deleted file]
lib/fpa/Image/Algorithm.h [deleted file]
lib/fpa/Image/Algorithm.hxx [deleted file]
lib/fpa/Image/Dijkstra.h
lib/fpa/Image/Dijkstra.hxx [deleted file]
lib/fpa/Image/EndPointsFilter.h [deleted file]
lib/fpa/Image/EndPointsFilter.hxx [deleted file]
lib/fpa/Image/FastMarching.h [deleted file]
lib/fpa/Image/FastMarching.hxx [deleted file]
lib/fpa/Image/Filter.h [new file with mode: 0644]
lib/fpa/Image/Filter.hxx [new file with mode: 0644]
lib/fpa/Image/Functors/Base.h [deleted file]
lib/fpa/Image/Functors/GaussianWeight.h [new file with mode: 0644]
lib/fpa/Image/Functors/RegionGrow/BinaryThreshold.h
lib/fpa/Image/Functors/RegionGrow/BinaryThreshold.hxx
lib/fpa/Image/Functors/RegionGrow/Tautology.h [new file with mode: 0644]
lib/fpa/Image/Functors/SimpleNeighborhood.h [deleted file]
lib/fpa/Image/Functors/SimpleNeighborhood.hxx [deleted file]
lib/fpa/Image/Functors/VertexCost.h [deleted file]
lib/fpa/Image/Functors/VertexCost.hxx [deleted file]
lib/fpa/Image/Functors/VertexIdentity.h [new file with mode: 0644]
lib/fpa/Image/Functors/VertexParentBase.h [new file with mode: 0644]
lib/fpa/Image/MarksInterface.h [new file with mode: 0644]
lib/fpa/Image/MarksInterface.hxx [new file with mode: 0644]
lib/fpa/Image/MinimumSpanningTree.h
lib/fpa/Image/MinimumSpanningTree.hxx [deleted file]
lib/fpa/Image/MinimumSpanningTreeToImageFilter.h [new file with mode: 0644]
lib/fpa/Image/MinimumSpanningTreeToImageFilter.hxx [new file with mode: 0644]
lib/fpa/Image/MoriRegionGrow.h
lib/fpa/Image/MoriRegionGrow.hxx [deleted file]
lib/fpa/Image/MoriRegionGrowHelper.h [deleted file]
lib/fpa/Image/MoriRegionGrowHelper.hxx [deleted file]
lib/fpa/Image/RegionGrow.h
lib/fpa/Image/RegionGrow.hxx [deleted file]
lib/fpa/Image/SkeletonFilter.h [deleted file]
lib/fpa/Image/SkeletonFilter.hxx [deleted file]
lib/fpaInstances/BaseFilters.i [deleted file]
lib/fpaInstances/CMakeLists.txt [deleted file]
lib/fpaInstances/DataObjects.i [deleted file]
lib/fpaInstances/ImageFilters.i [deleted file]
lib/fpaInstances/ImageFunctors.i [deleted file]
plugins/CMakeLists.txt [deleted file]
plugins/DijkstraFunctors/DijkstraFunctors.i [deleted file]
plugins/DijkstraFunctors/ExtractPathFromMinimumSpanningTree.cxx [deleted file]
plugins/DijkstraFunctors/ExtractPathFromMinimumSpanningTree.h [deleted file]
plugins/DijkstraFunctors/GaussianModelCost.cxx [deleted file]
plugins/DijkstraFunctors/GaussianModelCost.h [deleted file]
plugins/DijkstraFunctors/InvertCost.cxx [deleted file]
plugins/DijkstraFunctors/InvertCost.h [deleted file]
plugins/DijkstraFunctors/SimpleImageDijkstraCost.cxx [deleted file]
plugins/DijkstraFunctors/SimpleImageDijkstraCost.h [deleted file]
plugins/Experiments/InsertNoiseIntoPoints.cxx [deleted file]
plugins/Experiments/InsertNoiseIntoPoints.h [deleted file]
plugins/Experiments/SkeletonHausdorffDistance.cxx [deleted file]
plugins/Experiments/SkeletonHausdorffDistance.h [deleted file]
plugins/Functors/Functors.i [deleted file]
plugins/Functors/Inverse.cxx [deleted file]
plugins/Functors/Inverse.h [deleted file]
plugins/ImageAlgorithms/BaseFilter.cxx [deleted file]
plugins/ImageAlgorithms/BaseFilter.h [deleted file]
plugins/ImageAlgorithms/Dijkstra.cxx [deleted file]
plugins/ImageAlgorithms/Dijkstra.h [deleted file]
plugins/ImageAlgorithms/ExtractPathFromMinimumSpanningTree.cxx [deleted file]
plugins/ImageAlgorithms/ExtractPathFromMinimumSpanningTree.h [deleted file]
plugins/ImageAlgorithms/FastMarching.cxx [deleted file]
plugins/ImageAlgorithms/FastMarching.h [deleted file]
plugins/ImageAlgorithms/RegionGrow.cxx [deleted file]
plugins/ImageAlgorithms/RegionGrow.h [deleted file]
plugins/ImageFunctors/BinaryThreshold.cxx [deleted file]
plugins/ImageFunctors/BinaryThreshold.h [deleted file]
plugins/ImageFunctors/Tautology.cxx [deleted file]
plugins/ImageFunctors/Tautology.h [deleted file]
plugins/ImageFunctors/VertexCost.cxx [deleted file]
plugins/ImageFunctors/VertexCost.h [deleted file]
plugins/RegionGrowFunctors/BinaryThreshold.cxx [deleted file]
plugins/RegionGrowFunctors/BinaryThreshold.h [deleted file]
plugins/RegionGrowFunctors/RegionGrowFunctors.i [deleted file]

index 4aa96867e0c75bb107a4b87c004ae2857ff73210..b2a6a18e5fb3952074891383ece9abf21f8521a3 100644 (file)
@@ -1,57 +1,82 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
+cmake_minimum_required(VERSION 3.0)
 
 ## ========================
 ## == Project definition ==
 ## ========================
 
-SET(prj_NAME FrontAlgorithms)
-SET(prj_MAJOR_VERSION   0)
-SET(prj_MINOR_VERSION   1)
-SET(prj_RELEASE_VERSION 0)
-SET(_subdirs lib plugins examples)
-SET(_policies CMP0015 CMP0020 CMP0042)
+set(prj_MAJ_VERSION 0)
+set(prj_MIN_VERSION 1)
+set(prj_REL_VERSION 0)
+set(prj_VERSION "${prj_MAJ_VERSION}.${prj_MIN_VERSION}.${prj_REL_VERSION}")
+set(prj_SHORT_VERSION "${prj_MAJ_VERSION}")
+project(fpa VERSION ${prj_VERSION})
 
 ## ==========================
 ## == Some useful policies ==
 ## ==========================
 
-FOREACH(_p ${_policies})
-  IF(POLICY ${_p})
-    CMAKE_POLICY(SET ${_p} NEW)
-  ENDIF(POLICY ${_p})
-ENDFOREACH(_p)
+set(_policies CMP0015 CMP0020 CMP0042 CMP0053)
+foreach(_p ${_policies})
+  if(POLICY ${_p})
+    cmake_policy(SET ${_p} NEW)
+  endif(POLICY ${_p})
+endforeach(_p)
 
-## ===========================
-## == Project configuration ==
-## ===========================
+## ===============================
+## == Some basic configurations ==
+## ===============================
 
-PROJECT(${prj_NAME})
-SET(
-  prj_VERSION
-  "${prj_MAJOR_VERSION}.${prj_MINOR_VERSION}.${prj_RELEASE_VERSION}"
-  )
-SET(prj_SHORT_VERSION "${prj_MAJOR_VERSION}")
-
-## =====================================
-## == Functions, packages and options ==
-## =====================================
-
-INCLUDE(cmake/BaseConfig.cmake)
-OPTION(USE_cpPlugins "Build cpPlugins-based code" OFF)
-IF(USE_cpPlugins)
-  FIND_PACKAGE(cpPlugins)
-  MARK_AS_ADVANCED(CLEAR cpPlugins_DIR)
-ENDIF(USE_cpPlugins)
-INCLUDE(cmake/KitwareTools.cmake)
-INCLUDE(cmake/QtTools.cmake)
-INCLUDE(cmake/Functions.cmake)
+include(cmake/fpaBaseConfig.cmake)
+
+## ==============
+## == Find ITK ==
+## ==============
+
+find_package(ITK CONFIG REQUIRED)
+include(${ITK_USE_FILE})
+
+## =========================
+## == Installation values ==
+## =========================
+
+set(config_install_dir "lib/cmake/${PROJECT_NAME}")
+set(include_install_dir "include")
+set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
+set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
+set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
+set(targets_export_name "${PROJECT_NAME}Targets")
+set(namespace "${PROJECT_NAME}::")
 
 ## ===========================
 ## == Build different parts ==
 ## ===========================
 
-FOREACH(_s ${_subdirs})
-  SUBDIRS(${_s})
-ENDFOREACH(_s)
+subdirs(examples lib)
+
+## ===============================
+## == Global installation rules ==
+## ===============================
+
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+  "${version_config}" COMPATIBILITY SameMajorVersion
+  )
+configure_package_config_file(
+  "cmake/${PROJECT_NAME}Config.cmake.in"
+  "${project_config}"
+  INSTALL_DESTINATION "${config_install_dir}"
+  )
+install(
+  FILES
+  "${project_config}"
+  "${version_config}"
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/fpaBaseConfig.cmake"
+  DESTINATION "${config_install_dir}"
+  )
+#install(
+#  EXPORT "${targets_export_name}"
+#  NAMESPACE "${namespace}"
+#  DESTINATION "${config_install_dir}"
+#  )
 
 ## eof - $RCSfile$
diff --git a/appli/CMakeLists.txt b/appli/CMakeLists.txt
deleted file mode 100644 (file)
index 6380a79..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-OPTION(BUILD_EXAMPLES "Build simple examples" OFF)
-IF(BUILD_EXAMPLES)
-  SUBDIRS(examples)
-ENDIF(BUILD_EXAMPLES)
-
-OPTION(BUILD_EXPERIMENTS "Build experiments" OFF)
-IF(BUILD_EXPERIMENTS)
-  SUBDIRS(experiments)
-ENDIF(BUILD_EXPERIMENTS)
-
-## eof - $RCSfile$
diff --git a/appli/examples/CMakeLists.txt b/appli/examples/CMakeLists.txt
deleted file mode 100644 (file)
index 5d570b6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-ADD_EXECUTABLE(fpa_examples_ImageDijkstra ImageDijkstra.cxx)
-TARGET_LINK_LIBRARIES(fpa_examples_ImageDijkstra ${ITK_LIBRARIES} ${VTK_LIBRARIES})
-
-## eof - $RCSfile$
diff --git a/appli/examples/ImageDijkstra.cxx b/appli/examples/ImageDijkstra.cxx
deleted file mode 100644 (file)
index 2dede62..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <itkImage.h>
-#include <itkRandomImageSource.h>
-#include <itkImageFileWriter.h>
-
-#include <fpa/Image/Functors/SimpleNeighborhood.h>
-#include <fpa/Image/Functors/SimpleDijkstraCost.h>
-#include <fpa/Base/Functors/Inverse.h>
-#include <fpa/Image/Dijkstra.h>
-
-// -------------------------------------------------------------------------
-static const unsigned int VDim = 2;
-typedef float TScalar;
-typedef itk::Image< unsigned char, VDim > TInputImage;
-typedef itk::Image< TScalar, VDim > TOutputImage;
-
-typedef itk::RandomImageSource< TInputImage > TImageSource;
-typedef itk::ImageFileWriter< TOutputImage >  TImageWriter;
-
-typedef fpa::Image::Functors::SimpleNeighborhood< itk::ImageBase< VDim > > TNeighFunction;
-typedef fpa::Image::Functors::SimpleDijkstraCost< TInputImage, TScalar > TCostFunction;
-typedef fpa::Base::Functors::Inverse< TScalar, TScalar > TCostConversionFunction;
-
-typedef fpa::Image::Dijkstra< TInputImage, TOutputImage > TFilter;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  static const unsigned long SIZE = 100;
-  unsigned long size[] = { SIZE, SIZE };
-
-  unsigned int neigh_order = 2;
-  TInputImage::IndexType seed0, seed1;
-
-  seed0.Fill( 0 );
-  seed1.Fill( SIZE - 1 );
-
-  TImageSource::Pointer source = TImageSource::New( );
-  source->SetSize( size );
-  source->SetSpacing( 1 );
-  source->Update( );
-  TInputImage::Pointer input = source->GetOutput( );
-
-  TNeighFunction::Pointer neigh_function = TNeighFunction::New( );
-  neigh_function->SetOrder( neigh_order );
-
-  TCostFunction::Pointer cost_function = TCostFunction::New( );
-
-  TCostConversionFunction::Pointer cost_conversion_function =
-    TCostConversionFunction::New( );
-
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( input );
-  filter->SetNeighborhoodFunction( neigh_function );
-  filter->SetCostFunction( cost_function );
-  filter->SetCostConversionFunction( cost_conversion_function );
-  filter->AddSeed( seed0, 0 );
-  filter->AddSeed( seed1, 0 );
-  filter->StopAtOneFrontOn( );
-  filter->Update( );
-
-  TImageWriter::Pointer writer = TImageWriter::New( );
-  writer->SetInput( filter->GetOutput( ) );
-  writer->SetFileName( "dijkstra.mhd" );
-  writer->Update( );
-
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/appli/experiments/CMakeLists.txt b/appli/experiments/CMakeLists.txt
deleted file mode 100644 (file)
index 65b5df1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-INCLUDE_DIRECTORIES(
-  ${PROJECT_SOURCE_DIR}/lib
-  ${PROJECT_BINARY_DIR}/lib
-  )
-ADD_EXECUTABLE(fpa_experiments_Skeleton_00 Skeleton_00.cxx)
-TARGET_LINK_LIBRARIES(fpa_experiments_Skeleton_00 ${ITK_LIBRARIES} ${VTK_LIBRARIES})
-
-ADD_EXECUTABLE(fpa_experiments_Hausdorff Hausdorff.cxx)
-TARGET_LINK_LIBRARIES(fpa_experiments_Hausdorff ${ITK_LIBRARIES} ${VTK_LIBRARIES})
-
-## eof - $RCSfile$
diff --git a/appli/experiments/Hausdorff.cxx b/appli/experiments/Hausdorff.cxx
deleted file mode 100644 (file)
index dce01ef..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <itkImage.h>
-#include <itkImageFileReader.h>
-#include <itkHausdorffDistanceImageFilter.h>
-
-typedef double TScalar;
-typedef itk::Image< TScalar, 3 > TImage;
-typedef itk::ImageFileReader< TImage > TReader;
-typedef itk::HausdorffDistanceImageFilter< TImage, TImage > THausdorff;
-
-int main( int argc, char* argv[] )
-{
-  if( argc < 3 )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " image1 image2"
-      << std::endl;
-    return( 1 );
-
-  } // fi
-  std::string image1_name = argv[ 1 ];
-  std::string image2_name = argv[ 2 ];
-
-  TReader::Pointer reader1 = TReader::New( );
-  reader1->SetFileName( image1_name );
-  reader1->Update( );
-
-  TReader::Pointer reader2 = TReader::New( );
-  reader2->SetFileName( image2_name );
-  reader2->Update( );
-
-  THausdorff::Pointer hausdorff = THausdorff::New( );
-  hausdorff->SetInput1( reader1->GetOutput( ) );
-  hausdorff->SetInput2( reader2->GetOutput( ) );
-  hausdorff->SetUseImageSpacing( true );
-  hausdorff->Update( );
-
-  std::cout
-    << image1_name << " "
-    << image2_name << " "
-    << hausdorff->GetHausdorffDistance( ) << " "
-    << hausdorff->GetAverageHausdorffDistance( )
-    << std::endl;
-
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/appli/experiments/Skeleton_00.cxx b/appli/experiments/Skeleton_00.cxx
deleted file mode 100644 (file)
index 11b49f2..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#include <itkImage.h>
-#include <itkMinimumMaximumImageCalculator.h>
-#include <itkSignedMaurerDistanceMapImageFilter.h>
-#include <itkImageFileReader.h>
-#include <itkImageFileWriter.h>
-#include <fpa/Image/SkeletonFilter.h>
-#include <cpExtensions/Algorithms/SkeletonToImageFilter.h>
-
-typedef double TScalar;
-typedef itk::Image< TScalar, 3 > TImage;
-typedef itk::MinimumMaximumImageCalculator< TImage > TMinMax;
-typedef itk::SignedMaurerDistanceMapImageFilter< TImage, TImage > TDMap;
-typedef fpa::Image::SkeletonFilter< TImage > TSkeletonFilter;
-typedef TSkeletonFilter::TSkeleton TSkeleton;
-typedef cpExtensions::Algorithms::SkeletonToImageFilter< TSkeleton, TImage > TSkeletonToImage;
-typedef itk::ImageFileReader< TImage > TReader;
-typedef itk::ImageFileWriter< TImage > TWriter;
-
-int main( int argc, char* argv[] )
-{
-  if( argc < 4 )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " image prefix number_of_samples [seed_x seed_y seed_z]"
-      << std::endl;
-    return( 1 );
-
-  } // fi
-  std::string image_name = argv[ 1 ];
-
-  TReader::Pointer reader = TReader::New( );
-  reader->SetFileName( image_name );
-  reader->Update( );
-
-  TDMap::Pointer dmap = TDMap::New( );
-  dmap->SetInput( reader->GetOutput( ) );
-  dmap->InsideIsPositiveOn( );
-  dmap->Update( );
-  const TImage* image = dmap->GetOutput( );
-
-  std::string prefix = argv[ 2 ];
-  std::istringstream str( argv[ 3 ] );
-  unsigned int number_of_samples;
-  str >> number_of_samples;
-  TImage::IndexType seed;
-  if( argc < 7 )
-  {
-    TMinMax::Pointer minmax = TMinMax::New( );
-    minmax->SetImage( image );
-    minmax->Compute( );
-    seed = minmax->GetIndexOfMaximum( );
-  }
-  else
-  {
-    std::istringstream str_x( argv[ 4 ] );
-    std::istringstream str_y( argv[ 5 ] );
-    std::istringstream str_z( argv[ 6 ] );
-    TImage::PointType pnt;
-    str_x >> pnt[ 0 ];
-    str_y >> pnt[ 1 ];
-    str_z >> pnt[ 2 ];
-    image->TransformPhysicalPointToIndex( pnt, seed );
-
-  } // fi
-
-  for( unsigned int i = 0; i < number_of_samples; ++i )
-  {
-    std::cout << i << std::endl;
-    TSkeletonFilter::Pointer skeleton = TSkeletonFilter::New( );
-    skeleton->SetInput( image );
-    skeleton->AddSeed( seed, 0 );
-    skeleton->Update( );
-
-    TSkeletonToImage::Pointer sk2im = TSkeletonToImage::New( );
-    sk2im->SetTemplateImage( image );
-    sk2im->SetSkeleton( skeleton->GetSkeleton( ) );
-    sk2im->SetOutsideValue( 0 );
-    sk2im->SetInsideValue( 1 );
-    sk2im->Update( );
-
-    TWriter::Pointer writer = TWriter::New( );
-    writer->SetInput( sk2im->GetOutput( ) );
-    writer->SetFileName( "skeleton.mhd" );
-    writer->Update( );
-
-  } // rof
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
deleted file mode 100644 (file)
index 5d4261d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-## =====================
-## == Configure files ==
-## =====================
-
-CONFIGURE_FILE(
-  FrontAlgorithmsConfig.cmake.in
-  ${PROJECT_BINARY_DIR}/FrontAlgorithmsConfig.cmake
-  @ONLY
-  )
-
-## eof - $RCSfile$
diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake
deleted file mode 100644 (file)
index d755587..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-## -------------------------------------------------------------------------
-FUNCTION(NormPaths output_files)
-SET(_out)
-FOREACH(_f ${ARGN})
-  SET(_d)
-  FILE(TO_CMAKE_PATH ${_f} _d)
-  LIST(APPEND _out ${_d})
-ENDFOREACH(_f)
-SET(${output_files} "${_out}" PARENT_SCOPE)
-ENDFUNCTION()
-
-## -------------------------------------------------------------------------
-FUNCTION(Wrap_Qt_CPP output_files)
-SET(_out)
-FOREACH(_f ${ARGN})
-  IF(EXISTS ${_f})
-    FILE(READ ${_f} _txt)
-    STRING(FIND "${_txt}" "Q_OBJECT" _pos)
-    IF(NOT ${_pos} EQUAL -1)
-      SET(_s)
-      QT4_WRAP_CPP(_s ${_f})
-      SET(_out ${_out} ${_s})
-    ENDIF(NOT ${_pos} EQUAL -1)
-  ENDIF(EXISTS ${_f})
-ENDFOREACH(_f)
-SET(${output_files} "${_out}" PARENT_SCOPE)
-ENDFUNCTION()
-
-## -------------------------------------------------------------------------
-FUNCTION(Wrap_Qt_UI output_files)
-NormPaths(_source_dir ${PROJECT_SOURCE_DIR})
-NormPaths(_binary_dir ${PROJECT_BINARY_DIR})
-SET(_out)
-FOREACH(_f ${ARGN})
-  IF(EXISTS ${_f})
-    GET_FILENAME_COMPONENT(_name ${_f} NAME_WE)
-    GET_FILENAME_COMPONENT(_dir ${_f} DIRECTORY)
-    SET(_base_dir ${_source_dir})
-    STRING(FIND "${_dir}" "${_base_dir}" _pos)
-    IF(${_pos} EQUAL -1)
-      SET(_base_dir ${_binary_dir})
-      STRING(FIND "${_dir}" "${_base_dir}" _pos)
-    ENDIF(${_pos} EQUAL -1)
-    IF(NOT ${_pos} EQUAL -1)
-      STRING(REPLACE "${_base_dir}/" "" _dir ${_dir})
-      SET(_out_f ${_binary_dir}/${_dir}/ui_${_name}.h)
-      LIST(APPEND _out ${_out_f})
-      ADD_CUSTOM_COMMAND(
-        OUTPUT ${_out_f}
-        COMMAND Qt4::uic
-        ARGS -o ${_out_f} ${_f}
-        MAIN_DEPENDENCY ${_f} VERBATIM
-        )
-    ENDIF(NOT ${_pos} EQUAL -1)
-  ENDIF(EXISTS ${_f})
-ENDFOREACH(_f)
-SET(${output_files} "${_out}" PARENT_SCOPE)
-ENDFUNCTION()
-
-## -------------------------------------------------------------------------
-FUNCTION(
-  PrepareSourceFiles
-  lib_name
-  out_sources_list
-  out_headers_list
-  out_headers_paths
-  )
-SET(_config_extensions .c.in .cpp.in .cxx.in .h.in .hpp.in .hxx.in .ui.in)
-SET(_sources_extensions .c .cpp .cxx)
-SET(_headers_extensions .h .hpp .hxx)
-SET(_qt_ui_extensions .ui)
-SET(_demangler_extensions .d)
-SET(_instances_extensions .i)
-
-## -- Configure inputs
-SET(_all_files)
-FOREACH(_file ${ARGN})
-  GET_FILENAME_COMPONENT(_ext ${_file} EXT)
-  LIST(FIND _config_extensions ${_ext} _cfg)
-  IF(NOT ${_cfg} EQUAL -1)
-    STRING(
-      REPLACE
-      ${PROJECT_SOURCE_DIR}
-      ${PROJECT_BINARY_DIR}
-      _file_bin
-      ${_file}
-      )
-    STRING(LENGTH ${_file_bin} _file_bin_len)
-    MATH(EXPR _file_bin_len "${_file_bin_len}-3")
-    STRING(SUBSTRING ${_file_bin} 0 ${_file_bin_len} _file_bin)
-    CONFIGURE_FILE(${_file} ${_file_bin} @ONLY)
-    LIST(APPEND _all_files ${_file_bin})
-  ELSE(NOT ${_cfg} EQUAL -1)
-    LIST(APPEND _all_files ${_file})
-  ENDIF(NOT ${_cfg} EQUAL -1)
-ENDFOREACH(_file)
-
-## -- Separate files
-SET(_srcs)
-SET(_hdrs)
-SET(_qts)
-SET(_demanglers)
-SET(_instances)
-FOREACH(_file ${_all_files})
-  GET_FILENAME_COMPONENT(_ext ${_file} EXT)
-  LIST(FIND _sources_extensions ${_ext} _src)
-  LIST(FIND _headers_extensions ${_ext} _hdr)
-  LIST(FIND _qt_ui_extensions ${_ext} _ui)
-  LIST(FIND _demangler_extensions ${_ext} _dem)
-  LIST(FIND _instances_extensions ${_ext} _ins)
-  IF(NOT ${_src} EQUAL -1)
-    LIST(APPEND _srcs ${_file})
-  ENDIF(NOT ${_src} EQUAL -1)
-  IF(NOT ${_hdr} EQUAL -1)
-    LIST(APPEND _hdrs ${_file})
-  ENDIF(NOT ${_hdr} EQUAL -1)
-  IF(NOT ${_ui} EQUAL -1)
-    LIST(APPEND _qts ${_file})
-  ENDIF(NOT ${_ui} EQUAL -1)
-  IF(NOT ${_dem} EQUAL -1)
-    LIST(APPEND _demanglers ${_file})
-  ENDIF(NOT ${_dem} EQUAL -1)
-  IF(NOT ${_ins} EQUAL -1)
-    LIST(APPEND _instances ${_file})
-  ENDIF(NOT ${_ins} EQUAL -1)
-ENDFOREACH(_file)
-
-# -- Prepare Qt4-based code
-IF(Qt4_FOUND)
-  ## -- Guess what headers sould be qt-moc'ed
-  Wrap_Qt_CPP(_moc ${_hdrs})
-  IF(_moc)
-    LIST(APPEND _srcs ${_moc})
-  ENDIF(_moc)
-
-  ## -- Guess what qt-ui's sould be qt-uic'ed
-  ## -- Wrap qt-ui headers: this is equivalent to QT4_WRAP_UI except to change
-  ## -- the output file
-  Wrap_Qt_UI(_qt_hdrs ${_qts})
-  IF(_qt_hdrs)
-    LIST(APPEND _hdrs ${_qt_hdrs})
-  ENDIF(_qt_hdrs)
-ENDIF(Qt4_FOUND)
-
-## -- Create demanglers
-FOREACH(_d ${_demanglers})
-  STRING(
-    REPLACE
-    ${PROJECT_SOURCE_DIR}
-    ${PROJECT_BINARY_DIR}
-    _d_bin
-    ${_d}
-    )
-  GET_FILENAME_COMPONENT(_d_path ${_d_bin} DIRECTORY)
-  GET_FILENAME_COMPONENT(_out_name ${_d_bin} NAME_WE)
-  SET(_d_out ${_d_path}/${_out_name}_Demanglers.h)
-  ADD_CUSTOM_COMMAND(
-    OUTPUT ${_d_out}
-    COMMAND ${CMAKE_COMMAND} -E make_directory ${_d_path}
-    COMMAND ${cpPlugins_bash_CreateDemanglers_APP} ${_d} ${_out_name} ${_d_out}
-    DEPENDS ${cpPlugins_bash_CreateDemanglers_APP} ${_d}
-    )
-  LIST(APPEND _hdrs ${_d_out})
-ENDFOREACH(_d)
-
-## -- Create instances
-FOREACH(_i ${_instances})
-  STRING(
-    REPLACE
-    ${PROJECT_SOURCE_DIR}
-    ${PROJECT_BINARY_DIR}
-    _i_bin
-    ${_i}
-    )
-  GET_FILENAME_COMPONENT(_i_path ${_i_bin} DIRECTORY)
-  GET_FILENAME_COMPONENT(_out_name ${_i} NAME_WE)
-
-  ## -- Infere source code filenames
-  MATH(EXPR _last_range "${cpPlugins_NUMBER_OF_FILES}-1")
-  SET(_out_code)
-  FOREACH(_n RANGE 0 ${_last_range})
-    LIST(APPEND _out_code ${_i_path}/${_out_name}_${_n}.cxx)
-    LIST(APPEND _srcs ${_i_path}/${_out_name}_${_n}.cxx)
-  ENDFOREACH(_n)
-
-  ## -- Command to write source code
-  ADD_CUSTOM_COMMAND(
-    OUTPUT ${_out_code}
-    DEPENDS ${cpPlugins_bash_CreateInstances_APP} ${_i}
-    COMMAND ${CMAKE_COMMAND} -E make_directory ${_i_path}
-    COMMAND ${cpPlugins_bash_CreateInstances_APP} ${_i} ${lib_name} ${_i_path}/${_out_name}
-    )
-ENDFOREACH(_i)
-
-## -- Real compilation
-SET(_hdrs_paths)
-FOREACH(_hdr ${_hdrs})
-  GET_FILENAME_COMPONENT(_path ${_hdr} DIRECTORY)
-  LIST(FIND _hdrs_paths ${_path} _path_idx)
-  IF(${_path_idx} EQUAL -1)
-    LIST(APPEND _hdrs_paths ${_path})
-  ENDIF(${_path_idx} EQUAL -1)
-ENDFOREACH(_hdr)
-
-SET(${out_sources_list} ${_srcs} PARENT_SCOPE)
-SET(${out_headers_list} ${_hdrs} PARENT_SCOPE)
-SET(${out_headers_paths} ${_hdrs_paths} PARENT_SCOPE)
-
-ENDFUNCTION()
-
-## -------------------------------------------------------------------------
-FUNCTION(cpPlugins_BuildLibrary lib_name lib_type)
-# -- Detect all source files
-SET(_all_files)
-FOREACH(_c ${ARGN})
-  GET_FILENAME_COMPONENT(_cname ${_c} ABSOLUTE)
-  SET(_files)
-  IF(IS_DIRECTORY ${_cname})
-    FILE(GLOB_RECURSE _files "${_cname}/*")
-  ELSE(IS_DIRECTORY ${_cname})
-    SET(_files ${_cname})
-  ENDIF(IS_DIRECTORY ${_cname})
-  LIST(APPEND _all_files ${_files})
-ENDFOREACH(_c ${ARGN})
-
-## -- Prepare sources by types
-PrepareSourceFiles(${lib_name} _srcs _hdrs _paths ${_all_files})
-
-## -- Build library
-IF(_srcs)
-  INCLUDE_DIRECTORIES(
-    ${CMAKE_CURRENT_SOURCE_DIR}
-    ${CMAKE_CURRENT_BINARY_DIR}
-    )
-  ADD_LIBRARY(${lib_name} ${lib_type} ${_srcs} ${_hdrs})
-  GENERATE_EXPORT_HEADER(
-    ${lib_name}
-    BASE_NAME ${lib_name}
-    EXPORT_MACRO_NAME ${lib_name}_EXPORT
-    EXPORT_FILE_NAME ${lib_name}_Export.h
-    STATIC_DEFINE ${lib_name}_BUILT_AS_STATIC
-    )
-ENDIF(_srcs)
-
-ENDFUNCTION()
-
-## -------------------------------------------------------------------------
-FUNCTION(cpPlugins_BuildPluginsLibrary lib_name)
-# -- Detect all source files
-SET(_all_files)
-FOREACH(_c ${ARGN})
-  GET_FILENAME_COMPONENT(_cname ${_c} ABSOLUTE)
-  SET(_files)
-  IF(IS_DIRECTORY ${_cname})
-    FILE(GLOB_RECURSE _files "${_cname}/*")
-  ELSE(IS_DIRECTORY ${_cname})
-    SET(_files ${_cname})
-  ENDIF(IS_DIRECTORY ${_cname})
-  LIST(APPEND _all_files ${_files})
-ENDFOREACH(_c ${ARGN})
-
-## -- Prepare sources by types
-PrepareSourceFiles(${lib_name} _srcs _hdrs _paths ${_all_files})
-
-## -- Check which headers need to be wrapped to build host code
-SET(_hdrs_to_wrap)
-FOREACH(_hdr ${_hdrs})
-  IF(EXISTS ${_hdr})
-    FILE(READ ${_hdr} _txt)
-    STRING(FIND "${_txt}" "cpPluginsObject" _res)
-    IF(NOT ${_res} EQUAL -1)
-      LIST(APPEND _hdrs_to_wrap ${_hdr})
-    ENDIF(NOT ${_res} EQUAL -1)
-  ENDIF(EXISTS ${_hdr})
-ENDFOREACH(_hdr)
-
-## -- Wrap headers
-IF(_hdrs_to_wrap)
-  SET(_host ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_host.cxx)
-  ADD_CUSTOM_COMMAND(
-    OUTPUT ${_host}
-    DEPENDS ${cpPlugins_bash_HostCreator_APP} ${_hdrs_to_wrap}
-    COMMAND ${cpPlugins_bash_HostCreator_APP} ${lib_name} ${_host} ${_hdrs_to_wrap}
-    )
-  LIST(APPEND _all_files ${_host})
-ENDIF(_hdrs_to_wrap)
-
-cpPlugins_BuildLibrary(${lib_name} SHARED ${_all_files})
-ENDFUNCTION()
-
-## -------------------------------------------------------------------------
-FUNCTION(cpPlugins_BuildApplication app_name)
-OPTION(BUILD_${app_name} "Build \"${app_name}\" application?" OFF)
-IF(BUILD_${app_name})
-  # -- Detect all source files
-  SET(_all_files)
-  FOREACH(_c ${ARGN})
-    GET_FILENAME_COMPONENT(_cname ${_c} ABSOLUTE)
-    SET(_files)
-    IF(IS_DIRECTORY ${_cname})
-      FILE(GLOB_RECURSE _files "${_cname}/*")
-    ELSE(IS_DIRECTORY ${_cname})
-      SET(_files ${_cname})
-    ENDIF(IS_DIRECTORY ${_cname})
-    LIST(APPEND _all_files ${_files})
-  ENDFOREACH(_c ${ARGN})
-
-  ## -- Prepare sources by types
-  PrepareSourceFiles(${app_name} _srcs _hdrs _paths ${_all_files})
-
-  ## -- Build library
-  IF(_srcs)
-    INCLUDE_DIRECTORIES(
-      ${CMAKE_CURRENT_SOURCE_DIR}
-      ${CMAKE_CURRENT_BINARY_DIR}
-      )
-    SET(_app_os_target)
-    IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-      SET(_app_os_target WIN32)
-      ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
-      SET(_app_os_target MACOSX_BUNDLE)
-    ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-    ADD_EXECUTABLE(${app_name} ${_app_os_target} ${_srcs} ${_hdrs})
-  ENDIF(_srcs)
-ENDIF(BUILD_${app_name})
-ENDFUNCTION()
-
-## eof - $RCSfile$
diff --git a/cmake/KitwareTools.cmake b/cmake/KitwareTools.cmake
deleted file mode 100644 (file)
index b4493d2..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# ======================
-# == Find ITK and VTK ==
-# ======================
-
-FIND_PACKAGE(ITK REQUIRED)
-FIND_PACKAGE(VTK REQUIRED)
-
-INCLUDE(${ITK_USE_FILE})
-INCLUDE(${VTK_USE_FILE})
-
-# ===================================================
-# == Do not use itk-vtk glue --> problems ahead!!! ==
-# ===================================================
-
-IF(ITKVtkGlue_LOADED)
-  MESSAGE(FATAL_ERROR "ITKVtkGlue module is available. Please re-compile your ITK without it. It could lead to nasty compilation problems... Just waiting for Kitware to solve it.")
-ENDIF(ITKVtkGlue_LOADED)
-
-## eof - $RCSfile$
diff --git a/cmake/QtTools.cmake b/cmake/QtTools.cmake
deleted file mode 100644 (file)
index f4dd0cd..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-## ==================================================
-## == Find Qt4 and check if it was well configured ==
-## ==================================================
-
-IF(BUILD_QT4_COMPONENTS)
-  FIND_PACKAGE(Qt4 REQUIRED)
-  INCLUDE(${QT_USE_FILE})
-  SET(
-    _modules
-    vtkGUISupportQt
-    )
-  FOREACH(_m ${_modules})
-    IF(NOT ${_m}_LOADED)
-      MESSAGE(FATAL_ERROR "${_m} module is required but not available.")
-      BREAK()
-    ENDIF(NOT ${_m}_LOADED)
-  ENDFOREACH(_m)
-  SET(
-    cpPlugins_Qt4_VTKWidget
-    QVTKWidget
-    CACHE STRING "Base Qt4-based vtkRenderWindow"
-    )
-  MARK_AS_ADVANCED(CLEAR cpPlugins_Qt4_VTKWidget)
-ENDIF(BUILD_QT4_COMPONENTS)
-
-## eof - $RCSfile$
similarity index 56%
rename from cmake/BaseConfig.cmake
rename to cmake/fpaBaseConfig.cmake
index d177604781fdd748042fb7dffe15eeef77b7a537..3fdc8ab5569efd9b133906e7d6ccb12c54c7d51a 100644 (file)
@@ -4,45 +4,45 @@
 ## ==       c++11, so it only need to be tested on other OS.            ==
 ## =======================================================================
 
-IF(NOT MSVC)
-  INCLUDE(CheckCXXCompilerFlag)
-  CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
-  IF(COMPILER_SUPPORTS_CXX11)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-  ELSE(COMPILER_SUPPORTS_CXX11)
-    CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
-    IF(COMPILER_SUPPORTS_CXX0X)
-      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-    ELSE(COMPILER_SUPPORTS_CXX0X)
-      MESSAGE(
+if(NOT MSVC)
+  include(CheckCXXCompilerFlag)
+  check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11)
+  if(COMPILER_SUPPORTS_CXX11)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+  else(COMPILER_SUPPORTS_CXX11)
+    check_cxx_compiler_flag("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
+    if(COMPILER_SUPPORTS_CXX0X)
+      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+    else(COMPILER_SUPPORTS_CXX0X)
+      message(
         FATAL_ERROR
         "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support."
         )
-    ENDIF(COMPILER_SUPPORTS_CXX0X)
-  ENDIF(COMPILER_SUPPORTS_CXX11)
-ENDIF(NOT MSVC)
+    endif(COMPILER_SUPPORTS_CXX0X)
+  endif(COMPILER_SUPPORTS_CXX11)
+endif(NOT MSVC)
 
 ## ===================================================
 ## == Prepare header generator to build shared libs ==
 ## ===================================================
 
-INCLUDE(GenerateExportHeader)
+include(GenerateExportHeader)
 
 ## ==================================================
 ## == 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})
+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})
 
 ## =================================================
 ## == Where to put targets (executables and libs) ==
 ## =================================================
 
-SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
-SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
-MARK_AS_ADVANCED(
+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
diff --git a/cmake/fpaConfig.cmake.in b/cmake/fpaConfig.cmake.in
new file mode 100644 (file)
index 0000000..635eea3
--- /dev/null
@@ -0,0 +1,16 @@
+@PACKAGE_INIT@
+
+include("${CMAKE_CURRENT_LIST_DIR}/fpaBaseConfig.cmake")
+## include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
+check_required_components("@PROJECT_NAME@")
+
+## ==============
+## == Find ITK ==
+## ==============
+
+set(ITK_DIR @ITK_DIR@)
+
+find_package(ITK CONFIG REQUIRED)
+include(${ITK_USE_FILE})
+
+## eof - $RCSfile$
diff --git a/data/input_mori_binary.png b/data/input_mori_binary.png
new file mode 100644 (file)
index 0000000..d605247
Binary files /dev/null and b/data/input_mori_binary.png differ
diff --git a/data/ones_image.png b/data/ones_image.png
deleted file mode 100644 (file)
index f7afaab..0000000
Binary files a/data/ones_image.png and /dev/null differ
diff --git a/data/test_mori_2D.png b/data/test_mori_2D.png
deleted file mode 100644 (file)
index 943e9f0..0000000
Binary files a/data/test_mori_2D.png and /dev/null differ
diff --git a/data/test_skeleton_2D.png b/data/test_skeleton_2D.png
deleted file mode 100644 (file)
index 17feca4..0000000
Binary files a/data/test_skeleton_2D.png and /dev/null differ
diff --git a/data/workspaces/workspace_airwaysappli.wxml b/data/workspaces/workspace_airwaysappli.wxml
deleted file mode 100644 (file)
index 9b80164..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<cpPlugins_Workspace>
-    <filter category="ImageFilters" class="CastImageFilter" name="cast" ViewX="-1098" ViewY="-242">
-        <parameter name="CastType" value="char#short#int#long#uchar#ushort#uint#ulong#float#double@double" type="Choices"/>
-    </filter>
-    <filter category="fpaImageAlgorithmFunctors" class="InvertCostFunction" name="cost" ViewX="-951" ViewY="-428">
-        <parameter name="Alpha" value="1" type="Real"/>
-        <parameter name="Beta" value="1" type="Real"/>
-        <parameter name="ScalarType" value="float#double@float" type="Choices"/>
-    </filter>
-    <filter category="fpaImageAlgorithm" class="ImageDijkstra" name="dijkstra" ViewX="-735" ViewY="-176">
-        <parameter name="FillNodeQueue" value="1" type="Bool"/>
-        <parameter name="NeighborhoodOrder" value="1#2@1" type="Choices"/>
-        <parameter name="StopAtOneFront" value="0" type="Bool"/>
-        <parameter name="VisualDebug" value="1" type="Bool"/>
-    </filter>
-    <filter category="ImageFilters" class="SignedMaurerDistanceMapImageFilter" name="dmap" ViewX="-1093" ViewY="-379">
-        <parameter name="BackgroundValue" value="0" type="Real"/>
-        <parameter name="InsideIsPositive" value="1" type="Bool"/>
-        <parameter name="OutputResolution" value="float#double@float" type="Choices"/>
-        <parameter name="SquaredDistance" value="0" type="Bool"/>
-        <parameter name="UseImageSpacing" value="1" type="Bool"/>
-    </filter>
-    <filter category="fpaImageAlgorithm" class="ExtractEndPointsAndBifurcationsFromMinimumSpanningTree" name="eb" ViewX="-491" ViewY="-267">
-        <parameter name="SquaredDistanceMap" value="0" type="Bool"/>
-    </filter>
-    <filter category="IO" class="ImageReader" name="reader" ViewX="-1366" ViewY="-264">
-        <parameter name="FileNames" value="" type="OpenFileNameList"/>
-    </filter>
-    <filter category="Widgets" class="NoInteractiveSeedWidget" name="seed" ViewX="-1116" ViewY="-124">
-        <parameter name="Text" value="" type="String"/>
-    </filter>
-    <connection>
-        <origin filter="cost" name="Output"/>
-        <destination filter="dijkstra" name="CostFunctor"/>
-    </connection>
-    <connection>
-        <origin filter="dijkstra" name="Output"/>
-        <destination filter="eb" name="CostsImage"/>
-    </connection>
-    <connection>
-        <origin filter="dijkstra" name="MST"/>
-        <destination filter="eb" name="MST"/>
-    </connection>
-    <connection>
-        <origin filter="dmap" name="Output"/>
-        <destination filter="dijkstra" name="Input"/>
-    </connection>
-    <connection>
-        <origin filter="dmap" name="Output"/>
-        <destination filter="eb" name="DistanceMap"/>
-    </connection>
-    <connection>
-        <origin filter="reader" name="Output"/>
-        <destination filter="cast" name="Input"/>
-    </connection>
-    <connection>
-        <origin filter="reader" name="Output"/>
-        <destination filter="dmap" name="Input"/>
-    </connection>
-    <connection>
-        <origin filter="reader" name="Output"/>
-        <destination filter="seed" name="ReferenceImage"/>
-    </connection>
-    <connection>
-        <origin filter="seed" name="Output"/>
-        <destination filter="dijkstra" name="Seeds"/>
-    </connection>
-    <exposed_output_port port_name="bifurcations" filter="eb" filter_port_name="Bifurcations"/>
-    <exposed_output_port port_name="endpoints" filter="eb" filter_port_name="EndPoints"/>
-    <exposed_output_port port_name="input_image_casted" filter="CastImageFilter" filter_port_name="Output"/>
-    <exposed_output_port port_name="input_image_dmap" filter="dmap" filter_port_name="Output"/>
-    <exposed_output_port port_name="skeleton" filter="eb" filter_port_name="Skeleton"/>
-</cpPlugins_Workspace>
diff --git a/examples/BronchiiInitialSegmentationWithBinaryThresholdRegionGrow.cxx b/examples/BronchiiInitialSegmentationWithBinaryThresholdRegionGrow.cxx
new file mode 100644 (file)
index 0000000..8381cff
--- /dev/null
@@ -0,0 +1,116 @@
+#include <climits>
+#include <cstdlib>
+#include <fstream>
+#include <iostream>
+#include <string>
+
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkImageFileWriter.h>
+
+#include <fpa/Image/RegionGrow.h>
+#include <fpa/Image/Functors/RegionGrow/BinaryThreshold.h>
+
+// -------------------------------------------------------------------------
+static const unsigned int Dim = 3;
+typedef short TPixel;
+typedef itk::Image< TPixel, Dim > TImage;
+
+// -------------------------------------------------------------------------
+std::string GetFullPath( const std::string& filename )
+{
+  /* On windows:
+     #include <windows.h>
+     TCHAR full_path[MAX_PATH];
+     GetFullPathName(_T("foo.dat"), MAX_PATH, full_path, NULL);
+  */
+
+  char* buffer = realpath( filename.c_str( ), NULL );
+  std::string path = buffer;
+  std::free( buffer );
+  return( path );
+}
+
+// -------------------------------------------------------------------------
+std::string GetFullPathToDirectory( const std::string& filename )
+{
+  std::string path = GetFullPath( filename );
+  std::size_t found = path.find_last_of( "/\\" );
+  return( path.substr( 0, found + 1 ) );
+}
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Command configuration
+  if( argc < 5 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ] << " input_image output_image lower upper"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = GetFullPath( argv[ 1 ] );
+  std::string output_image_filename = argv[ 2 ];
+  std::string output_auxiliary_image_filename = output_image_filename + "_aux.mhd";
+  TPixel lower = std::atoi( argv[ 3 ] );
+  TPixel upper = std::atoi( argv[ 4 ] );
+
+  // Try to guess initial seed
+  std::string seed_filename = GetFullPathToDirectory( argv[ 1 ] ) + "seed.txt";
+  std::ifstream seed_str( seed_filename.c_str( ) );
+  if( !seed_str )
+  {
+    std::cerr
+      << "No \"seed.txt\" file in the same input image directory."
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  TImage::IndexType seed;
+  seed_str >> seed[ 0 ] >> seed[ 1 ] >> seed[ 2 ];
+  seed_str.close( );
+
+  // Read image
+  typedef itk::ImageFileReader< TImage > TReader;
+  TReader::Pointer reader = TReader::New( );
+  reader->SetFileName( input_image_filename );
+
+  // Growing predicate
+  typedef fpa::Image::Functors::RegionGrow::BinaryThreshold< TImage, TImage::PixelType > TPredicate;
+  TPredicate::Pointer predicate = TPredicate::New( );
+  predicate->SetLower( lower );
+  predicate->SetUpper( upper );
+
+  // RegionGrow algorithm
+  typedef fpa::Image::RegionGrow< TImage, TImage > TFilter;
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( reader->GetOutput( ) );
+  filter->AddSeed( seed, 1 );
+  filter->SetInsideValue( 1 );
+  filter->SetOutsideValue( 0 );
+  filter->SetGrowFunction( predicate );
+
+  // Write results
+  typedef itk::ImageFileWriter< TImage > TWriter;
+  TWriter::Pointer writer = TWriter::New( );
+  writer->SetInput( filter->GetOutput( ) );
+  writer->SetFileName( output_image_filename );
+
+  // Execute pipeline
+  try
+  {
+    writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/examples/BronchiiInitialSegmentationWithMori.cxx b/examples/BronchiiInitialSegmentationWithMori.cxx
new file mode 100644 (file)
index 0000000..fa940d5
--- /dev/null
@@ -0,0 +1,157 @@
+#include <climits>
+#include <cstdlib>
+#include <fstream>
+#include <iostream>
+#include <string>
+
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkImageFileWriter.h>
+
+#include <fpa/Image/MoriFilter.h>
+
+// -------------------------------------------------------------------------
+static const unsigned int Dim = 3;
+typedef short TPixel;
+typedef itk::Image< TPixel, Dim > TImage;
+
+// -------------------------------------------------------------------------
+std::string GetFullPath( const std::string& filename )
+{
+  /* On windows:
+     #include <windows.h>
+     TCHAR full_path[MAX_PATH];
+     GetFullPathName(_T("foo.dat"), MAX_PATH, full_path, NULL);
+  */
+
+  char* buffer = realpath( filename.c_str( ), NULL );
+  std::string path = buffer;
+  std::free( buffer );
+  return( path );
+}
+
+// -------------------------------------------------------------------------
+std::string GetFullPathToDirectory( const std::string& filename )
+{
+  std::string path = GetFullPath( filename );
+  std::size_t found = path.find_last_of( "/\\" );
+  return( path.substr( 0, found + 1 ) );
+}
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Command configuration
+  if( argc < 3 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ] << " input_image output_image"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = GetFullPath( argv[ 1 ] );
+  std::string output_image_filename = argv[ 2 ];
+  std::string output_auxiliary_image_filename = output_image_filename + "_aux.mhd";
+
+  // Try to guess initial seed
+  std::string seed_filename = GetFullPathToDirectory( argv[ 1 ] ) + "seed.txt";
+  std::ifstream seed_str( seed_filename.c_str( ) );
+  if( !seed_str )
+  {
+    std::cerr
+      << "No \"seed.txt\" file in the same input image directory."
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  TImage::IndexType seed;
+  seed_str >> seed[ 0 ] >> seed[ 1 ] >> seed[ 2 ];
+  seed_str.close( );
+
+  // Read image
+  typedef itk::ImageFileReader< TImage > TReader;
+  TReader::Pointer reader = TReader::New( );
+  reader->SetFileName( input_image_filename );
+
+  // Mori's algorithms
+  typedef fpa::Image::MoriFilter< TImage, TImage > TFilter;
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( reader->GetOutput( ) );
+  filter->SetSeed( seed );
+  filter->SetThresholdRange( -200, 100, 1 );
+  filter->SetInsideValue( 1 );
+  filter->SetOutsideValue( 0 );
+
+  // Write results
+  typedef itk::ImageFileWriter< TImage > TWriter;
+  TWriter::Pointer writer = TWriter::New( );
+  writer->SetInput( filter->GetOutput( ) );
+  writer->SetFileName( output_image_filename );
+
+  // Execute pipeline
+  try
+  {
+    writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  // Write auxiliary image
+  typedef itk::ImageFileWriter< TFilter::TAuxImage > TAuxWriter;
+  TAuxWriter::Pointer aux_writer = TAuxWriter::New( );
+  aux_writer->SetInput( filter->GetAuxiliaryImage( ) );
+  aux_writer->SetFileName( output_auxiliary_image_filename );
+
+  // Execute pipeline
+  try
+  {
+    aux_writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  // Write result signal
+  std::string output_signal_filename = output_image_filename + ".csv";
+  std::ofstream output_signal_str( output_signal_filename.c_str( ) );
+  TFilter::TCurve curve = filter->GetCurve( );
+  unsigned long max_count = 0;
+  for( TFilter::TCurve::value_type d : curve )
+  {
+    output_signal_str << d.first << " " << d.second << std::endl;
+    if( max_count < d.second )
+      max_count = d.second;
+
+  } // rof
+  output_signal_str.close( );
+
+  // Write gnuplot script
+  std::string output_gnuplot_filename = output_image_filename + ".gnuplot";
+  std::ofstream output_gnuplot_str( output_gnuplot_filename.c_str( ) );
+  unsigned int thr_pos = filter->GetOptimumThreshold( );
+  int thr = curve[ thr_pos ].first;
+  output_gnuplot_str
+    << "set term png" << std::endl
+    << "set output \"" << output_image_filename << ".png\"" << std::endl
+    << "set arrow 1 from " << thr
+    << ",0 to " << thr << "," << max_count
+    << std::endl
+    << "show arrow 1" << std::endl
+    << "plot \"" << output_signal_filename
+    << "\" using 1:2 with linespoints title \"Evolution ("
+    << thr << "," << thr_pos << ") " << "\""
+    << std::endl;
+  output_gnuplot_str.close( );
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
index e6d93b88d0f5e43c7f6e7a99216e2a0896750822..4feb556f0db0c20ac5c29385713dcd31e7c34ff3 100644 (file)
@@ -1,21 +1,27 @@
-OPTION(BUILD_Examples "Build simple examples?" OFF)
-
-IF(BUILD_Examples)
-  SET(
+option(BUILD_EXAMPLES "Build cpPlugins-free examples." OFF)
+if(BUILD_EXAMPLES)
+  set(
     _examples
-    RegionGrow_00
-    FastMarching_00
-    MoriRegionGrow_00
-    Skeleton_00
+    RegionGrow_Tautology
+    RegionGrow_BinaryThreshold
+    RegionGrow_Mori
+    Dijkstra_Maurer
+    #CreateMoriInputImage
+    #BronchiiInitialSegmentationWithMori
+    #BronchiiInitialSegmentationWithBinaryThresholdRegionGrow
     )
-  INCLUDE_DIRECTORIES(
+  option(BUILD_EXAMPLE_SANDBOX "Build sandbox example." OFF)
+  if(BUILD_EXAMPLE_SANDBOX)
+    list(APPEND _examples sandbox)
+  endif(BUILD_EXAMPLE_SANDBOX)
+  include_directories(
     ${PROJECT_SOURCE_DIR}/lib
     ${PROJECT_BINARY_DIR}/lib
     )
-  FOREACH(_example ${_examples})
-    ADD_EXECUTABLE(fpa_example_${_example} ${_example}.cxx)
-    TARGET_LINK_LIBRARIES(fpa_example_${_example} ${ITK_LIBRARIES} ${VTK_LIBRARIES})
-  ENDFOREACH(_example)
-ENDIF(BUILD_Examples)
+  foreach(_e ${_examples})
+    add_executable(fpa_example_${_e} ${_e}.cxx)
+    target_link_libraries(fpa_example_${_e} ${ITK_LIBRARIES})
+  endforeach(_e)
+endif(BUILD_EXAMPLES)
 
 ## eof - $RCSfile$
diff --git a/examples/CreateMoriInputImage.cxx b/examples/CreateMoriInputImage.cxx
new file mode 100644 (file)
index 0000000..144ed6e
--- /dev/null
@@ -0,0 +1,64 @@
+#include <queue>
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkSignedMaurerDistanceMapImageFilter.h>
+#include <itkImageFileWriter.h>
+
+// -------------------------------------------------------------------------
+static const unsigned int Dim = 2;
+typedef short TInputPixel;
+typedef float TOutputPixel;
+typedef itk::Image< TInputPixel, Dim > TInputImage;
+typedef itk::Image< TOutputPixel, Dim > TOutputImage;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Command configuration
+  if( argc < 3 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ] << " input_image output_image"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = argv[ 1 ];
+  std::string output_image_filename = argv[ 2 ];
+
+  // Read image
+  typedef itk::ImageFileReader< TInputImage > TReader;
+  TReader::Pointer reader = TReader::New( );
+  reader->SetFileName( input_image_filename );
+
+  // Distance map
+  typedef itk::SignedMaurerDistanceMapImageFilter< TInputImage, TOutputImage > TFilter;
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( reader->GetOutput( ) );
+  filter->SetBackgroundValue( 0 );
+  filter->InsideIsPositiveOn( );
+  filter->SquaredDistanceOff( );
+  filter->UseImageSpacingOn( );
+
+  // Write image
+  typedef itk::ImageFileWriter< TOutputImage > TWriter;
+  TWriter::Pointer writer = TWriter::New( );
+  writer->SetInput( filter->GetOutput( ) );
+  writer->SetFileName( output_image_filename );
+
+  // Execute pipeline
+  try
+  {
+    writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/examples/Dijkstra_Maurer.cxx b/examples/Dijkstra_Maurer.cxx
new file mode 100644 (file)
index 0000000..c67024a
--- /dev/null
@@ -0,0 +1,134 @@
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkImageFileWriter.h>
+#include <itkMinimumMaximumImageCalculator.h>
+#include <itkSignedMaurerDistanceMapImageFilter.h>
+
+#include <fpa/Image/Dijkstra.h>
+#include <fpa/Image/Functors/VertexIdentity.h>
+#include <fpa/Base/Functors/InvertValue.h>
+#include <fpa/Image/MinimumSpanningTreeToImageFilter.h>
+
+// -------------------------------------------------------------------------
+static const unsigned int VDim = 2;
+typedef short                                              TPixel;
+typedef double                                             TScalar;
+typedef itk::Image< TPixel, VDim >                         TImage;
+typedef itk::Image< TScalar, VDim >                        TScalarImage;
+typedef itk::ImageFileReader< TImage >                     TReader;
+typedef itk::ImageFileWriter< TScalarImage >               TWriter;
+typedef fpa::Image::Dijkstra< TScalarImage, TScalarImage > TFilter;
+typedef itk::MinimumMaximumImageCalculator< TImage >       TMinMax;
+typedef itk::SignedMaurerDistanceMapImageFilter< TImage, TScalarImage > TDMap;
+
+typedef TImage::IndexType TIndex;
+
+typedef fpa::Image::Functors::VertexIdentity< TScalarImage, TScalar > TVertexFunc;
+typedef fpa::Base::Functors::InvertValue< TScalar, TScalar > TValueFunc;
+
+typedef TFilter::TMST                TMST;
+typedef itk::ImageFileWriter< TMST > TMSTWriter;
+
+typedef unsigned char TColorValue;
+typedef fpa::Image::MinimumSpanningTreeToImageFilter< TMST, TColorValue > TMSTToImage;
+typedef TMSTToImage::TOutputImage TColorImage;
+typedef itk::ImageFileWriter< TColorImage > TColorImageWriter;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 5 + VDim )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_image output_image output_paths stop_at_one_front";
+    for( unsigned int i = 0; i < VDim; ++i )
+      std::cerr << " s_" << i;
+    std::cerr << " ..." << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = argv[ 1 ];
+  std::string output_image_filename = argv[ 2 ];
+  std::string output_paths_filename = argv[ 3 ];
+  bool stop_at_one_front = ( std::atoi( argv[ 4 ] ) == 1 );
+
+  TReader::Pointer reader = TReader::New( );
+  reader->SetFileName( input_image_filename );
+  try
+  {
+    reader->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  TMinMax::Pointer minmax = TMinMax::New( );
+  minmax->SetImage( reader->GetOutput( ) );
+  minmax->Compute( );
+
+  TDMap::Pointer dmap = TDMap::New( );
+  dmap->SetInput( reader->GetOutput( ) );
+  dmap->SetBackgroundValue( minmax->GetMinimum( ) );
+  dmap->InsideIsPositiveOn( );
+  dmap->UseImageSpacingOn( );
+  dmap->SquaredDistanceOff( );
+
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( dmap->GetOutput( ) );
+  filter->SetStopAtOneFront( stop_at_one_front );
+
+  for( int i = 5; i < argc; i += VDim )
+  {
+    if( i + VDim <= argc )
+    {
+      TImage::IndexType seed;
+      for( int j = 0; j < VDim; ++j )
+        seed[ j ] = std::atoi( argv[ i + j ] );
+      filter->AddSeed( seed );
+
+    } // fi
+
+  } // rof
+
+  TVertexFunc::Pointer vertex_func = TVertexFunc::New( );
+  filter->SetFunctor( vertex_func );
+
+  TValueFunc::Pointer value_func = TValueFunc::New( );
+  value_func->SetAlpha( 1 );
+  value_func->SetBeta( 1 );
+  filter->SetFunctor( value_func );
+
+  TWriter::Pointer writer = TWriter::New( );
+  writer->SetInput( filter->GetOutput( ) );
+  writer->SetFileName( output_image_filename );
+
+  TMSTToImage::Pointer mst_image = TMSTToImage::New( );
+  mst_image->SetInput( filter->GetMinimumSpanningTree( ) );
+  for( TIndex iseed: filter->GetSeeds( ) )
+    for( TIndex jseed: filter->GetSeeds( ) )
+      mst_image->AddPath( iseed, jseed, 255, 0, 0 );
+
+  TColorImageWriter::Pointer paths_writer = TColorImageWriter::New( );
+  paths_writer->SetInput( mst_image->GetOutput( ) );
+  paths_writer->SetFileName( output_paths_filename );
+
+  try
+  {
+    writer->Update( );
+    paths_writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "ERROR: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/examples/FastMarching_00.cxx b/examples/FastMarching_00.cxx
deleted file mode 100644 (file)
index 41ed61e..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <itkImage.h>
-#include <itkImageFileWriter.h>
-#include <fpa/Image/FastMarching.h>
-
-// -------------------------------------------------------------------------
-typedef itk::Image< float, 2 >                     TImage;
-typedef fpa::Image::FastMarching< TImage, TImage > TFilter;
-typedef itk::ImageFileWriter< TImage >             TWriter;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  TImage::SizeType size;
-  size.Fill( 512 );
-
-  TImage::SpacingType spac;
-  spac[ 0 ] = 0.4;
-  spac[ 1 ] = 1.7;
-
-  TImage::Pointer input = TImage::New( );
-  input->SetRegions( size );
-  input->SetSpacing( spac );
-  input->Allocate( );
-  input->FillBuffer( 1 );
-
-  TImage::RegionType region = input->GetLargestPossibleRegion( );
-  TImage::PointType p0, p1, p2, p3, p4;
-  input->TransformIndexToPhysicalPoint( region.GetIndex( ), p0 );
-  input->TransformIndexToPhysicalPoint(
-    region.GetIndex( ) + region.GetSize( ), p1
-    );
-  p2 = ( p0.GetVectorFromOrigin( ) + p1.GetVectorFromOrigin( ) ) * 0.5;
-  p3 = ( p0.GetVectorFromOrigin( ) + p1.GetVectorFromOrigin( ) ) * 0.25;
-  p4 = ( p0.GetVectorFromOrigin( ) + p1.GetVectorFromOrigin( ) ) * 0.75;
-  TImage::IndexType s0, s1, s2;
-  input->TransformPhysicalPointToIndex( p2, s0 );
-  input->TransformPhysicalPointToIndex( p3, s1 );
-  input->TransformPhysicalPointToIndex( p4, s2 );
-
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( input );
-  filter->AddSeed( s0, 0 );
-  filter->AddSeed( s1, 0 );
-  filter->AddSeed( s2, 0 );
-  filter->Update( );
-
-  TWriter::Pointer writer = TWriter::New( );
-  writer->SetInput( filter->GetOutput( ) );
-  writer->SetFileName( "FastMarching_00.mhd" );
-  writer->Update( );
-
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/examples/MoriRegionGrow_00.cxx b/examples/MoriRegionGrow_00.cxx
deleted file mode 100644 (file)
index 45e7417..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#include <itkImage.h>
-#include <itkImageFileReader.h>
-#include <itkImageFileWriter.h>
-#include <fpa/Image/MoriRegionGrow.h>
-
-// -------------------------------------------------------------------------
-typedef itk::Image< unsigned char, 2 >               TImage;
-typedef itk::ImageFileReader< TImage >               TReader;
-typedef itk::ImageFileWriter< TImage >               TWriter;
-typedef fpa::Image::MoriRegionGrow< TImage, TImage > TFilter;
-typedef itk::ImageFileWriter< TFilter::TAuxImage >   TAuxWriter;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  if( argc < 4 )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " input_filename output_filename output_aux_filename" << std::endl;
-    return( 1 );
-
-  } // fi
-  std::string in_fname = argv[ 1 ];
-  std::string out_fname = argv[ 2 ];
-  std::string out_aux_fname = argv[ 3 ];
-  int seed_x = 111;
-  int seed_y = 91;
-
-  TReader::Pointer reader = TReader::New( );
-  reader->SetFileName( in_fname );
-
-  TImage::IndexType seed;
-  seed[ 0 ] = seed_x;
-  seed[ 1 ] = seed_y;
-
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( reader->GetOutput( ) );
-  filter->SetLower( 0 );
-  filter->SetUpper( 255 );
-  filter->SetStep( 1 );
-  filter->SetInsideValue( 255 );
-  filter->SetOutsideValue( 0 );
-  filter->SetSeed( seed );
-
-  TWriter::Pointer writer = TWriter::New( );
-  writer->SetInput( filter->GetOutput( ) );
-  writer->SetFileName( out_fname );
-  writer->Update( );
-
-  TAuxWriter::Pointer aux_writer = TAuxWriter::New( );
-  aux_writer->SetInput( filter->GetAuxiliaryImage( ) );
-  aux_writer->SetFileName( out_aux_fname );
-  aux_writer->Update( );
-  
-
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/examples/RegionGrow_00.cxx b/examples/RegionGrow_00.cxx
deleted file mode 100644 (file)
index eab6d41..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <itkCommand.h>
-#include <itkImage.h>
-#include <itkImageFileWriter.h>
-#include <fpa/Image/RegionGrow.h>
-
-// -------------------------------------------------------------------------
-typedef itk::Image< unsigned char, 2 >           TImage;
-typedef fpa::Image::RegionGrow< TImage, TImage > TFilter;
-typedef itk::ImageFileWriter< TImage >           TWriter;
-
-// -------------------------------------------------------------------------
-/**
- */
-class MyObserver
-  : public itk::Command
-{
-public:
-  typedef TFilter::TStartEvent     TStartEvent;
-  typedef TFilter::TEndEvent       TEndEvent;
-  typedef TFilter::TStartLoopEvent TStartLoopEvent;
-  typedef TFilter::TEndLoopEvent   TEndLoopEvent;
-  typedef TFilter::TPushEvent      TPushEvent;
-  typedef TFilter::TPopEvent       TPopEvent;
-  typedef TFilter::TMarkEvent      TMarkEvent;
-
-public:
-  itkNewMacro( MyObserver );
-
-public:
-  virtual void Execute(
-    itk::Object* caller, const itk::EventObject& event
-    ) override
-    {
-      this->Execute( const_cast< const itk::Object* >( caller ), event );
-    }
-  virtual void Execute(
-    const itk::Object* object, const itk::EventObject& event
-    ) override
-    {
-      if( TStartEvent( ).CheckEvent( &event ) )
-        std::cout << "Start" << std::endl;
-      else if( TEndEvent( ).CheckEvent( &event ) )
-        std::cout << "End" << std::endl;
-      else if( TStartLoopEvent( ).CheckEvent( &event ) )
-        std::cout << "StartLoop" << std::endl;
-      else if( TEndLoopEvent( ).CheckEvent( &event ) )
-        std::cout << "EndLoop" << std::endl;
-      else if( TMarkEvent( ).CheckEvent( &event ) )
-      {
-        const TMarkEvent* mark = dynamic_cast< const TMarkEvent* >( &event );
-        std::cout << "Mark: " << mark->Vertex << std::endl;
-
-      } // fi
-      /* TODO
-         TPushEvent;
-         TPopEvent;
-      */
-    }
-};
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  TImage::SizeType size;
-  size.Fill( 10 );
-
-  TImage::Pointer input = TImage::New( );
-  input->SetRegions( size );
-  input->Allocate( );
-  input->FillBuffer( 0 );
-
-  TImage::RegionType region = input->GetLargestPossibleRegion( );
-  TImage::PointType p0, p1, p2;
-  input->TransformIndexToPhysicalPoint( region.GetIndex( ), p0 );
-  input->TransformIndexToPhysicalPoint(
-    region.GetIndex( ) + region.GetSize( ), p1
-    );
-  p2 = ( p0.GetVectorFromOrigin( ) + p1.GetVectorFromOrigin( ) ) * 0.5;
-  TImage::IndexType seed;
-  input->TransformPhysicalPointToIndex( p2, seed );
-
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( input );
-  filter->SetInsideValue( 255 );
-  filter->SetOutsideValue( 0 );
-  filter->AddSeed( seed, filter->GetInsideValue( ) );
-
-  MyObserver::Pointer obs = MyObserver::New( );
-  filter->AddObserver( itk::AnyEvent( ), obs );
-  filter->Update( );
-
-  TWriter::Pointer writer = TWriter::New( );
-  writer->SetInput( filter->GetOutput( ) );
-  writer->SetFileName( "RegionGrow_00.png" );
-  writer->Update( );
-
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/examples/RegionGrow_BinaryThreshold.cxx b/examples/RegionGrow_BinaryThreshold.cxx
new file mode 100644 (file)
index 0000000..3e0b95a
--- /dev/null
@@ -0,0 +1,76 @@
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkImageFileWriter.h>
+
+#include <fpa/Image/RegionGrow.h>
+#include <fpa/Image/Functors/RegionGrow/BinaryThreshold.h>
+
+// -------------------------------------------------------------------------
+typedef unsigned char                  TPixel;
+typedef itk::Image< TPixel, 2 >        TImage;
+typedef itk::ImageFileReader< TImage > TReader;
+typedef itk::ImageFileWriter< TImage > TWriter;
+
+typedef fpa::Image::RegionGrow< TImage, TImage > TFilter;
+typedef fpa::Image::Functors::RegionGrow::BinaryThreshold< TPixel > TPredicate;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 7 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_image output_image lower upper s0x s0y s1x s1y ..."
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = argv[ 1 ];
+  std::string output_image_filename = argv[ 2 ];
+  TPixel lower = std::atof( argv[ 3 ] );
+  TPixel upper = std::atof( argv[ 4 ] );
+
+  TReader::Pointer reader = TReader::New( );
+  reader->SetFileName( input_image_filename );
+
+  TPredicate::Pointer predicate = TPredicate::New( );
+  predicate->SetLower( lower );
+  predicate->SetUpper( upper );
+
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( reader->GetOutput( ) );
+  filter->SetPredicate( predicate );
+  for( int i = 5; i < argc; i += 2 )
+  {
+    if( i + 1 < argc )
+    {
+      TImage::IndexType seed;
+      seed[ 0 ] = std::atoi( argv[ i ] );
+      seed[ 1 ] = std::atoi( argv[ i + 1 ] );
+      filter->AddSeed( seed );
+
+    } // fi
+
+  } // rof
+  filter->SetInsideValue( 255 );
+  filter->SetOutsideValue( 0 );
+
+  TWriter::Pointer writer = TWriter::New( );
+  writer->SetInput( filter->GetOutput( ) );
+  writer->SetFileName( output_image_filename );
+  try
+  {
+    writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "ERROR: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/examples/RegionGrow_Mori.cxx b/examples/RegionGrow_Mori.cxx
new file mode 100644 (file)
index 0000000..bdff6aa
--- /dev/null
@@ -0,0 +1,142 @@
+#include <chrono>
+#include <iomanip>
+#include <itkCommand.h>
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkImageFileWriter.h>
+#include <itkBinaryThresholdImageFilter.h>
+
+#include <fpa/Image/MoriRegionGrow.h>
+
+// -------------------------------------------------------------------------
+static const unsigned int VDim = 3;
+typedef short                                             TPixel;
+typedef itk::Image< TPixel, VDim >                        TImage;
+typedef itk::ImageFileReader< TImage >                    TReader;
+typedef itk::ImageFileWriter< TImage >                    TWriter;
+typedef fpa::Image::MoriRegionGrow< TImage, TImage >      TFilter;
+typedef itk::BinaryThresholdImageFilter< TImage, TImage > TThreshold;
+
+// -------------------------------------------------------------------------
+class ShowProgressObject
+{
+public:
+  ShowProgressObject( itk::ProcessObject* o )
+    {
+      this->m_Process = o;
+    }
+  void ShowProgress( )
+    {
+      std::cerr
+        << "\rProgress " << std::fixed << std::setprecision( 2 )
+        << ( this->m_Process->GetProgress( ) * 100 )
+        << " %" << std::flush;
+    }
+  itk::ProcessObject::Pointer m_Process;
+};
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 6 + VDim )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_image output_image lower upper delta";
+    for( unsigned int i = 0; i < VDim; ++i )
+      std::cerr << " s_" << i;
+    std::cerr << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = argv[ 1 ];
+  std::string output_image_filename = argv[ 2 ];
+  TPixel lower = std::atof( argv[ 3 ] );
+  TPixel upper = std::atof( argv[ 4 ] );
+  TPixel delta = std::atof( argv[ 5 ] );
+
+  TReader::Pointer reader = TReader::New( );
+  reader->SetFileName( input_image_filename );
+  try
+  {
+    reader->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "ERROR: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( reader->GetOutput( ) );
+  filter->SetThresholdRange( lower, upper, delta );
+  TImage::PointType pnt;
+  for( int i = 0; i < VDim; ++i )
+    pnt[ i ] = std::atof( argv[ i + 6 ] );
+
+  TImage::IndexType seed;
+  if( !( reader->GetOutput( )->TransformPhysicalPointToIndex( pnt, seed ) ) )
+  {
+    std::cerr << "ERROR: seed outside image." << std::endl;
+    return( 1 );
+
+  } // fi
+  filter->AddSeed( seed );
+
+  // to test ProgressReporter
+  /* TODO
+     ShowProgressObject progressWatch( filter );
+     typedef itk::SimpleMemberCommand< ShowProgressObject > CommandType;
+     CommandType::Pointer command = CommandType::New();
+     command->SetCallbackFunction( &progressWatch,
+     &ShowProgressObject::ShowProgress );
+     filter->AddObserver( itk::ProgressEvent( ), command );
+  */
+  std::chrono::time_point< std::chrono::system_clock > start, end;
+  start = std::chrono::system_clock::now( );
+  filter->Update( );
+  end = std::chrono::system_clock::now( );
+  std::chrono::duration< double > elapsed_seconds = end - start;
+
+  TThreshold::Pointer threshold = TThreshold::New( );
+  threshold->SetInput( filter->GetOutput( ) );
+  threshold->SetInsideValue( 255 );
+  threshold->SetOutsideValue( 0 );
+  threshold->SetLowerThreshold( 0 );
+  threshold->SetUpperThreshold( filter->GetOptimumThreshold( ) );
+  
+  TWriter::Pointer writer = TWriter::New( );
+  writer->SetInput( threshold->GetOutput( ) );
+  writer->SetFileName( output_image_filename );
+  try
+  {
+    writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "ERROR: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  // Show data
+  TFilter::TCurve curve = filter->GetCurve( );
+  for( TFilter::TCurveData data: curve )
+  {
+    std::cout << data.XValue << " " << data.YValue << " " << data.Diff1 << std::endl;
+  }
+  std::cout
+    << std::endl
+    << "# Opt: "
+    << curve[ filter->GetOptimumThreshold( ) ].XValue
+    << "("
+    << filter->GetOptimumThreshold( )
+     << ")"
+    << std::endl;
+  std::cout << "Time: " << elapsed_seconds.count( ) << "s" << std::endl;
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/examples/RegionGrow_Tautology.cxx b/examples/RegionGrow_Tautology.cxx
new file mode 100644 (file)
index 0000000..8bee856
--- /dev/null
@@ -0,0 +1,74 @@
+#include <itkImage.h>
+#include <itkImageFileWriter.h>
+
+#include <fpa/Image/RegionGrow.h>
+#include <fpa/Image/Functors/RegionGrow/Tautology.h>
+
+// -------------------------------------------------------------------------
+typedef unsigned char                  TPixel;
+typedef itk::Image< TPixel, 2 >        TImage;
+typedef itk::ImageFileWriter< TImage > TWriter;
+
+typedef fpa::Image::RegionGrow< TImage, TImage > TFilter;
+typedef fpa::Image::Functors::RegionGrow::Tautology< TPixel > TPredicate;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 6 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " output_image width height s0x s0y s1x s1y ..."
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string output_image_filename = argv[ 1 ];
+  TImage::SizeType size;
+  size[ 0 ] = std::atoi( argv[ 2 ] );
+  size[ 1 ] = std::atoi( argv[ 3 ] );
+
+  TImage::Pointer input = TImage::New( );
+  input->SetRegions( size );
+  input->Allocate( );
+  input->FillBuffer( 0 );
+
+  TPredicate::Pointer predicate = TPredicate::New( );
+
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( input );
+  filter->SetPredicate( predicate );
+  for( int i = 4; i < argc; i += 2 )
+  {
+    if( i + 1 < argc )
+    {
+      TImage::IndexType seed;
+      seed[ 0 ] = std::atoi( argv[ i ] );
+      seed[ 1 ] = std::atoi( argv[ i + 1 ] );
+      filter->AddSeed( seed );
+
+    } // fi
+
+  } // rof
+  filter->SetInsideValue( 255 );
+  filter->SetOutsideValue( 0 );
+
+  TWriter::Pointer writer = TWriter::New( );
+  writer->SetInput( filter->GetOutput( ) );
+  writer->SetFileName( output_image_filename );
+  try
+  {
+    writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "ERROR: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/examples/Skeleton_00.cxx b/examples/Skeleton_00.cxx
deleted file mode 100644 (file)
index 9351c86..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <itkImage.h>
-#include <itkImageFileReader.h>
-#include <itkSignedMaurerDistanceMapImageFilter.h>
-#include <itkMinimumMaximumImageCalculator.h>
-#include <fpa/Image/SkeletonFilter.h>
-#include <cpExtensions/Algorithms/SkeletonWriter.h>
-
-// -------------------------------------------------------------------------
-typedef itk::Image< double, 2 >                                   TImage;
-typedef itk::ImageFileReader< TImage >                            TReader;
-typedef itk::SignedMaurerDistanceMapImageFilter< TImage, TImage > TDMap;
-typedef itk::MinimumMaximumImageCalculator< TImage >              TMinMax;
-typedef fpa::Image::SkeletonFilter< TImage >                      TFilter;
-typedef TFilter::TSkeleton                                        TSkeleton;
-typedef cpExtensions::Algorithms::SkeletonWriter< TSkeleton >     TWriter;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  if( argc < 3 )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " input_filename output_filename" << std::endl;
-    return( 1 );
-
-  } // fi
-  std::string in_fname = argv[ 1 ];
-  std::string out_fname = argv[ 2 ];
-
-  TReader::Pointer reader = TReader::New( );
-  reader->SetFileName( in_fname );
-
-  TDMap::Pointer dmap = TDMap::New( );
-  dmap->SetInput( reader->GetOutput( ) );
-  dmap->InsideIsPositiveOn( );
-  dmap->SquaredDistanceOff( );
-  dmap->UseImageSpacingOn( );
-  dmap->Update( );
-
-  TMinMax::Pointer minmax = TMinMax::New( );
-  minmax->SetImage( dmap->GetOutput( ) );
-  minmax->Compute( );
-
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( dmap->GetOutput( ) );
-  filter->AddSeed( minmax->GetIndexOfMaximum( ), 0 );
-  filter->Update( );
-
-  TWriter::Pointer writer = TWriter::New( );
-  writer->SetInput( filter->GetSkeleton( ) );
-  writer->SetFileName( out_fname );
-  writer->Update( );
-
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/examples/sandbox.cxx b/examples/sandbox.cxx
new file mode 100644 (file)
index 0000000..d27bea9
--- /dev/null
@@ -0,0 +1,113 @@
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkImageFileWriter.h>
+#include <itkMinimumMaximumImageCalculator.h>
+#include <itkImageRegionConstIteratorWithIndex.h>
+
+#include <fpa/Image/Dijkstra.h>
+#include <fpa/Image/Functors/GaussianWeight.h>
+
+// -------------------------------------------------------------------------
+static const unsigned int VDim = 2;
+typedef short                                        TPixel;
+typedef double                                       TScalar;
+typedef itk::Image< TPixel, VDim >                   TImage;
+typedef itk::Image< TScalar, VDim >                  TScalarImage;
+typedef itk::ImageFileReader< TImage >               TReader;
+typedef itk::ImageFileWriter< TScalarImage >         TWriter;
+typedef fpa::Image::Dijkstra< TImage, TScalarImage > TFilter;
+typedef itk::MinimumMaximumImageCalculator< TImage > TMinMax;
+typedef itk::ImageRegionConstIteratorWithIndex< TImage > TIterator;
+
+typedef fpa::Image::Functors::GaussianWeight< TImage, TScalar > TVertexFunc;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 5 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_image input_seeds output_image beta"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = argv[ 1 ];
+  std::string input_seeds_filename = argv[ 2 ];
+  std::string output_image_filename = argv[ 3 ];
+  double beta = std::atof( argv[ 4 ] );
+
+  // Read seeds
+  TReader::Pointer input_seeds = TReader::New( );
+  input_seeds->SetFileName( input_seeds_filename );
+  try
+  {
+    input_seeds->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+  TMinMax::Pointer minmax = TMinMax::New( );
+  minmax->SetImage( input_seeds->GetOutput( ) );
+  minmax->Compute( );
+
+  // Read image
+  TReader::Pointer input_image = TReader::New( );
+  input_image->SetFileName( input_image_filename );
+
+  // Prepare dijkstra filter
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( input_image->GetOutput( ) );
+  filter->StopAtOneFrontOff( );
+
+  // Assign seeds
+  /* TODO
+     TIterator sIt(
+     input_seeds->GetOutput( ),
+     input_seeds->GetOutput( )->GetRequestedRegion( )
+     );
+     for( sIt.GoToBegin( ); !sIt.IsAtEnd( ); ++sIt )
+     if( sIt.Get( ) > minmax->GetMinimum( ) )
+     filter->AddSeed( sIt.GetIndex( ) );
+  */
+  TImage::IndexType seed;
+  /* TODO
+     seed[ 0 ] = 248;
+     seed[ 1 ] = 326;
+     seed[ 2 ] = 312;
+  */
+  seed[ 0 ] = 482;
+  seed[ 1 ] = 57;
+  filter->AddSeed( seed );
+
+  seed[ 0 ] = 306;
+  seed[ 1 ] = 439;
+  filter->AddSeed( seed );
+
+  TVertexFunc::Pointer vertex_func = TVertexFunc::New( );
+  vertex_func->SetBeta( beta );
+  filter->SetFunctor( vertex_func );
+
+  TWriter::Pointer writer = TWriter::New( );
+  writer->SetInput( filter->GetOutput( ) );
+  writer->SetFileName( output_image_filename );
+
+  try
+  {
+    writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "ERROR: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+  return( 0 );
+}
+
+// eof - $RCSfile$
index 5afdc751aa270705eb27d3308e1aba1e42943b4f..f4c0955ff0028349564cd1c88ae1f5ca49eb7aaf 100644 (file)
@@ -1,8 +1,8 @@
 
-## ===================================
-## == Build instances for cpPlugins ==
-## ===================================
-
-SUBDIRS(fpaInstances)
+include_directories(
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_BINARY_DIR}
+  )
+subdirs(fpa)
 
 ## eof - $RCSfile$
diff --git a/lib/fpa/Base/Algorithm.h b/lib/fpa/Base/Algorithm.h
deleted file mode 100644 (file)
index 6625467..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-#ifndef __fpa__Base__Algorithm__h__
-#define __fpa__Base__Algorithm__h__
-
-#include <vector>
-#include <itkFunctionBase.h>
-#include <fpa/Config.h>
-#include <fpa/Base/Events.h>
-#include <fpa/Base/Functors/VertexCostFunctionBase.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    /**
-     */
-    template< class _TFilter, class _TVertex, class _TOutput >
-    class Algorithm
-      : public _TFilter
-    {
-    public:
-      typedef Algorithm                       Self;
-      typedef _TFilter                        Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      typedef _TVertex      TVertex;
-      typedef _TOutput      TOutput;
-      typedef unsigned long TFrontId;
-
-      // Different functions
-      typedef std::vector< TVertex >                      TNeighborhood;
-      typedef itk::FunctionBase< TVertex, TNeighborhood > TNeighborhoodFunction;
-      typedef itk::FunctionBase< TOutput, TOutput >       TConversionFunction;
-      typedef fpa::Base::Functors::VertexCostFunctionBase< TVertex, TOutput > TVertexFunction;
-
-      // Minigraph to represent collisions
-      typedef std::pair< _TVertex, bool >   TCollision;
-      typedef std::vector< TCollision >     TCollisionsRow;
-      typedef std::vector< TCollisionsRow > TCollisions;
-
-    protected:
-      struct _TQueueNode
-      {
-        TVertex  Vertex;
-        TVertex  Parent;
-        TOutput  Result;
-        TFrontId FrontId;
-        _TQueueNode( );
-        _TQueueNode( const TVertex& v );
-        _TQueueNode( const TVertex& v, const _TQueueNode& n );
-      };
-
-    public:
-      itkTypeMacro( Self, _TFilter );
-
-      fpa_Base_NewEvent( TStartEvent );
-      fpa_Base_NewEvent( TEndEvent );
-      fpa_Base_NewEvent( TStartLoopEvent );
-      fpa_Base_NewEvent( TEndLoopEvent );
-      fpa_Base_NewEventWithVertex( TPushEvent, TVertex );
-      fpa_Base_NewEventWithVertex( TPopEvent, TVertex );
-      fpa_Base_NewEventWithVertex( TMarkEvent, TVertex );
-
-      itkGetConstMacro( InitResult, _TOutput );
-      itkSetMacro( InitResult, _TOutput );
-
-      itkBooleanMacro( StopAtOneFront );
-      itkGetConstMacro( StopAtOneFront, bool );
-      itkSetMacro( StopAtOneFront, bool );
-
-      itkGetObjectMacro( NeighborhoodFunction, TNeighborhoodFunction );
-      itkGetObjectMacro( ConversionFunction, TConversionFunction );
-      itkGetObjectMacro( VertexFunction, TVertexFunction );
-
-      itkGetConstObjectMacro( NeighborhoodFunction, TNeighborhoodFunction );
-      itkGetConstObjectMacro( ConversionFunction, TConversionFunction );
-      itkGetConstObjectMacro( VertexFunction, TVertexFunction );
-
-      itkSetObjectMacro( NeighborhoodFunction, TNeighborhoodFunction );
-      itkSetObjectMacro( ConversionFunction, TConversionFunction );
-      itkSetObjectMacro( VertexFunction, TVertexFunction );
-
-    public:
-      void ClearSeeds( );
-      void AddSeed( const TVertex& seed, const TOutput& value );
-
-    protected:
-      Algorithm( );
-      virtual ~Algorithm( );
-
-      virtual void GenerateData( ) override;
-
-      // Particular methods
-      virtual bool _ContinueGenerateData( );
-      virtual void _Loop( );
-
-      virtual void _BeforeGenerateData( );
-      virtual void _AfterGenerateData( );
-      virtual void _BeforeLoop( );
-      virtual void _AfterLoop( );
-
-      virtual bool _ValidLoop( ) const;
-      virtual void _UpdateCollisions( const TVertex& a, const TVertex& b );
-
-      virtual _TOutput _GetInputValue( const _TQueueNode& v, const _TQueueNode& p );
-
-      virtual void _InitMarks( ) = 0;
-      virtual void _InitResults( const TOutput& init_value ) = 0;
-      virtual bool _IsMarked( const _TVertex& v ) const = 0;
-      virtual void _Mark( const _TQueueNode& n ) = 0;
-      virtual TFrontId _GetMark( const _TVertex& v ) const = 0;
-      virtual void _UpdateResult( const _TQueueNode& n ) = 0;
-      virtual TOutput _GetResult( const _TVertex& v ) const = 0;
-      virtual unsigned int _GetNumberOfDimensions( ) const = 0;
-
-      virtual bool _UpdateValue( _TQueueNode& v, const _TQueueNode& p ) = 0;
-      virtual unsigned long _QueueSize( ) const = 0;
-      virtual void _QueueClear( ) = 0;
-      virtual void _QueuePush( const _TQueueNode& node ) = 0;
-      virtual _TQueueNode _QueuePop( ) = 0;
-
-    private:
-      // Purposely not implemented.
-      Algorithm( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      _TOutput m_InitResult;
-      bool m_StopAtOneFront;
-
-      typename TNeighborhoodFunction::Pointer m_NeighborhoodFunction;
-      typename TConversionFunction::Pointer   m_ConversionFunction;
-      typename TVertexFunction::Pointer       m_VertexFunction;
-
-      std::vector< _TQueueNode > m_Seeds;
-      TCollisions m_Collisions;
-      unsigned int m_NumberOfFronts;
-    };
-
-  } // ecaseman
-
-} // ecaseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/Algorithm.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__Algorithm__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Algorithm.hxx b/lib/fpa/Base/Algorithm.hxx
deleted file mode 100644 (file)
index c29ff03..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-#ifndef __fpa__Base__Algorithm__hxx__
-#define __fpa__Base__Algorithm__hxx__
-
-#include <queue>
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::_TQueueNode::
-_TQueueNode( )
-{
-  this->Vertex.Fill( 0 );
-  this->Parent.Fill( 0 );
-  this->Result = _TOutput( 0 );
-  this->FrontId = 0;
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::_TQueueNode::
-_TQueueNode( const _TVertex& v )
-{
-  this->Vertex = v;
-  this->Parent = v;
-  this->Result = _TOutput( 0 );
-  this->FrontId = 0;
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::_TQueueNode::
-_TQueueNode( const _TVertex& v, const _TQueueNode& n )
-{
-  this->Vertex = v;
-  this->Parent = n.Vertex;
-  this->Result = n.Result;
-  this->FrontId = n.FrontId;
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-void fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-ClearSeeds( )
-{
-  this->m_Seeds.clear( );
-  this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-void fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-AddSeed( const _TVertex& seed, const TOutput& value )
-{
-  _TQueueNode node( seed );
-  node.FrontId = this->m_Seeds.size( ) + 1;
-  node.Result = value;
-  this->m_Seeds.push_back( node );
-  this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-Algorithm( )
-  : Superclass( ),
-    m_InitResult( _TOutput( 0 ) ),
-    m_StopAtOneFront( false )
-{
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-~Algorithm( )
-{
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-void fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-GenerateData( )
-{
-  this->InvokeEvent( TStartEvent( ) );
-  this->_BeforeGenerateData( );
-  this->m_NumberOfFronts = this->m_Seeds.size( );
-  if( this->m_NumberOfFronts > 0 )
-  {
-    // Prepare collisions
-    TCollision coll( TVertex( ), false );
-    TCollisionsRow row( this->m_NumberOfFronts, coll );
-    this->m_Collisions.clear( );
-    this->m_Collisions.resize( this->m_NumberOfFronts, row );
-
-    // Put seeds on queue
-    this->_QueueClear( );
-    for(
-      auto nIt = this->m_Seeds.begin( );
-      nIt != this->m_Seeds.end( );
-      ++nIt
-      )
-      this->_QueuePush( *nIt );
-
-    // Init marks and results
-    this->_InitMarks( );
-    this->_InitResults( this->m_InitResult );
-
-    // Main loop
-    do
-      this->_Loop( );
-    while( this->_ContinueGenerateData( ) );
-
-  } // fi
-  this->_AfterGenerateData( );
-  this->InvokeEvent( TEndEvent( ) );
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-bool fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-_ContinueGenerateData( )
-{
-  return( false );
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-void fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-_Loop( )
-{
-  this->InvokeEvent( TStartLoopEvent( ) );
-  this->_BeforeLoop( );
-  while( this->_ValidLoop( ) )
-  {
-    _TQueueNode node = this->_QueuePop( );
-    this->InvokeEvent( TPopEvent( node.Vertex, node.FrontId ) );
-
-    // Process actual vertex
-    if( this->_IsMarked( node.Vertex ) )
-      continue;
-    this->_Mark( node );
-    this->_UpdateResult( node );
-    this->InvokeEvent( TMarkEvent( node.Vertex, node.FrontId ) );
-
-    // Add neighbors to queue
-    TNeighborhood neighs = this->m_NeighborhoodFunction->Evaluate( node.Vertex );
-    for( auto it = neighs.begin( ); it != neighs.end( ); ++it )
-    {
-      if( !( this->_IsMarked( *it ) ) )
-      {
-        _TQueueNode neigh( *it, node );
-        if( this->_UpdateValue( neigh, node ) )
-        {
-          this->_QueuePush( neigh );
-          this->InvokeEvent( TPushEvent( node.Vertex, node.FrontId ) );
-
-        } // fi
-      }
-      else
-        this->_UpdateCollisions( node.Vertex, *it );
-
-    } // rof
-
-  } // elihw
-  this->_AfterLoop( );
-  this->InvokeEvent( TEndLoopEvent( ) );
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-void fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-_BeforeGenerateData( )
-{
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-void fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-_AfterGenerateData( )
-{
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-void fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-_BeforeLoop( )
-{
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-void fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-_AfterLoop( )
-{
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-bool fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-_ValidLoop( ) const
-{
-  bool r = ( this->_QueueSize( ) > 0 );
-  if( this->m_StopAtOneFront )
-    r &= ( this->m_NumberOfFronts > 0 );
-  return( r );
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-void fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-_UpdateCollisions( const TVertex& a, const TVertex& b )
-{
-  auto ma = this->_GetMark( a );
-  auto mb = this->_GetMark( b );
-  if( ma == mb || ma == 0 || mb == 0 )
-    return;
-
-  // Mark collision, if it is new
-  ma--; mb--;
-  bool ret = false;
-  bool exists = this->m_Collisions[ ma ][ mb ].second;
-  exists     &= this->m_Collisions[ mb ][ ma ].second;
-  if( !exists )
-  {
-    this->m_Collisions[ ma ][ mb ].first = a;
-    this->m_Collisions[ ma ][ mb ].second = true;
-    this->m_Collisions[ mb ][ ma ].first = b;
-    this->m_Collisions[ mb ][ ma ].second = true;
-
-    // Update number of fronts
-    unsigned long N = this->m_Seeds.size( );
-    unsigned long count = 0;
-    std::vector< bool > m( N, false );
-    std::queue< unsigned long > q;
-    q.push( 0 );
-    while( !q.empty( ) )
-    {
-      unsigned long f = q.front( );
-      q.pop( );
-
-      if( m[ f ] )
-        continue;
-      m[ f ] = true;
-      count++;
-
-      for( unsigned int n = 0; n < N; ++n )
-        if( this->m_Collisions[ f ][ n ].second && !m[ n ] )
-          q.push( n );
-
-    } // elihw
-    this->m_NumberOfFronts = N - count;
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-template < class _TFilter, class _TVertex, class _TOutput >
-_TOutput fpa::Base::Algorithm< _TFilter, _TVertex, _TOutput >::
-_GetInputValue( const _TQueueNode& v, const _TQueueNode& p )
-{
-  _TOutput res = this->m_InitResult;
-  if( this->m_VertexFunction.IsNotNull( ) )
-    res = this->m_VertexFunction->Evaluate( v.Vertex, p.Vertex );
-  if( this->m_ConversionFunction.IsNotNull( ) )
-    res = this->m_ConversionFunction->Evaluate( res );
-  return( res );
-}
-
-#endif // __fpa__Base__Algorithm__hxx__
-
-// eof - $RCSfile$
index 08c704e83b9b7d019eafd6904be1b68158d8e771..d231c7c41da897886b69c63d97f0fca117908646 100644 (file)
@@ -1,7 +1,14 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Base__Dijkstra__h__
 #define __fpa__Base__Dijkstra__h__
 
-#include <fpa/Base/PriorityQueueAlgorithm.h>
+#include <itkFunctionBase.h>
+#include <fpa/Base/MinimumSpanningTree.h>
+#include <fpa/Base/Functors/VertexParentBase.h>
 
 namespace fpa
 {
@@ -9,47 +16,75 @@ namespace fpa
   {
     /**
      */
-    template< class _TSuperclass, class _TMST >
+    template< class _TFilter, class _TMarksInterface, class _TSeedsInterface, class _TMST >
     class Dijkstra
-      : public fpa::Base::PriorityQueueAlgorithm< _TSuperclass >
+      : public _TFilter,
+        public _TMarksInterface,
+        public _TSeedsInterface
     {
     public:
-      typedef Dijkstra                                          Self;
-      typedef fpa::Base::PriorityQueueAlgorithm< _TSuperclass > Superclass;
-      typedef itk::SmartPointer< Self >                         Pointer;
-      typedef itk::SmartPointer< const Self >                   ConstPointer;
-
-      typedef _TMST TMST;
-      typedef typename Superclass::TOutput TOutput;
-      typedef typename Superclass::TVertex TVertex;
+      typedef Dijkstra                        Self;
+      typedef _TFilter                        Superclass;
+      typedef _TMarksInterface                TMarksInterface;
+      typedef _TSeedsInterface                TSeedsInterface;
+      typedef _TMST                           TMST;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef typename Superclass::TInputValue  TInputValue;
+      typedef typename Superclass::TOutputValue TOutputValue;
+      typedef typename Superclass::TVertex      TVertex;
+      typedef typename Superclass::TVertices    TVertices;
+
+      typedef itk::FunctionBase< TInputValue, TOutputValue > TIntensityFunctor;
+      typedef fpa::Base::Functors::VertexParentBase< TVertex, TOutputValue > TVertexFunctor;
 
     protected:
-      typedef typename Superclass::_TQueueNode _TQueueNode;
+      struct _TNode
+      {
+        TVertex Vertex;
+        TVertex Parent;
+        TOutputValue Cost;
+        unsigned long FrontId;
+        _TNode( const TVertex& v, const TVertex& p, const unsigned long& fId )
+          {
+            this->Vertex = v;
+            this->Parent = p;
+            this->FrontId = fId;
+            this->Cost = TOutputValue( 0 );
+          }
+        bool operator<( const _TNode& b ) const
+          {
+            return( b.Cost < this->Cost );
+          }
+      };
 
     public:
-      itkTypeMacro( Dijkstra, Algorithm );
+      itkTypeMacro( Dijkstra, TFilter );
 
     public:
-      _TMST* GetMinimumSpanningTree( );
-      const _TMST* GetMinimumSpanningTree( ) const;
+      TMST* GetMinimumSpanningTree( );
+      const TMST* GetMinimumSpanningTree( ) const;
+
+      const TIntensityFunctor* GetIntensityFunctor( ) const;
+      const TVertexFunctor* GetVertexFunctor( ) const;
+
+      void SetFunctor( TIntensityFunctor* functor );
+      void SetFunctor( TVertexFunctor* functor );
 
     protected:
       Dijkstra( );
       virtual ~Dijkstra( );
 
-      virtual void _AfterGenerateData( ) override;
-
-      virtual void _UpdateResult( const _TQueueNode& n ) override;
-      virtual bool _UpdateValue(
-        _TQueueNode& v, const _TQueueNode& p
-        ) override;
+      virtual void GenerateData( ) override;
 
     private:
-      // Purposely not defined
       Dijkstra( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
+      typename TIntensityFunctor::Pointer m_IntensityFunctor;
+      typename TVertexFunctor::Pointer m_VertexFunctor;
       unsigned long m_MSTIndex;
     };
 
index df9c75e5d07cbc994b5a4db3966bd879eabdfcc4..149363d64128543dd1bfa29de9edd04cf2b8cac3 100644 (file)
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Base__Dijkstra__hxx__
 #define __fpa__Base__Dijkstra__hxx__
 
-#include <algorithm>
-#include <limits>
-
 // -------------------------------------------------------------------------
-template< class _TSuperclass, class _TMST >
-_TMST* fpa::Base::Dijkstra< _TSuperclass, _TMST >::
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface, class _TMST >
+typename
+fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
+TMST* fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
 GetMinimumSpanningTree( )
 {
   return(
-    dynamic_cast< _TMST* >(
+    dynamic_cast< TMST* >(
       this->itk::ProcessObject::GetOutput( this->m_MSTIndex )
       )
     );
 }
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass, class _TMST >
-const _TMST* fpa::Base::Dijkstra< _TSuperclass, _TMST >::
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface, class _TMST >
+const typename
+fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
+TMST* fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
 GetMinimumSpanningTree( ) const
 {
   return(
-    dynamic_cast< const _TMST* >(
+    dynamic_cast< const TMST* >(
       this->itk::ProcessObject::GetOutput( this->m_MSTIndex )
       )
     );
 }
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass, class _TMST >
-fpa::Base::Dijkstra< _TSuperclass, _TMST >::
-Dijkstra( )
-  : Superclass( )
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface, class _TMST >
+const typename
+fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
+TIntensityFunctor*
+fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
+GetIntensityFunctor( ) const
 {
-  this->m_InitResult = TOutput( 0 );
-  this->m_MSTIndex = this->GetNumberOfRequiredOutputs( );
-  this->SetNumberOfRequiredOutputs( this->m_MSTIndex + 1 );
-  this->itk::ProcessObject::SetNthOutput( this->m_MSTIndex, _TMST::New( ) );
+  return( this->m_IntensityFunctor );
 }
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass, class _TMST >
-fpa::Base::Dijkstra< _TSuperclass, _TMST >::
-~Dijkstra( )
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface, class _TMST >
+const typename
+fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
+TVertexFunctor*
+fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
+GetVertexFunctor( ) const
 {
+  return( this->m_VertexFunctor );
 }
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass, class _TMST >
-void fpa::Base::Dijkstra< _TSuperclass, _TMST >::
-_AfterGenerateData( )
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface, class _TMST >
+void fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
+SetFunctor( TIntensityFunctor* functor )
 {
-  this->Superclass::_AfterGenerateData( );
+  if( this->m_IntensityFunctor.GetPointer( ) != functor )
+  {
+    this->m_IntensityFunctor = functor;
+    this->Modified( );
 
-  auto mst = this->GetMinimumSpanningTree( );
-  mst->ClearSeeds( );
-  for( auto s = this->m_Seeds.begin( ); s != this->m_Seeds.end( ); ++s )
-    mst->AddSeed( s->Vertex );
-  mst->SetCollisions( this->m_Collisions );
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass, class _TMST >
-void fpa::Base::Dijkstra< _TSuperclass, _TMST >::
-_UpdateResult( const _TQueueNode& n )
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface, class _TMST >
+void fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
+SetFunctor( TVertexFunctor* functor )
 {
-  this->Superclass::_UpdateResult( n );
-  this->GetMinimumSpanningTree( )->SetParent( n.Vertex, n.Parent );
+  if( this->m_VertexFunctor.GetPointer( ) != functor )
+  {
+    this->m_VertexFunctor = functor;
+    this->Modified( );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass, class _TMST >
-bool fpa::Base::Dijkstra< _TSuperclass, _TMST >::
-_UpdateValue( _TQueueNode& v, const _TQueueNode& p )
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface, class _TMST >
+fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
+Dijkstra( )
+  : Superclass( ),
+    _TMarksInterface( this ),
+    _TSeedsInterface( this )
 {
-  v.Result = this->_GetInputValue( p.Vertex, v.Vertex );
-  if( v.Result >= TOutput( 0 ) )
-  {
-    v.Result += p.Result;
-    return( true );
-  }
-  else
+  this->m_MSTIndex = this->GetNumberOfRequiredOutputs( );
+  this->SetNumberOfRequiredOutputs( this->m_MSTIndex + 1 );
+  this->itk::ProcessObject::SetNthOutput( this->m_MSTIndex, TMST::New( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface, class _TMST >
+fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
+~Dijkstra( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface, class _TMST >
+void fpa::Base::Dijkstra< _TFilter, _TMarksInterface, _TSeedsInterface, _TMST >::
+GenerateData( )
+{
+  // Init objects
+  this->_ConfigureOutputs( TOutputValue( 0 ) );
+  this->_InitMarks( this->GetNumberOfSeeds( ) );
+  TMST* mst = this->GetMinimumSpanningTree( );
+
+  // Init queue
+  std::vector< _TNode > q;
+  unsigned long frontId = 1;
+  for( TVertex seed: this->GetSeeds( ) )
+    q.push_back( _TNode( seed, seed, frontId++ ) );
+
+  // Main loop
+  while( q.size( ) > 0 )
   {
-    v.Result = this->m_InitResult;
-    return( false );
+    // Get next candidate
+    std::pop_heap( q.begin( ), q.end( ) );
+    _TNode node = q.back( );
+    q.pop_back( );
+    if( this->_IsMarked( node.Vertex ) )
+      continue;
+    this->_Mark( node.Vertex, node.FrontId );
 
-  } // fi
+    // Ok, pixel lays inside region
+    this->_SetOutputValue( node.Vertex, node.Cost );
+    mst->SetParent( node.Vertex, node.Parent );
+
+    // Add neighborhood
+    TVertices neighbors = this->_GetNeighbors( node.Vertex );
+    for( TVertex neigh: neighbors )
+    {
+      if( this->_IsMarked( neigh ) )
+      {
+        // Invoke stop at collisions
+        unsigned long nColl = this->_Collisions( node.Vertex, neigh );
+        if(
+          this->StopAtOneFront( ) &&
+          this->GetNumberOfSeeds( ) > 1 &&
+          nColl == 1
+          )
+          q.clear( );
+      }
+      else
+      {
+        // Compute new cost
+        TOutputValue ncost =
+          this->m_VertexFunctor->Evaluate( neigh, node.Vertex );
+        if( this->m_IntensityFunctor.IsNotNull( ) )
+          ncost = this->m_IntensityFunctor->Evaluate( ncost );
+
+        // This algorithm only supports positive values
+        if( ncost >= TOutputValue( 0 ) )
+        {
+          // Insert new node
+          _TNode nn( neigh, node.Vertex, node.FrontId );
+          nn.Cost = node.Cost + ncost;
+          q.push_back( nn );
+          std::push_heap( q.begin( ), q.end( ) );
+
+        } // fi
+
+      } // fi
+
+    } // rof
+
+  } // elihw
+  this->_FreeMarks( );
+
+  // Complete data into minimum spanning tree
+  mst->ClearSeeds( );
+  mst->SetCollisions( this->m_Collisions );
+  for( TVertex seed: this->GetSeeds( ) )
+    mst->AddSeed( seed );
 }
 
 #endif // __fpa__Base__Dijkstra__hxx__
diff --git a/lib/fpa/Base/Events.h b/lib/fpa/Base/Events.h
deleted file mode 100644 (file)
index 17c5564..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef __fpa__Base__Events__h__
-#define __fpa__Base__Events__h__
-
-// -------------------------------------------------------------------------
-#define fpa_Base_NewEvent( name )                               \
-  class name                                                    \
-    : public BaseEvent                                          \
-  {                                                             \
-  public:                                                       \
-    name( ) : BaseEvent( ) { }                                  \
-    virtual ~name( ) { }                                        \
-    const char* GetEventName( ) const                           \
-    { return( "fpa::Base::##name" ); }                          \
-    bool CheckEvent( const itk::EventObject* e ) const          \
-    { return( dynamic_cast< const name* >( e ) != NULL ); }     \
-    itk::EventObject* MakeObject( ) const                       \
-    { return( new name( ) ); }                                  \
-  };
-
-// -------------------------------------------------------------------------
-#define fpa_Base_NewEventWithVertex( name, type )               \
-  class name                                                    \
-    : public BaseEventWithVertex< type >                        \
-  {                                                             \
-  public:                                                       \
-    name( ) : BaseEventWithVertex< type >( ) { }                \
-    name( const type& v, long fid )                             \
-        : BaseEventWithVertex< type >( v, fid ) { }             \
-    virtual ~name( ) { }                                        \
-    const char* GetEventName( ) const                           \
-    { return( "fpa::Base::##name" ); }                          \
-    bool CheckEvent( const itk::EventObject* e ) const          \
-    { return( dynamic_cast< const name* >( e ) != NULL ); }     \
-    itk::EventObject* MakeObject( ) const                       \
-    { return( new name( ) ); }                                  \
-  };
-
-namespace fpa
-{
-  namespace Base
-  {
-    /**
-     */
-    class BaseEvent
-      : public itk::AnyEvent
-    {
-    public:
-      BaseEvent( )
-        : itk::AnyEvent( )
-        { }
-      virtual ~BaseEvent( )
-        { }
-      const char* GetEventName( ) const
-        { return( "fpa::Base::BaseEvent" ); }
-      bool CheckEvent( const itk::EventObject* e ) const
-        { return( dynamic_cast< const BaseEvent* >( e ) != NULL ); }
-      itk::EventObject* MakeObject( ) const
-        { return( new BaseEvent( ) ); }
-    };
-
-    /**
-     */
-    template< class _TVertex >
-    class BaseEventWithVertex
-      : public BaseEvent
-    {
-    public:
-      BaseEventWithVertex( )
-        : BaseEvent( )
-        { }
-      BaseEventWithVertex( const _TVertex& v, long fid )
-        : BaseEvent( ),
-          Vertex( v ),
-          FrontId( fid )
-        { }
-      virtual ~BaseEventWithVertex( )
-        { }
-      const char* GetEventName( ) const
-        { return( "fpa::Base::BaseEventWithVertex" ); }
-      bool CheckEvent( const itk::EventObject* e ) const
-        {
-          return(
-            dynamic_cast< const BaseEventWithVertex< _TVertex >* >( e ) != NULL
-            );
-        }
-      itk::EventObject* MakeObject( ) const
-        { return( new BaseEventWithVertex< _TVertex >( ) ); }
-
-    public:
-      _TVertex Vertex;
-      long     FrontId;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Base__Events__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/FastMarching.h b/lib/fpa/Base/FastMarching.h
deleted file mode 100644 (file)
index acea8e7..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef __fpa__Base__FastMarching__h__
-#define __fpa__Base__FastMarching__h__
-
-#include <fpa/Base/PriorityQueueAlgorithm.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    /**
-     */
-    template< class _TSuperclass >
-    class FastMarching
-      : public fpa::Base::PriorityQueueAlgorithm< _TSuperclass >
-    {
-    public:
-      typedef FastMarching                                      Self;
-      typedef fpa::Base::PriorityQueueAlgorithm< _TSuperclass > Superclass;
-      typedef itk::SmartPointer< Self >                         Pointer;
-      typedef itk::SmartPointer< const Self >                   ConstPointer;
-
-      typedef typename Superclass::TFrontId TFrontId;
-      typedef typename Superclass::TOutput  TOutput;
-      typedef typename Superclass::TVertex  TVertex;
-
-      typedef std::pair< TVertex, double >         TFastMarchingNeighbor;
-      typedef std::vector< TFastMarchingNeighbor > TFastMarchingNeighborhood;
-
-    protected:
-      typedef typename Superclass::_TQueueNode _TQueueNode;
-
-    public:
-      itkTypeMacro( FastMarching, Algorithm );
-
-    protected:
-      FastMarching( );
-      virtual ~FastMarching( );
-
-      virtual TFastMarchingNeighborhood _FastMarchingNeighbors( const TVertex& v ) const = 0;
-
-      virtual bool _UpdateValue( _TQueueNode& v, const _TQueueNode& p ) override;
-
-    private:
-      // Purposely not defined
-      FastMarching( const Self& other );
-      Self& operator=( const Self& other );
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/FastMarching.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__FastMarching__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/FastMarching.hxx b/lib/fpa/Base/FastMarching.hxx
deleted file mode 100644 (file)
index 0fe1cb2..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef __fpa__Base__FastMarching__hxx__
-#define __fpa__Base__FastMarching__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-fpa::Base::FastMarching< _TSuperclass >::
-FastMarching( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-fpa::Base::FastMarching< _TSuperclass >::
-~FastMarching( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-bool fpa::Base::FastMarching< _TSuperclass >::
-_UpdateValue( _TQueueNode& v, const _TQueueNode& p )
-{
-  // Compute quadratic coefficients
-  double a = double( 0 );
-  double b = double( 0 );
-  double c = double( 0 );
-  TFastMarchingNeighborhood neighs = this->_FastMarchingNeighbors( v.Vertex );
-  for( unsigned int i = 0; i < neighs.size( ); i += 2 )
-  {
-    double tn = double( this->_GetResult( neighs[ i ].first ) );
-    double tp = double( this->_GetResult( neighs[ i + 1 ].first ) );
-    double dd = double( 0 );
-    double td = this->m_InitResult;
-    if( tn < tp )
-    {
-      td = tn;
-      dd = neighs[ i ].second;
-    }
-    else
-    {
-      td = tp;
-      dd = neighs[ i + 1 ].second;
-
-    } // fi
-
-    if( td < double( this->m_InitResult ) )
-    {
-      dd = double( 1 ) / ( dd * dd );
-      a += dd;
-      b += td * dd;
-      c += td * td * dd;
-
-    } // fi
-
-  } // rof
-  double F = double( this->_GetInputValue( v, p ) );
-  c -= double( 1 ) / ( F * F );
-
-  // Solve quadratic equation
-  double d = ( b * b ) - ( a * c );
-  if( d >= double( 0 ) )
-  {
-    d = std::sqrt( d );
-    b *= double( -1 );
-    double s1 = std::fabs( ( b + d ) / a );
-    double s2 = std::fabs( ( b - d ) / a );
-    v.Result = TOutput( ( s2 < s1 )? s1: s2 );
-    if( v.Result < this->_GetResult( v.Vertex ) )
-      this->_UpdateResult( v );
-  }
-  else
-  {
-    std::cout << std::endl << "-- FM --> " << v.Vertex << " " << d << std::endl;
-    std::exit( 1 );
-  }
-  return( true );
-}
-
-#endif // __fpa__Base__FastMarching__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Functors/GaussianModel.h b/lib/fpa/Base/Functors/GaussianModel.h
deleted file mode 100644 (file)
index 8d32f51..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef __fpa__Base__Functors__GaussianModel__h__
-#define __fpa__Base__Functors__GaussianModel__h__
-
-#include <fpa/Config.h>
-#include <itkFunctionBase.h>
-#include <cpExtensions/Algorithms/IterativeGaussianModelEstimator.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    namespace Functors
-    {
-      /**
-       */
-      template< class _TInput, class _TOutput >
-      class GaussianModel
-        : public itk::FunctionBase< _TInput, _TOutput >
-      {
-      public:
-        typedef GaussianModel                                Self;
-        typedef itk::FunctionBase< _TInput, _TOutput > Superclass;
-        typedef itk::SmartPointer< Self >              Pointer;
-        typedef itk::SmartPointer< const Self >        ConstPointer;
-
-        typedef _TInput  TInput;
-        typedef _TOutput TOutput;
-
-        // Model estimator
-        typedef
-        cpExtensions::Algorithms::IterativeGaussianModelEstimator< TOutput, 1 >
-        TModel;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( GaussianModel, itk::FunctionBase );
-
-        /* TODO
-           itkGetConstMacro( SupportSize, unsigned int );
-           itkGetConstMacro( MinimumCost, TOutput );
-           itkGetObjectMacro( Model, TModel );
-           itkGetConstObjectMacro( Model, TModel );
-           itkSetMacro( SupportSize, unsigned int );
-           itkSetMacro( MinimumCost, TOutput );
-        */
-
-      public:
-        virtual TOutput Evaluate( const TInput& x ) const override;
-
-      protected:
-        GaussianModel( );
-        virtual ~GaussianModel( );
-
-      private:
-        // Purposely not implemented
-        GaussianModel( const Self& other );
-        Self& operator=( const Self& other );
-
-      protected:
-        /* TODO
-           unsigned int m_SupportSize;
-           TOutput m_MinimumCost;
-           typename TModel::Pointer m_Model;
-        */
-        mutable double m_S1;
-        mutable double m_S2;
-        mutable unsigned long m_N;
-      };
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/Functors/GaussianModel.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__Functors__GaussianModel__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Functors/GaussianModel.hxx b/lib/fpa/Base/Functors/GaussianModel.hxx
deleted file mode 100644 (file)
index 6a44ff8..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef __fpa__Base__Functors__GaussianModel__hxx__
-#define __fpa__Base__Functors__GaussianModel__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TInput, class _TOutput >
-typename fpa::Base::Functors::GaussianModel< _TInput, _TOutput >::
-TOutput fpa::Base::Functors::GaussianModel< _TInput, _TOutput >::
-Evaluate( const TInput& x ) const
-{
-  double v = double( x );
-  double d = double( 0 );
-  if( this->m_N > 1 )
-  {
-    double N = double( this->m_N );
-    double m = this->m_S1 / N;
-    double s =
-      ( this->m_S2 - ( ( this->m_S1 * this->m_S1 ) / N ) ) /
-      ( N - double( 1 ) );
-    if( s > double( 0 ) )
-    {
-      d = ( v - m );
-      d *= d;
-      d /= s;
-      d = std::sqrt( d );
-      if( d <= double( 1.5 ) ) // 2sigma
-      {
-        this->m_S1 += v;
-        this->m_S2 += v * v;
-        this->m_N += 1;
-
-      } // fi
-    }
-    else
-    {
-      this->m_S1 += v;
-      this->m_S2 += v * v;
-      this->m_N += 1;
-
-    } // fi
-  }
-  else
-  {
-    this->m_S1 += v;
-    this->m_S2 += v * v;
-    this->m_N += 1;
-
-  } // fi
-  return( d );
-
-  /* TODO
-     TOutput r = TOutput( 0 );
-     if( this->m_Model->GetNumberOfSamples( ) > this->m_SupportSize )
-     {
-     r = this->m_Model->SquaredMahalanobis( TOutput( x ) );
-     if( r <= TOutput( 1 ) )
-     this->m_Model->AddSample( TOutput( x ) );
-     }
-     else
-     {
-     this->m_Model->AddSample( TOutput( x ) );
-     if( this->m_Model->GetNumberOfSamples( ) > 2 )
-     r = this->m_Model->SquaredMahalanobis( TOutput( x ) );
-
-     } // fi
-     if( r < this->m_MinimumCost )
-     return( this->m_MinimumCost );
-     else
-     return( r );
-  */
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput, class _TOutput >
-fpa::Base::Functors::GaussianModel< _TInput, _TOutput >::
-GaussianModel( )
-  : Superclass( )
-  /* TODO
-     ,
-     m_SupportSize( 30 ),
-     m_MinimumCost( TOutput( 1e-10 ) )
-  */
-{
-  /* TODO
-     this->m_Model = TModel::New( );
-  */
-  this->m_S1 = double( 0 );
-  this->m_S2 = double( 0 );
-  this->m_N = 0;
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput, class _TOutput >
-fpa::Base::Functors::GaussianModel< _TInput, _TOutput >::
-~GaussianModel( )
-{
-}
-
-#endif // __fpa__Base__Functors__GaussianModel__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Functors/Inverse.h b/lib/fpa/Base/Functors/Inverse.h
deleted file mode 100644 (file)
index af68022..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef __fpa__Base__Functors__Inverse__h__
-#define __fpa__Base__Functors__Inverse__h__
-
-#include <fpa/Config.h>
-#include <itkFunctionBase.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    namespace Functors
-    {
-      /**
-       */
-      template< class _TInput, class _TOutput >
-      class Inverse
-        : public itk::FunctionBase< _TInput, _TOutput >
-      {
-      public:
-        typedef Inverse                                Self;
-        typedef itk::FunctionBase< _TInput, _TOutput > Superclass;
-        typedef itk::SmartPointer< Self >              Pointer;
-        typedef itk::SmartPointer< const Self >        ConstPointer;
-
-        typedef _TInput  TInput;
-        typedef _TOutput TOutput;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( Inverse, itk::FunctionBase );
-
-        itkGetConstMacro( NegativeValue, _TOutput );
-        itkSetMacro( NegativeValue, _TOutput );
-
-      public:
-        virtual TOutput Evaluate( const TInput& x ) const override;
-
-      protected:
-        Inverse( );
-        virtual ~Inverse( );
-
-      private:
-        // Purposely not implemented
-        Inverse( const Self& other );
-        Self& operator=( const Self& other );
-
-      protected:
-        _TOutput m_NegativeValue;
-      };
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/Functors/Inverse.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__Functors__Inverse__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Functors/Inverse.hxx b/lib/fpa/Base/Functors/Inverse.hxx
deleted file mode 100644 (file)
index 4574cae..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef __fpa__Base__Functors__Inverse__hxx__
-#define __fpa__Base__Functors__Inverse__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TInput, class _TOutput >
-typename fpa::Base::Functors::Inverse< _TInput, _TOutput >::
-TOutput fpa::Base::Functors::Inverse< _TInput, _TOutput >::
-Evaluate( const TInput& x ) const
-{
-  TInput sign = TInput( ( x < TInput( 0 ) )? -1: 1 );
-  TOutput y = TOutput( 1 ) / ( TOutput( 1 ) + TOutput( x * sign ) );
-  if( sign < TInput( 0 ) )
-    return( y * this->m_NegativeValue );
-  else
-    return( y );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput, class _TOutput >
-fpa::Base::Functors::Inverse< _TInput, _TOutput >::
-Inverse( )
-  : Superclass( ),
-    m_NegativeValue( _TOutput( -1 ) )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput, class _TOutput >
-fpa::Base::Functors::Inverse< _TInput, _TOutput >::
-~Inverse( )
-{
-}
-
-#endif // __fpa__Base__Functors__Inverse__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Functors/InvertValue.h b/lib/fpa/Base/Functors/InvertValue.h
new file mode 100644 (file)
index 0000000..9da3221
--- /dev/null
@@ -0,0 +1,80 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__Functors__InvertValue__h__
+#define __fpa__Base__Functors__InvertValue__h__
+
+#include <cmath>
+#include <itkFunctionBase.h>
+
+namespace fpa
+{
+  namespace Base
+  {
+    namespace Functors
+    {
+      /**
+       */
+      template< class _TInputValue, class _TOutputValue >
+      class InvertValue
+        : public itk::FunctionBase< _TInputValue, _TOutputValue >
+      {
+      public:
+        typedef InvertValue                                      Self;
+        typedef itk::FunctionBase< _TInputValue, _TOutputValue > Superclass;
+        typedef itk::SmartPointer< Self >                        Pointer;
+        typedef itk::SmartPointer< const Self >                  ConstPointer;
+
+        typedef _TInputValue  TInputValue;
+        typedef _TOutputValue TOutputValue;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro( InvertValue, itk::FunctionBase );
+
+        itkGetConstMacro( Alpha, double );
+        itkGetConstMacro( Beta, double );
+        itkSetMacro( Alpha, double );
+        itkSetMacro( Beta, double );
+
+      public:
+        virtual TOutputValue Evaluate( const TInputValue& a ) const override
+          {
+            double d = this->m_Alpha;
+            d += std::pow( double( a ), this->m_Beta );
+            double x = -1;
+            if( std::fabs( d ) > double( 0 ) )
+              x =
+                double( 1 ) /
+                ( this->m_Alpha + std::pow( double( a ), this->m_Beta ) );
+            return( TOutputValue( x ) );
+          }
+
+      protected:
+        InvertValue( )
+          : Superclass( ),
+            m_Alpha( double( 1 ) ),
+            m_Beta( double( 1 ) )
+          { }
+        virtual ~InvertValue( ) { }
+
+      private:
+        InvertValue( const Self& other );
+        Self& operator=( const Self& other );
+
+      protected:
+        double m_Alpha;
+        double m_Beta;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Base__Functors__InvertValue__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Base/Functors/RegionGrow/Base.h b/lib/fpa/Base/Functors/RegionGrow/Base.h
deleted file mode 100644 (file)
index d2c37aa..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef __fpa__Base__Functors__RegionGrow__Base__h__
-#define __fpa__Base__Functors__RegionGrow__Base__h__
-
-#include <itkObject.h>
-#include <itkObjectFactory.h>
-#include <fpa/Base/Functors/VertexCostFunctionBase.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    namespace Functors
-    {
-      namespace RegionGrow
-      {
-        /**
-         */
-        template< class _TVertex, class _TOutput >
-        class Base
-          : public fpa::Base::Functors::VertexCostFunctionBase< _TVertex, _TOutput >
-        {
-        public:
-          typedef fpa::Base::Functors::VertexCostFunctionBase< _TVertex, _TOutput > Superclass;
-          typedef Base                            Self;
-          typedef itk::SmartPointer< Self >       Pointer;
-          typedef itk::SmartPointer< const Self > ConstPointer;
-
-          typedef _TVertex TVertex;
-          typedef _TOutput TOutput;
-
-        public:
-          itkTypeMacro( Base, itk::Object );
-
-          itkGetConstMacro( InsideValue, _TOutput );
-          itkGetConstMacro( OutsideValue, _TOutput );
-
-          itkSetMacro( InsideValue, _TOutput );
-          itkSetMacro( OutsideValue, _TOutput );
-
-        public:
-          virtual TOutput Evaluate( const TVertex& a, const TVertex& b ) const = 0;
-
-        protected:
-          Base( )
-            : Superclass( ),
-              m_InsideValue( TOutput( 1 ) ),
-              m_OutsideValue( TOutput( 0 ) )
-            { }
-          virtual ~Base( )
-            { }
-
-        private:
-          // Purposely not defined
-          Base( const Self& other );
-          Self& operator=( const Self& other );
-
-        protected:
-          _TOutput m_InsideValue;
-          _TOutput m_OutsideValue;
-        };
-
-      } // ecapseman
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Base__Functors__RegionGrow__Base__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Functors/RegionGrow/Tautology.h b/lib/fpa/Base/Functors/RegionGrow/Tautology.h
deleted file mode 100644 (file)
index 11d016e..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef __fpa__Base__Functors__RegionGrow__Tautology__h__
-#define __fpa__Base__Functors__RegionGrow__Tautology__h__
-
-#include <fpa/Base/Functors/RegionGrow/Base.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    namespace Functors
-    {
-      namespace RegionGrow
-      {
-        /**
-         */
-        template< class _TVertex, class _TOutput >
-        class Tautology
-          : public Base< _TVertex, _TOutput >
-        {
-        public:
-          typedef Tautology                       Self;
-          typedef Base< _TVertex, _TOutput >      Superclass;
-          typedef itk::SmartPointer< Self >       Pointer;
-          typedef itk::SmartPointer< const Self > ConstPointer;
-
-          typedef typename Superclass::TOutput TOutput;
-          typedef typename Superclass::TVertex TVertex;
-
-        public:
-          itkNewMacro( Self );
-          itkTypeMacro( Tautology, Base );
-
-        public:
-          virtual TOutput Evaluate( const TVertex& a, const TVertex& b ) const override
-            {
-              return( this->m_InsideValue );
-            }
-
-        protected:
-          Tautology( )
-            : Superclass( )
-            { }
-          virtual ~Tautology( )
-            { }
-
-        private:
-          // Purposely not defined
-          Tautology( const Self& other );
-          Self& operator=( const Self& other );
-        };
-
-      } // ecapseman
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Base__Functors__RegionGrow__Tautology__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Functors/VertexCostFunctionBase.h b/lib/fpa/Base/Functors/VertexCostFunctionBase.h
deleted file mode 100644 (file)
index 12f5c24..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef __fpa__Base__Functors__VertexCostFunctionBase__h__
-#define __fpa__Base__Functors__VertexCostFunctionBase__h__
-
-#include <itkObject.h>
-#include <itkObjectFactory.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    namespace Functors
-    {
-      /**
-       */
-      template< class _TVertex, class _TOutput >
-      class VertexCostFunctionBase
-        : public itk::Object
-      {
-      public:
-        typedef VertexCostFunctionBase          Self;
-        typedef itk::Object                     Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef _TVertex TVertex;
-        typedef _TOutput TOutput;
-
-      public:
-        itkTypeMacro( VertexCostFunctionBase, itk::Object );
-
-      public:
-        virtual TOutput Evaluate( const TVertex& a, const TVertex& b ) const = 0;
-
-      protected:
-        VertexCostFunctionBase( )
-          : Superclass( )
-          { }
-        virtual ~VertexCostFunctionBase( )
-          { }
-
-      private:
-        // Purposely not defined
-        VertexCostFunctionBase( const Self& other );
-        Self& operator=( const Self& other );
-      };
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Base__Functors__VertexCostFunctionBase__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Functors/VertexParentBase.h b/lib/fpa/Base/Functors/VertexParentBase.h
new file mode 100644 (file)
index 0000000..2725063
--- /dev/null
@@ -0,0 +1,58 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__Functors__VertexParentBase__h__
+#define __fpa__Base__Functors__VertexParentBase__h__
+
+#include <itkObject.h>
+#include <itkObjectFactory.h>
+
+namespace fpa
+{
+  namespace Base
+  {
+    namespace Functors
+    {
+      /**
+       */
+      template< class _TVertex, class _TOutputValue >
+      class VertexParentBase
+        : public itk::Object
+      {
+      public:
+        typedef VertexParentBase                Self;
+        typedef itk::Object                     Superclass;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+
+        typedef _TVertex      TVertex;
+        typedef _TOutputValue TOutputValue;
+
+      public:
+        itkTypeMacro( VertexParentBase, TFilter );
+
+      public:
+        virtual TOutputValue Evaluate( const TVertex& v, const TVertex& p ) const = 0;
+
+      protected:
+        VertexParentBase( )
+          : Superclass( )
+          { }
+        virtual ~VertexParentBase( ) { }
+
+      private:
+        VertexParentBase( const Self& other );
+        Self& operator=( const Self& other );
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Base__Functors__VertexParentBase__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Base/MarksInterface.h b/lib/fpa/Base/MarksInterface.h
new file mode 100644 (file)
index 0000000..b0fae74
--- /dev/null
@@ -0,0 +1,66 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__MarksInterface__h__
+#define __fpa__Base__MarksInterface__h__
+
+#include <itkProcessObject.h>
+#include <vector>
+
+namespace fpa
+{
+  namespace Base
+  {
+    /**
+     */
+    template< class _TVertex >
+    class MarksInterface
+    {
+    public:
+      typedef _TVertex       TVertex;
+      typedef MarksInterface Self;
+
+      // Minigraph to represent collisions
+      typedef std::pair< _TVertex, bool >   TCollision;
+      typedef std::vector< TCollision >     TCollisionsRow;
+      typedef std::vector< TCollisionsRow > TCollisions;
+
+    public:
+      bool StopAtOneFront( ) const;
+      void StopAtOneFrontOn( );
+      void StopAtOneFrontOff( );
+      void SetStopAtOneFront( bool v );
+
+    protected:
+      MarksInterface( itk::ProcessObject* filter );
+      virtual ~MarksInterface( );
+
+      virtual bool _IsMarked( const TVertex& v ) const = 0;
+      virtual unsigned long _GetMark( const TVertex& v ) const = 0;
+      virtual void _Mark( const TVertex& v, unsigned long frontId ) = 0;
+      virtual void _FreeMarks( ) = 0;
+
+      virtual void _InitMarks( unsigned long nSeeds );
+      unsigned long _Collisions( const TVertex& a, const TVertex& b );
+
+    protected:
+      bool m_StopAtOneFront;
+      TCollisions m_Collisions;
+      unsigned int m_NumberOfFronts;
+      unsigned int m_NumberOfSeeds;
+      itk::ProcessObject* m_Filter;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Base/MarksInterface.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Base__MarksInterface__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Base/MarksInterface.hxx b/lib/fpa/Base/MarksInterface.hxx
new file mode 100644 (file)
index 0000000..56de375
--- /dev/null
@@ -0,0 +1,129 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__MarksInterface__hxx__
+#define __fpa__Base__MarksInterface__hxx__
+
+#include <queue>
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+bool fpa::Base::MarksInterface< _TVertex >::
+StopAtOneFront( ) const
+{
+  return( this->m_StopAtOneFront );
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+void fpa::Base::MarksInterface< _TVertex >::
+StopAtOneFrontOn( )
+{
+  this->SetStopAtOneFront( true );
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+void fpa::Base::MarksInterface< _TVertex >::
+StopAtOneFrontOff( )
+{
+  this->SetStopAtOneFront( false );
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+void fpa::Base::MarksInterface< _TVertex >::
+SetStopAtOneFront( bool v )
+{
+  if( this->m_StopAtOneFront != v )
+  {
+    this->m_StopAtOneFront = v;
+    if( this->m_Filter != NULL )
+      this->m_Filter->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+fpa::Base::MarksInterface< _TVertex >::
+MarksInterface( itk::ProcessObject* filter )
+  : m_StopAtOneFront( false ),
+    m_NumberOfFronts( 0 ),
+    m_NumberOfSeeds( 0 ),
+    m_Filter( filter )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+fpa::Base::MarksInterface< _TVertex >::
+~MarksInterface( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+void fpa::Base::MarksInterface< _TVertex >::
+_InitMarks( unsigned long nSeeds )
+{
+  this->m_NumberOfFronts = this->m_NumberOfSeeds = nSeeds;
+  TCollision coll( TVertex( ), false );
+  TCollisionsRow row( this->m_NumberOfFronts, coll );
+  this->m_Collisions.clear( );
+  this->m_Collisions.resize( this->m_NumberOfFronts, row );
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex >
+unsigned long fpa::Base::MarksInterface< _TVertex >::
+_Collisions( const TVertex& a, const TVertex& b )
+{
+  auto ma = this->_GetMark( a );
+  auto mb = this->_GetMark( b );
+  if( ma == mb || ma == 0 || mb == 0 )
+    return( this->m_NumberOfFronts );
+
+  // Mark collision, if it is new
+  ma--; mb--;
+  bool ret = false;
+  bool exists = this->m_Collisions[ ma ][ mb ].second;
+  exists     &= this->m_Collisions[ mb ][ ma ].second;
+  if( !exists )
+  {
+    this->m_Collisions[ ma ][ mb ].first = a;
+    this->m_Collisions[ ma ][ mb ].second = true;
+    this->m_Collisions[ mb ][ ma ].first = b;
+    this->m_Collisions[ mb ][ ma ].second = true;
+
+    // Update number of fronts
+    unsigned long count = 0;
+    std::vector< bool > m( this->m_NumberOfSeeds, false );
+    std::queue< unsigned long > q;
+    q.push( 0 );
+    while( !q.empty( ) )
+    {
+      unsigned long f = q.front( );
+      q.pop( );
+
+      if( m[ f ] )
+        continue;
+      m[ f ] = true;
+      count++;
+
+      for( unsigned int n = 0; n < this->m_NumberOfSeeds; ++n )
+        if( this->m_Collisions[ f ][ n ].second && !m[ n ] )
+          q.push( n );
+
+    } // elihw
+    this->m_NumberOfFronts = this->m_NumberOfSeeds - count;
+
+  } // fi
+  return( this->m_NumberOfFronts );
+}
+
+#endif // __fpa__Base__MarksInterface__hxx__
+
+// eof - $RCSfile$
index 03940f140a18300af6866b9b9b1ffbb519600f48..35cb6e4c0488616d700ab6c49547f93e146910a6 100644 (file)
@@ -1,10 +1,12 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Base__MinimumSpanningTree__h__
 #define __fpa__Base__MinimumSpanningTree__h__
 
-#include <fpa/Config.h>
 #include <vector>
-#include <utility>
-#include <itkObject.h>
 
 namespace fpa
 {
@@ -12,59 +14,54 @@ namespace fpa
   {
     /**
      */
-    template< class _TVertex, class _TPath, class _TSuperclass >
+    template< class _TVertex, class _Superclass >
     class MinimumSpanningTree
-      : public _TSuperclass
+      : public _Superclass
     {
     public:
       typedef MinimumSpanningTree             Self;
-      typedef _TSuperclass                    Superclass;
+      typedef _Superclass                     Superclass;
       typedef itk::SmartPointer< Self >       Pointer;
       typedef itk::SmartPointer< const Self > ConstPointer;
 
       typedef _TVertex                      TVertex;
-      typedef _TPath                        TPath;
-      typedef std::pair< _TVertex, bool >   TCollision;
+      typedef std::pair< TVertex, bool >    TCollision;
       typedef std::vector< TCollision >     TCollisionsRow;
       typedef std::vector< TCollisionsRow > TCollisions;
+      typedef std::vector< TVertex >        TVertices;
 
     protected:
       typedef std::vector< unsigned long > _TRow;
       typedef std::vector< _TRow >         _TMatrix;
 
     public:
-      itkTypeMacro( MinimumSpanningTree, _TSuperclass );
+      itkTypeMacro( fpa::Base::MinimumSpanningTree, _Superclass );
 
     public:
       const TCollisions& GetCollisions( ) const;
       void SetCollisions( const TCollisions& collisions );
 
       void ClearSeeds( );
-      void AddSeed( const _TVertex& seed );
+      void AddSeed( const TVertex& seed );
 
-      virtual _TVertex GetParent( const _TVertex& v ) const = 0;
-      virtual void SetParent( const _TVertex& v, const _TVertex& p ) = 0;
+      virtual TVertex GetParent( const TVertex& v ) const = 0;
+      virtual void SetParent( const TVertex& v, const TVertex& p ) = 0;
 
-      virtual void GetPath(
-        typename _TPath::Pointer& path, const _TVertex& a
-        ) const;
-      virtual void GetPath(
-        typename _TPath::Pointer& path, const _TVertex& a, const _TVertex& b
-        ) const;
+      virtual TVertices GetPath( const TVertex& a ) const;
+      virtual TVertices GetPath( const TVertex& a, const TVertex& b ) const;
 
     protected:
       MinimumSpanningTree( );
       virtual ~MinimumSpanningTree( );
 
     private:
-      // Purposely not defined
       MinimumSpanningTree( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
       TCollisions m_Collisions;
       _TMatrix    m_FrontPaths;
-      std::vector< _TVertex > m_Seeds;
+      std::vector< TVertex > m_Seeds;
     };
 
   } // ecapseman
index e8ed6a2c286e94b5701e022531a9e418a105cec1..c5838f319be7784e4d949796aee058ac1d442a75 100644 (file)
@@ -1,22 +1,23 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Base__MinimumSpanningTree__hxx__
 #define __fpa__Base__MinimumSpanningTree__hxx__
 
-#include <limits>
-
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPath, class _TSuperclass >
-const typename
-fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
-TCollisions&
-fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
+template< class _TVertex, class _Superclass >
+const typename fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+TCollisions& fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
 GetCollisions( ) const
 {
   return( this->m_Collisions );
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPath, class _TSuperclass >
-void fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
+template< class _TVertex, class _Superclass >
+void fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
 SetCollisions( const TCollisions& collisions )
 {
   static const unsigned long _inf =
@@ -80,8 +81,8 @@ SetCollisions( const TCollisions& collisions )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPath, class _TSuperclass >
-void fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
+template< class _TVertex, class _Superclass >
+void fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
 ClearSeeds( )
 {
   this->m_Seeds.clear( );
@@ -89,8 +90,8 @@ ClearSeeds( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPath, class _TSuperclass >
-void fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
+template< class _TVertex, class _Superclass >
+void fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
 AddSeed( const _TVertex& seed )
 {
   this->m_Seeds.push_back( seed );
@@ -98,11 +99,12 @@ AddSeed( const _TVertex& seed )
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPath, class _TSuperclass >
-void fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
-GetPath( typename _TPath::Pointer& path, const _TVertex& a ) const
+template< class _TVertex, class _Superclass >
+typename fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+TVertices fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+GetPath( const _TVertex& a ) const
 {
-  std::vector< _TVertex > vertices;
+  TVertices vertices;
   _TVertex it = a;
   _TVertex p = this->GetParent( it );
   while( it != p )
@@ -113,38 +115,31 @@ GetPath( typename _TPath::Pointer& path, const _TVertex& a ) const
 
   } // elihw
   vertices.push_back( it );
-
-  if( path.IsNull( ) )
-    path = _TPath::New( );
-  for( auto v = vertices.begin( ); v != vertices.end( ); ++v )
-    path->AddVertex( *v );
+  return( vertices );
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPath, class _TSuperclass >
-void fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
-GetPath(
-  typename _TPath::Pointer& path, const _TVertex& a, const _TVertex& b
-  ) const
+template< class _TVertex, class _Superclass >
+typename fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+TVertices fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+GetPath( const _TVertex& a, const _TVertex& b ) const
 {
   static const unsigned long _inf =
     std::numeric_limits< unsigned long >::max( );
 
-  if( path.IsNull( ) )
-    path = _TPath::New( );
-  typename _TPath::Pointer pa, pb;
-  this->GetPath( pa, a );
-  this->GetPath( pb, b );
-  if( pa->GetSize( ) > 0 && pb->GetSize( ) > 0 )
+  TVertices vertices;
+  TVertices pa = this->GetPath( a );
+  TVertices pb = this->GetPath( b );
+  if( pa.size( ) > 0 && pb.size( ) > 0 )
   {
     // Find front identifiers
     unsigned long ia = _inf, ib = _inf;
     unsigned long N = this->m_Seeds.size( );
     for( unsigned long i = 0; i < N; ++i )
     {
-      if( this->m_Seeds[ i ] == pa->GetVertex( pa->GetSize( ) - 1 ) )
+      if( this->m_Seeds[ i ] == pa[ pa.size( ) - 1 ] )
         ia = i;
-      if( this->m_Seeds[ i ] == pb->GetVertex( pb->GetSize( ) - 1 ) )
+      if( this->m_Seeds[ i ] == pb[ pb.size( ) - 1 ] )
         ib = i;
 
     } // rof
@@ -167,45 +162,42 @@ GetPath(
       if( N > 0 )
       {
         // First path: from start vertex to first collision
-        this->GetPath(
-          path, a,
-          this->m_Collisions[ fpath[ 0 ] ][ fpath[ 1 ] ].first
+        vertices = this->GetPath(
+          a, this->m_Collisions[ fpath[ 0 ] ][ fpath[ 1 ] ].first
           );
 
         // Intermediary paths
         for( unsigned int i = 1; i < N - 1; ++i )
         {
-          typename _TPath::Pointer ipath;
-          this->GetPath(
-            ipath,
-            this->m_Collisions[ fpath[ i ] ][ fpath[ i - 1 ] ].first,
-            this->m_Collisions[ fpath[ i ] ][ fpath[ i + 1 ] ].first
-            );
-          for( long id = 0; id < ipath->GetSize( ); ++id )
-            path->AddVertex( ipath->GetVertex( id ) );
+          TVertices ipath =
+            this->GetPath(
+              this->m_Collisions[ fpath[ i ] ][ fpath[ i - 1 ] ].first,
+              this->m_Collisions[ fpath[ i ] ][ fpath[ i + 1 ] ].first
+              );
+          for( long id = 0; id < ipath.size( ); ++id )
+            vertices.push_back( ipath[ id ] );
 
         } // rof
 
         // Final path: from last collision to end point
-        typename _TPath::Pointer lpath;
-        this->GetPath(
-          lpath,
-          this->m_Collisions[ fpath[ N - 1 ] ][ fpath[ N - 2 ] ].first, b
-          );
-        for( long id = 0; id < lpath->GetSize( ); ++id )
-          path->AddVertex( lpath->GetVertex( id ) );
+        TVertices lpath =
+          this->GetPath(
+            this->m_Collisions[ fpath[ N - 1 ] ][ fpath[ N - 2 ] ].first, b
+            );
+        for( long id = 0; id < lpath.size( ); ++id )
+          vertices.push_back( lpath[ id ] );
 
       } // fi
     }
     else
     {
       // Ignore common part: find common ancestor
-      long aIt = pa->GetSize( ) - 1;
-      long bIt = pb->GetSize( ) - 1;
+      long aIt = pa.size( ) - 1;
+      long bIt = pb.size( ) - 1;
       bool cont = true;
       while( aIt >= 0 && bIt >= 0 && cont )
       {
-        cont = ( pa->GetVertex( aIt ) == pb->GetVertex( bIt ) );
+        cont = ( pa[ aIt ] == pb[ bIt ] );
         aIt--;
         bIt--;
 
@@ -215,26 +207,27 @@ GetPath(
 
       // Glue both parts
       for( long cIt = 0; cIt <= aIt; ++cIt )
-        path->AddVertex( pa->GetVertex( cIt ) );
+        vertices.push_back( pa[ cIt ] );
       for( ; bIt >= 0; --bIt )
-        path->AddVertex( pb->GetVertex( bIt ) );
+        vertices.push_back( pb[ bIt ] );
 
     } // fi
 
   } // fi
+  return( vertices );
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPath, class _TSuperclass >
-fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
+template< class _TVertex, class _Superclass >
+fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
 MinimumSpanningTree( )
   : Superclass( )
 {
 }
 
 // -------------------------------------------------------------------------
-template< class _TVertex, class _TPath, class _TSuperclass >
-fpa::Base::MinimumSpanningTree< _TVertex, _TPath, _TSuperclass >::
+template< class _TVertex, class _Superclass >
+fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
 ~MinimumSpanningTree( )
 {
 }
diff --git a/lib/fpa/Base/MoriRegionGrow.h b/lib/fpa/Base/MoriRegionGrow.h
new file mode 100644 (file)
index 0000000..d8f2ee0
--- /dev/null
@@ -0,0 +1,96 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__MoriRegionGrow__h__
+#define __fpa__Base__MoriRegionGrow__h__
+
+namespace fpa
+{
+  namespace Base
+  {
+    /**
+     */
+    template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+    class MoriRegionGrow
+      : public _TFilter,
+        public _TMarksInterface,
+        public _TSeedsInterface
+    {
+    public:
+      typedef MoriRegionGrow                  Self;
+      typedef _TFilter                        Superclass;
+      typedef _TMarksInterface                TMarksInterface;
+      typedef _TSeedsInterface                TSeedsInterface;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef typename Superclass::TInputValue  TInputValue;
+      typedef typename Superclass::TOutputValue TOutputValue;
+      typedef typename Superclass::TVertex      TVertex;
+      typedef typename Superclass::TVertices    TVertices;
+
+      struct TCurveData
+      {
+        TInputValue XValue;
+        unsigned long YValue;
+        double Diff1;
+        TCurveData( TInputValue v, unsigned long c )
+          {
+            this->XValue = v;
+            this->YValue = c;
+            this->Diff1 = double( 0 );
+          }
+      };
+      typedef std::vector< TCurveData > TCurve;
+
+    public:
+      itkTypeMacro( MoriRegionGrow, TFilter );
+
+      itkGetConstMacro( LowerThreshold, TInputValue );
+      itkGetConstMacro( UpperThreshold, TInputValue );
+      itkGetConstMacro( DeltaThreshold, TInputValue );
+      itkGetConstMacro( Curve, TCurve );
+      itkGetConstMacro( OptimumThreshold, TInputValue );
+
+      itkSetMacro( LowerThreshold, TInputValue );
+      itkSetMacro( UpperThreshold, TInputValue );
+      itkSetMacro( DeltaThreshold, TInputValue );
+
+    public:
+      void SetThresholdRange(
+        const TInputValue& lower, const TInputValue& upper,
+        const TInputValue& delta = TInputValue( 1 )
+        );
+
+    protected:
+      MoriRegionGrow( );
+      virtual ~MoriRegionGrow( );
+
+      virtual void GenerateData( ) override;
+
+    private:
+      MoriRegionGrow( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      TInputValue  m_LowerThreshold;
+      TInputValue  m_UpperThreshold;
+      TInputValue  m_DeltaThreshold;
+
+      TCurve m_Curve;
+      TInputValue  m_OptimumThreshold;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Base/MoriRegionGrow.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Base__MoriRegionGrow__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Base/MoriRegionGrow.hxx b/lib/fpa/Base/MoriRegionGrow.hxx
new file mode 100644 (file)
index 0000000..b619bce
--- /dev/null
@@ -0,0 +1,186 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__MoriRegionGrow__hxx__
+#define __fpa__Base__MoriRegionGrow__hxx__
+
+#include <queue>
+#include <itkProgressReporter.h>
+
+// -------------------------------------------------------------------------
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+void
+fpa::Base::MoriRegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
+SetThresholdRange(
+  const TInputValue& lower, const TInputValue& upper,
+  const TInputValue& delta
+  )
+{
+  this->SetLowerThreshold( lower );
+  this->SetUpperThreshold( upper );
+  this->SetDeltaThreshold( delta );
+}
+
+// -------------------------------------------------------------------------
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+fpa::Base::MoriRegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
+MoriRegionGrow( )
+  : Superclass( ),
+    _TMarksInterface( this ),
+    _TSeedsInterface( this )
+{
+  this->m_UpperThreshold = std::numeric_limits< TInputValue >::max( );
+  if( std::numeric_limits< TInputValue >::is_integer )
+    this->m_LowerThreshold = std::numeric_limits< TInputValue >::min( );
+  else
+    this->m_LowerThreshold = -this->m_UpperThreshold;
+  this->m_DeltaThreshold = TInputValue( 1 );
+}
+
+// -------------------------------------------------------------------------
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+fpa::Base::MoriRegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
+~MoriRegionGrow( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+void
+fpa::Base::MoriRegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
+GenerateData( )
+{
+  // Prepare progress counter
+  double prog_size = double( this->m_UpperThreshold - this->m_LowerThreshold );
+  prog_size /= double( this->m_DeltaThreshold );
+  itk::ProgressReporter progress( this, 0, prog_size, 100, 0, 1 );
+
+  // Init objects
+  this->_ConfigureOutputs( std::numeric_limits< TOutputValue >::max( ) );
+  this->_InitMarks( this->GetNumberOfSeeds( ) );
+
+  // Init queues
+  typedef std::pair< TVertex, unsigned long > _TNode;
+  std::queue< _TNode > queues[ 2 ];
+  unsigned long frontId = 1;
+  for( TVertex seed: this->GetSeeds( ) )
+    queues[ 0 ].push( _TNode( seed, frontId++ ) );
+  unsigned int cur_queue = 0;
+  unsigned int aux_queue = 1;
+
+  // Incremental strategy
+  TInputValue upper = this->m_LowerThreshold + this->m_DeltaThreshold;
+  this->m_Curve.clear( );
+  unsigned long count = 0;
+  while( upper <= this->m_UpperThreshold )
+  {
+    // Main growing strategy
+    while( queues[ cur_queue ].size( ) > 0 )
+    {
+      // Get next candidate
+      _TNode node = queues[ cur_queue ].front( );
+      queues[ cur_queue ].pop( );
+      if( this->_IsMarked( node.first ) )
+        continue;
+      this->_Mark( node.first, node.second );
+
+      // Apply inclusion predicate
+      TInputValue value = this->_GetInputValue( node.first );
+      bool in = ( ( this->m_LowerThreshold < value ) && ( value < upper ) );
+      if( !in )
+      {
+        if( value < this->m_UpperThreshold )
+          queues[ aux_queue ].push( node );
+        this->_Mark( node.first, 0 );
+        continue;
+
+      } // fi
+
+      // Ok, value lays inside region
+      this->_SetOutputValue( node.first, this->m_Curve.size( ) + 1 );
+      count++;
+
+      // Add neighborhood
+      TVertices neighbors = this->_GetNeighbors( node.first );
+      for( TVertex neigh: neighbors )
+      {
+        if( this->_IsMarked( neigh ) )
+        {
+          // Invoke stop at collisions
+          unsigned long nColl = this->_Collisions( node.first, neigh );
+          if(
+            this->StopAtOneFront( ) &&
+            this->GetNumberOfSeeds( ) > 1 &&
+            nColl == 1
+            )
+          {
+            while( queues[ 0 ].size( ) > 0 )
+              queues[ 0 ].pop( );
+            while( queues[ 1 ].size( ) > 0 )
+              queues[ 1 ].pop( );
+
+          } // fi
+        }
+        else
+          queues[ cur_queue ].push( _TNode( neigh, node.second ) );
+
+      } // rof
+
+    } // elihw
+
+    // Update curve
+    if( this->m_Curve.size( ) > 0 )
+    {
+      if( this->m_Curve.back( ).YValue < count )
+        this->m_Curve.push_back( TCurveData( upper, count ) );
+      if( this->m_Curve.size( ) > 2 )
+      {
+        long j = this->m_Curve.size( ) - 2;
+        double yp = double( this->m_Curve[ j + 1 ].YValue );
+        double yn = double( this->m_Curve[ j - 1 ].YValue );
+        double xp = double( this->m_Curve[ j + 1 ].XValue );
+        double xn = double( this->m_Curve[ j - 1 ].XValue );
+        this->m_Curve[ j ].Diff1 = ( yp - yn ) / ( xp - xn );
+
+      } // fi
+    }
+    else
+      this->m_Curve.push_back( TCurveData( upper, count ) );
+
+    // Update queue
+    cur_queue = aux_queue;
+    aux_queue = ( cur_queue + 1 ) % 2;
+
+    // Update threshold
+    upper += this->m_DeltaThreshold;
+    progress.CompletedPixel( );
+
+  } // elihw
+
+  // Compute optimum threshold
+  double dmax = -std::numeric_limits< double >::max( );
+  long jmax = 0;
+  for( long j = 1; j < this->m_Curve.size( ) - 1; ++j )
+  {
+    double dp = this->m_Curve[ j + 1 ].Diff1;
+    double dn = this->m_Curve[ j - 1 ].Diff1;
+    double xp = double( this->m_Curve[ j + 1 ].XValue );
+    double xn = double( this->m_Curve[ j - 1 ].XValue );
+    double d2 = ( dp - dn ) / ( xp - xn );
+    if( d2 > dmax )
+    {
+      dmax = d2;
+      jmax = j;
+
+    } // fi
+
+  } // rof
+  this->m_OptimumThreshold = TOutputValue( jmax );
+  this->_FreeMarks( );
+}
+
+#endif // __fpa__Base__MoriRegionGrow__hxx__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Base/PriorityQueueAlgorithm.hxx b/lib/fpa/Base/PriorityQueueAlgorithm.hxx
deleted file mode 100644 (file)
index 11c1408..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef __fpa__Base__PriorityQueueAlgorithm__hxx__
-#define __fpa__Base__PriorityQueueAlgorithm__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
-PriorityQueueAlgorithm( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
-~PriorityQueueAlgorithm( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-unsigned long fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
-_QueueSize( ) const
-{
-  return( this->m_Queue.size( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-void fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
-_QueueClear( )
-{
-  this->m_Queue.clear( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-void fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
-_QueuePush( const _TQueueNode& node )
-{
-  static _TQueueNodeCompare cmp;
-  this->m_Queue.push_back( node );
-  std::push_heap( this->m_Queue.begin( ), this->m_Queue.end( ), cmp );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-typename fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
-_TQueueNode fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
-_QueuePop( )
-{
-  static _TQueueNodeCompare cmp;
-  std::pop_heap( this->m_Queue.begin( ), this->m_Queue.end( ), cmp );
-  _TQueueNode f = this->m_Queue.back( );
-  this->m_Queue.pop_back( );
-  return( f );
-}
-
-#endif // __fpa__Base__PriorityQueueAlgorithm__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/QueueAlgorithm.h b/lib/fpa/Base/QueueAlgorithm.h
deleted file mode 100644 (file)
index dd077f7..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef __fpa__Base__QueueAlgorithm__h__
-#define __fpa__Base__QueueAlgorithm__h__
-
-#include <queue>
-#include <itkMacro.h>
-#include <itkSmartPointer.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    /**
-     */
-    template< class _TSuperclass >
-    class QueueAlgorithm
-      : public _TSuperclass
-    {
-    public:
-      typedef QueueAlgorithm                  Self;
-      typedef _TSuperclass                    Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-    protected:
-      typedef typename Superclass::_TQueueNode _TQueueNode;
-      typedef std::queue< _TQueueNode > _TQueue;
-
-    public:
-      itkTypeMacro( QueueAlgorithm, _TSuperclass );
-
-    protected:
-      QueueAlgorithm( );
-      virtual ~QueueAlgorithm( );
-
-      virtual unsigned long _QueueSize( ) const override;
-      virtual void _QueueClear( ) override;
-      virtual void _QueuePush( const _TQueueNode& node ) override;
-      virtual _TQueueNode _QueuePop( ) override;
-
-    private:
-      // Purposely not defined
-      QueueAlgorithm( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      _TQueue m_Queue;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/QueueAlgorithm.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__QueueAlgorithm__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/QueueAlgorithm.hxx b/lib/fpa/Base/QueueAlgorithm.hxx
deleted file mode 100644 (file)
index db5b8bc..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef __fpa__Base__QueueAlgorithm__hxx__
-#define __fpa__Base__QueueAlgorithm__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-fpa::Base::QueueAlgorithm< _TSuperclass >::
-QueueAlgorithm( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-fpa::Base::QueueAlgorithm< _TSuperclass >::
-~QueueAlgorithm( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-unsigned long fpa::Base::QueueAlgorithm< _TSuperclass >::
-_QueueSize( ) const
-{
-  return( this->m_Queue.size( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-void fpa::Base::QueueAlgorithm< _TSuperclass >::
-_QueueClear( )
-{
-  while( this->m_Queue.size( ) > 0 )
-    this->m_Queue.pop( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-void fpa::Base::QueueAlgorithm< _TSuperclass >::
-_QueuePush( const _TQueueNode& node )
-{
-  this->m_Queue.push( node );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-typename fpa::Base::QueueAlgorithm< _TSuperclass >::
-_TQueueNode fpa::Base::QueueAlgorithm< _TSuperclass >::
-_QueuePop( )
-{
-  _TQueueNode f = this->m_Queue.front( );
-  this->m_Queue.pop( );
-  return( f );
-}
-
-#endif // __fpa__Base__QueueAlgorithm__hxx__
-
-// eof - $RCSfile$
index 4790b851a9273768e1d0ae5f4cf1e79e03d025aa..2586033f0f7d1d38ea5eeb491f8a188760bfb6c5 100644 (file)
@@ -1,9 +1,12 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Base__RegionGrow__h__
 #define __fpa__Base__RegionGrow__h__
 
-#include <queue>
-#include <fpa/Base/QueueAlgorithm.h>
-#include <fpa/Base/Functors/RegionGrow/Base.h>
+#include <itkFunctionBase.h>
 
 namespace fpa
 {
@@ -11,59 +14,59 @@ namespace fpa
   {
     /**
      */
-    template< class _TSuperclass >
+    template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
     class RegionGrow
-      : public fpa::Base::QueueAlgorithm< _TSuperclass >
+      : public _TFilter,
+        public _TMarksInterface,
+        public _TSeedsInterface
     {
     public:
-      typedef RegionGrow                                Self;
-      typedef fpa::Base::QueueAlgorithm< _TSuperclass > Superclass;
-      typedef itk::SmartPointer< Self >                 Pointer;
-      typedef itk::SmartPointer< const Self >           ConstPointer;
+      typedef RegionGrow                      Self;
+      typedef _TFilter                        Superclass;
+      typedef _TMarksInterface                TMarksInterface;
+      typedef _TSeedsInterface                TSeedsInterface;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
 
-      typedef typename Superclass::TOutput TOutput;
-      typedef typename Superclass::TVertex TVertex;
-      typedef fpa::Base::Functors::RegionGrow::Base< TVertex, TOutput > TGrowFunction;
+      typedef typename Superclass::TInputValue  TInputValue;
+      typedef typename Superclass::TOutputValue TOutputValue;
+      typedef typename Superclass::TVertex      TVertex;
+      typedef typename Superclass::TVertices    TVertices;
 
-    protected:
-      typedef typename Superclass::_TQueueNode _TQueueNode;
+      typedef itk::FunctionBase< TInputValue, bool > TIntensityFunctor;
+      typedef itk::FunctionBase< TVertex, bool >     TVertexFunctor;
 
     public:
-      itkTypeMacro( RegionGrow, Algorithm );
+      itkTypeMacro( RegionGrow, TFilter );
+
+      itkGetConstMacro( InsideValue, TOutputValue );
+      itkGetConstMacro( OutsideValue, TOutputValue );
+
+      itkSetMacro( InsideValue, TOutputValue );
+      itkSetMacro( OutsideValue, TOutputValue );
 
     public:
-      TGrowFunction* GetGrowFunction( );
-      const TGrowFunction* GetGrowFunction( ) const;
-      TOutput GetInsideValue( ) const;
-      TOutput GetOutsideValue( ) const;
+      const TIntensityFunctor* GetIntensityPredicate( ) const;
+      const TVertexFunctor* GetVertexPredicate( ) const;
 
-      void SetGrowFunction( TGrowFunction* f );
-      void SetInsideValue( const TOutput& v );
-      void SetOutsideValue( const TOutput& v );
+      void SetPredicate( TIntensityFunctor* functor );
+      void SetPredicate( TVertexFunctor* functor );
 
     protected:
       RegionGrow( );
       virtual ~RegionGrow( );
 
-      virtual bool _UpdateValue(
-        _TQueueNode& v, const _TQueueNode& p
-        ) override;
-      virtual TOutput _GetInputValue( const _TQueueNode& v, const _TQueueNode& p ) override
-        {
-          TOutput res = this->m_InitResult;
-          if( this->m_GrowFunction.IsNotNull( ) )
-            res = this->m_GrowFunction->Evaluate( v.Vertex, p.Vertex );
-          return( res );
-        }
-
+      virtual void GenerateData( ) override;
 
     private:
-      // Purposely not defined
       RegionGrow( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
-      typename TGrowFunction::Pointer m_GrowFunction;
+      typename TIntensityFunctor::Pointer m_IntensityFunctor;
+      typename TVertexFunctor::Pointer m_VertexFunctor;
+      TOutputValue m_InsideValue;
+      TOutputValue m_OutsideValue;
     };
 
   } // ecapseman
index c3cb9f3a355fccca44f8f8776702fea5d2ea7013..9e7bb7b801276b1db0a853c042f3ce1cdc77c1c7 100644 (file)
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Base__RegionGrow__hxx__
 #define __fpa__Base__RegionGrow__hxx__
 
-#include <fpa/Base/Functors/RegionGrow/Tautology.h>
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-typename fpa::Base::RegionGrow< _TSuperclass >::
-TGrowFunction* fpa::Base::RegionGrow< _TSuperclass >::
-GetGrowFunction( )
-{
-  // TODO: return( dynamic_cast< TGrowFunction* >( this->GetVertexFunction( ) ) );
-  return( this->m_GrowFunction );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-const typename fpa::Base::RegionGrow< _TSuperclass >::
-TGrowFunction* fpa::Base::RegionGrow< _TSuperclass >::
-GetGrowFunction( ) const
-{
-  /* TODO
-     return(
-     dynamic_cast< const TGrowFunction* >( this->GetVertexFunction( ) )
-     );
-  */
-  return( this->m_GrowFunction );
-}
+#include <queue>
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass >
-typename fpa::Base::RegionGrow< _TSuperclass >::
-TOutput fpa::Base::RegionGrow< _TSuperclass >::
-GetInsideValue( ) const
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+const typename
+fpa::Base::RegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
+TIntensityFunctor*
+fpa::Base::RegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
+GetIntensityPredicate( ) const
 {
-  const TGrowFunction* f = this->GetGrowFunction( );
-  if( f != NULL )
-    return( f->GetInsideValue( ) );
-  else
-    return( this->m_InitResult );
+  return( this->m_IntensityFunctor );
 }
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass >
-typename fpa::Base::RegionGrow< _TSuperclass >::
-TOutput fpa::Base::RegionGrow< _TSuperclass >::
-GetOutsideValue( ) const
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+const typename
+fpa::Base::RegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
+TVertexFunctor*
+fpa::Base::RegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
+GetVertexPredicate( ) const
 {
-  const TGrowFunction* f = this->GetGrowFunction( );
-  if( f != NULL )
-    return( f->GetOutsideValue( ) );
-  else
-    return( this->m_InitResult );
+  return( this->m_VertexFunctor );
 }
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass >
-void fpa::Base::RegionGrow< _TSuperclass >::
-SetGrowFunction( TGrowFunction* f )
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+void
+fpa::Base::RegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
+SetPredicate( TIntensityFunctor* functor )
 {
-  TGrowFunction* old_f = this->GetGrowFunction( );
-  if( old_f != NULL )
+  if( this->m_IntensityFunctor.GetPointer( ) != functor )
   {
-    f->SetInsideValue( old_f->GetInsideValue( ) );
-    f->SetOutsideValue( old_f->GetOutsideValue( ) );
-
-  } // fi
-  this->m_GrowFunction = f;
-}
-
-// -------------------------------------------------------------------------
-template< class _TSuperclass >
-void fpa::Base::RegionGrow< _TSuperclass >::
-SetInsideValue( const TOutput& v )
-{
-  TGrowFunction* f = this->GetGrowFunction( );
-  if( f != NULL )
-  {
-    f->SetInsideValue( v );
+    this->m_IntensityFunctor = functor;
     this->Modified( );
 
   } // fi
 }
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass >
-void fpa::Base::RegionGrow< _TSuperclass >::
-SetOutsideValue( const TOutput& v )
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+void
+fpa::Base::RegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
+SetPredicate( TVertexFunctor* functor )
 {
-  TGrowFunction* f = this->GetGrowFunction( );
-  if( f != NULL )
+  if( this->m_VertexFunctor.GetPointer( ) != functor )
   {
-    f->SetOutsideValue( v );
+    this->m_VertexFunctor = functor;
     this->Modified( );
 
   } // fi
 }
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass >
-fpa::Base::RegionGrow< _TSuperclass >::
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+fpa::Base::RegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
 RegionGrow( )
-  : Superclass( )
+  : Superclass( ),
+    _TMarksInterface( this ),
+    _TSeedsInterface( this ),
+    m_InsideValue( TOutputValue( 1 ) ),
+    m_OutsideValue( TOutputValue( 0 ) )
 {
-  typedef fpa::Base::Functors::RegionGrow::Tautology< TVertex, TOutput > _TFunc;
-  this->SetGrowFunction( _TFunc::New( ) );
-  this->m_InitResult = this->GetGrowFunction( )->GetOutsideValue( );
 }
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass >
-fpa::Base::RegionGrow< _TSuperclass >::
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+fpa::Base::RegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
 ~RegionGrow( )
 {
 }
 
 // -------------------------------------------------------------------------
-template< class _TSuperclass >
-bool fpa::Base::RegionGrow< _TSuperclass >::
-_UpdateValue( _TQueueNode& v, const _TQueueNode& p )
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+void
+fpa::Base::RegionGrow< _TFilter, _TMarksInterface, _TSeedsInterface >::
+GenerateData( )
 {
-  v.Result = this->_GetInputValue( v, p );
-  return( v.Result == this->GetInsideValue( ) );
+  // Init objects
+  this->_ConfigureOutputs( this->m_OutsideValue );
+  this->_InitMarks( this->GetNumberOfSeeds( ) );
+
+  // Init queue
+  typedef std::pair< TVertex, unsigned long > _TNode;
+  std::queue< _TNode > q;
+  unsigned long frontId = 1;
+  for( TVertex seed: this->GetSeeds( ) )
+    q.push( _TNode( seed, frontId++ ) );
+
+  // Main loop
+  while( q.size( ) > 0 )
+  {
+    // Get next candidate
+    _TNode node = q.front( );
+    q.pop( );
+    if( this->_IsMarked( node.first ) )
+      continue;
+    this->_Mark( node.first, node.second );
+
+    // Apply inclusion predicate
+    TInputValue value = this->_GetInputValue( node.first );
+    bool inside = false;
+    if( this->m_IntensityFunctor.IsNotNull( ) )
+      inside = this->m_IntensityFunctor->Evaluate( value );
+    if( this->m_VertexFunctor.IsNotNull( ) )
+      inside &= this->m_VertexFunctor->Evaluate( node.first );
+    if( !inside )
+      continue;
+
+    // Ok, pixel lays inside region
+    this->_SetOutputValue( node.first, this->m_InsideValue );
+
+    // Add neighborhood
+    TVertices neighbors = this->_GetNeighbors( node.first );
+    for( TVertex neigh: neighbors )
+    {
+      if( this->_IsMarked( neigh ) )
+      {
+        // Invoke stop at collisions
+        unsigned long nColl = this->_Collisions( node.first, neigh );
+        if(
+          this->StopAtOneFront( ) &&
+          this->GetNumberOfSeeds( ) > 1 &&
+          nColl == 1
+          )
+          while( q.size( ) > 0 )
+            q.pop( );
+      }
+      else
+        q.push( _TNode( neigh, node.second ) );
+
+    } // rof
+
+  } // elihw
+  this->_FreeMarks( );
 }
 
 #endif // __fpa__Base__RegionGrow__hxx__
diff --git a/lib/fpa/Base/SeedsInterface.h b/lib/fpa/Base/SeedsInterface.h
new file mode 100644 (file)
index 0000000..a994125
--- /dev/null
@@ -0,0 +1,56 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__SeedsInterface__h__
+#define __fpa__Base__SeedsInterface__h__
+
+#include <itkProcessObject.h>
+#include <set>
+
+namespace fpa
+{
+  namespace Base
+  {
+    /**
+     */
+    template< class _TVertex, class _TCompare >
+    class SeedsInterface
+    {
+    public:
+      typedef _TVertex  TVertex;
+      typedef _TCompare TCompare;
+      typedef SeedsInterface Self;
+      typedef std::set< TVertex, TCompare > TSeeds;
+
+    public:
+      unsigned int GetNumberOfSeeds( ) const;
+      const TSeeds& GetSeeds( ) const;
+      typename TSeeds::const_iterator BeginSeeds( ) const;
+      typename TSeeds::const_iterator EndSeeds( ) const;
+
+      void AddSeed( const TVertex& seed );
+      void RemoveSeed( const TVertex& seed );
+      void ClearSeeds( );
+
+    protected:
+      SeedsInterface( itk::ProcessObject* filter );
+      virtual ~SeedsInterface( );
+
+    private:
+      TSeeds m_Seeds;
+      itk::ProcessObject* m_Filter;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Base/SeedsInterface.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Base__SeedsInterface__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Base/SeedsInterface.hxx b/lib/fpa/Base/SeedsInterface.hxx
new file mode 100644 (file)
index 0000000..4e20760
--- /dev/null
@@ -0,0 +1,100 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__SeedsInterface__hxx__
+#define __fpa__Base__SeedsInterface__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TVertex, class _TCompare >
+unsigned int fpa::Base::SeedsInterface< _TVertex, _TCompare >::
+GetNumberOfSeeds( ) const
+{
+  return( this->m_Seeds.size( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex, class _TCompare >
+const typename fpa::Base::SeedsInterface< _TVertex, _TCompare >::
+TSeeds& fpa::Base::SeedsInterface< _TVertex, _TCompare >::
+GetSeeds( ) const
+{
+  return( this->m_Seeds );
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex, class _TCompare >
+typename fpa::Base::SeedsInterface< _TVertex, _TCompare >::
+TSeeds::const_iterator fpa::Base::SeedsInterface< _TVertex, _TCompare >::
+BeginSeeds( ) const
+{
+  return( this->m_Seeds.begin( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex, class _TCompare >
+typename fpa::Base::SeedsInterface< _TVertex, _TCompare >::
+TSeeds::const_iterator fpa::Base::SeedsInterface< _TVertex, _TCompare >::
+EndSeeds( ) const
+{
+  return( this->m_Seeds.end( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex, class _TCompare >
+void fpa::Base::SeedsInterface< _TVertex, _TCompare >::
+AddSeed( const TVertex& seed )
+{
+  if( this->m_Seeds.insert( seed ).second && this->m_Filter != NULL )
+    this->m_Filter->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex, class _TCompare >
+void fpa::Base::SeedsInterface< _TVertex, _TCompare >::
+RemoveSeed( const TVertex& seed )
+{
+  typename TSeeds::const_iterator i = this->m_Seeds.find( seed );
+  if( i != this->m_Seeds.end( ) )
+  {
+    this->m_Seeds.erase( i );
+    if( this->m_Filter != NULL )
+      this->m_Filter->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex, class _TCompare >
+void fpa::Base::SeedsInterface< _TVertex, _TCompare >::
+ClearSeeds( )
+{
+  if( this->m_Seeds.size( ) > 0 )
+  {
+    this->m_Seeds.clear( );
+    if( this->m_Filter != NULL )
+      this->m_Filter->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex, class _TCompare >
+fpa::Base::SeedsInterface< _TVertex, _TCompare >::
+SeedsInterface( itk::ProcessObject* filter )
+  : m_Filter( filter )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TVertex, class _TCompare >
+fpa::Base::SeedsInterface< _TVertex, _TCompare >::
+~SeedsInterface( )
+{
+  this->m_Seeds.clear( );
+}
+
+#endif // __fpa__Base__SeedsInterface__hxx__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/CMakeLists.txt b/lib/fpa/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a3ef666
--- /dev/null
@@ -0,0 +1,56 @@
+
+## =====================
+## == Get source code ==
+## =====================
+
+file(GLOB_RECURSE _base_src "${CMAKE_CURRENT_SOURCE_DIR}/Base/*.cxx")
+file(GLOB_RECURSE _base_hdr "${CMAKE_CURRENT_SOURCE_DIR}/Base/*.h")
+file(GLOB_RECURSE _base_hrc "${CMAKE_CURRENT_SOURCE_DIR}/Base/*.hxx")
+file(GLOB_RECURSE _image_src "${CMAKE_CURRENT_SOURCE_DIR}/Image/*.cxx")
+file(GLOB_RECURSE _image_hdr "${CMAKE_CURRENT_SOURCE_DIR}/Image/*.h")
+file(GLOB_RECURSE _image_hrc "${CMAKE_CURRENT_SOURCE_DIR}/Image/*.hxx")
+
+## =====================
+## == Compile library ==
+## =====================
+
+#add_library(fpa SHARED ${_src} ${_hdr} ${_hrc})
+#generate_export_header(fpa)
+#set_property(TARGET fpa PROPERTY VERSION ${prj_VERSION})
+#set_property(TARGET fpa PROPERTY SOVERSION ${prj_SHORT_VERSION})
+#set_property(
+#  TARGET fpa PROPERTY INTERFACE_fpa_MAJOR_VERSION ${prj_MAJ_VERSION}
+#  )
+#set_property(
+#  TARGET fpa APPEND PROPERTY COMPATIBLE_INTERFACE_STRING ${prj_MAJ_VERSION}
+#  )
+#target_link_libraries(fpa PUBLIC ${VTK_LIBRARIES} ${ITK_LIBRARIES})
+
+## ========================
+## == Installation rules ==
+## ========================
+
+#install(
+#  TARGETS fpa
+#  EXPORT "${targets_export_name}"
+#  LIBRARY DESTINATION "lib"
+#  ARCHIVE DESTINATION "lib"
+#  RUNTIME DESTINATION "bin"
+#  INCLUDES DESTINATION "${include_install_dir}"
+#  )
+install(
+  DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+  DESTINATION "${include_install_dir}"
+  FILES_MATCHING PATTERN "*.h"
+  )
+install(
+  DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+  DESTINATION "${include_install_dir}"
+  FILES_MATCHING PATTERN "*.hxx"
+  )
+#install(
+#  FILES "${CMAKE_CURRENT_BINARY_DIR}/fpa_export.h"
+#  DESTINATION "${include_install_dir}/fpa"
+#  )
+
+## eof - $RCSfile$
diff --git a/lib/fpa/Config.h b/lib/fpa/Config.h
deleted file mode 100644 (file)
index 9728f0b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __fpa__Config__h__
-#define __fpa__Config__h__
-
-/*
- * =========================================================================
- * Language related macros
- * =========================================================================
- */
-
-#endif // __fpa__Config__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Algorithm.h b/lib/fpa/Image/Algorithm.h
deleted file mode 100644 (file)
index 0105cc3..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#ifndef __fpa__Image__Algorithm__h__
-#define __fpa__Image__Algorithm__h__
-
-#include <itkFunctionBase.h>
-#include <itkImageToImageFilter.h>
-#include <fpa/Base/Algorithm.h>
-#include <fpa/Image/Functors/Base.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TInputImage, class _TOutputImage >
-    class Algorithm
-      : public fpa::Base::Algorithm< itk::ImageToImageFilter< _TInputImage, _TOutputImage >, typename _TInputImage::IndexType, typename _TOutputImage::PixelType >
-    {
-    public:
-      typedef itk::ImageToImageFilter< _TInputImage, _TOutputImage > TFilter;
-      typedef typename _TInputImage::IndexType                       TVertex;
-      typedef typename _TOutputImage::PixelType                      TOutput;
-
-      typedef Algorithm                                         Self;
-      typedef fpa::Base::Algorithm< TFilter, TVertex, TOutput > Superclass;
-      typedef itk::SmartPointer< Self >                         Pointer;
-      typedef itk::SmartPointer< const Self >                   ConstPointer;
-
-      typedef typename Superclass::TFrontId      TFrontId;
-      typedef typename Superclass::TNeighborhood TNeighborhood;
-
-      typedef fpa::Image::Functors::Base< itk::ImageBase< _TInputImage::ImageDimension >, typename Superclass::TNeighborhoodFunction > TNeighborhoodFunction;
-      typedef fpa::Image::Functors::Base< _TInputImage, typename Superclass::TVertexFunction > TVertexFunction;
-
-    protected:
-      typedef typename Superclass::_TQueueNode _TQueueNode;
-
-    public:
-      itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
-
-    protected:
-      Algorithm( );
-      virtual ~Algorithm( );
-
-      virtual void _BeforeGenerateData( ) override;
-      virtual void _InitMarks( ) override;
-      virtual void _InitResults( const TOutput& init_value ) override;
-      virtual bool _IsMarked( const TVertex& v ) const override;
-      virtual void _Mark( const _TQueueNode& n ) override;
-      virtual TFrontId _GetMark( const TVertex& v ) const override;
-      virtual void _UpdateResult( const _TQueueNode& n ) override;
-      virtual TOutput _GetResult( const TVertex& v ) const override;
-      virtual unsigned int _GetNumberOfDimensions( ) const override;
-
-    private:
-      // Purposely not defined
-      Algorithm( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      unsigned int m_MarksIdx;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/Algorithm.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__Algorithm__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Algorithm.hxx b/lib/fpa/Image/Algorithm.hxx
deleted file mode 100644 (file)
index 3c33e4e..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-#ifndef __fpa__Image__Algorithm__hxx__
-#define __fpa__Image__Algorithm__hxx__
-
-// Send Piotr's code to Anna
-
-#include <itkImage.h>
-#include <fpa/Image/Functors/SimpleNeighborhood.h>
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-fpa::Image::Algorithm< _TInputImage, _TOutputImage >::
-Algorithm( )
-  : Superclass( )
-{
-  typedef fpa::Image::Functors::SimpleNeighborhood< _TInputImage::ImageDimension > _TNeigh;
-  typedef itk::Image< TFrontId, _TInputImage::ImageDimension > _TMarks;
-
-  this->m_MarksIdx = this->GetNumberOfRequiredOutputs( );
-  this->itk::ProcessObject::SetNumberOfRequiredOutputs( this->m_MarksIdx + 1 );
-  typename _TMarks::Pointer marks = _TMarks::New( );
-  this->SetNthOutput( this->m_MarksIdx, marks );
-
-  typename _TNeigh::Pointer neigh = _TNeigh::New( );
-  this->SetNeighborhoodFunction( neigh );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-fpa::Image::Algorithm< _TInputImage, _TOutputImage >::
-~Algorithm( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpa::Image::Algorithm< _TInputImage, _TOutputImage >::
-_BeforeGenerateData( )
-{
-  this->Superclass::_BeforeGenerateData( );
-  this->AllocateOutputs( );
-
-  TNeighborhoodFunction* neighFunc =
-    dynamic_cast< TNeighborhoodFunction* >(
-      this->GetNeighborhoodFunction( )
-      );
-  if( neighFunc == NULL )
-    itkExceptionMacro( << "NeighborhoodFunction not well defined." );
-  neighFunc->SetImage( this->GetInput( ) );
-
-  TVertexFunction* vertexFunc =
-    dynamic_cast< TVertexFunction* >(
-      this->GetVertexFunction( )
-      );
-  if( vertexFunc != NULL )
-    vertexFunc->SetImage( this->GetInput( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpa::Image::Algorithm< _TInputImage, _TOutputImage >::
-_InitMarks( )
-{
-  typedef itk::Image< TFrontId, _TInputImage::ImageDimension > _TMarks;
-  _TMarks* marks =
-    dynamic_cast< _TMarks* >(
-      this->itk::ProcessObject::GetOutput( this->m_MarksIdx )
-      );
-  marks->FillBuffer( 0 );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpa::Image::Algorithm< _TInputImage, _TOutputImage >::
-_InitResults( const TOutput& init_value )
-{
-  this->GetOutput( )->FillBuffer( init_value );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-bool fpa::Image::Algorithm< _TInputImage, _TOutputImage >::
-_IsMarked( const TVertex& v ) const
-{
-  typedef itk::Image< TFrontId, _TInputImage::ImageDimension > _TMarks;
-  const _TMarks* marks =
-    dynamic_cast< const _TMarks* >(
-      this->itk::ProcessObject::GetOutput( this->m_MarksIdx )
-      );
-  return( marks->GetPixel( v ) != 0 );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpa::Image::Algorithm< _TInputImage, _TOutputImage >::
-_Mark( const _TQueueNode& n )
-{
-  typedef itk::Image< TFrontId, _TInputImage::ImageDimension > _TMarks;
-  _TMarks* marks =
-    dynamic_cast< _TMarks* >(
-      this->itk::ProcessObject::GetOutput( this->m_MarksIdx )
-      );
-  marks->SetPixel( n.Vertex, n.FrontId );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-typename fpa::Image::Algorithm< _TInputImage, _TOutputImage >::
-TFrontId fpa::Image::Algorithm< _TInputImage, _TOutputImage >::
-_GetMark( const TVertex& v ) const
-{
-  typedef itk::Image< TFrontId, _TInputImage::ImageDimension > _TMarks;
-  const _TMarks* marks =
-    dynamic_cast< const _TMarks* >(
-      this->itk::ProcessObject::GetOutput( this->m_MarksIdx )
-      );
-  return( marks->GetPixel( v ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpa::Image::Algorithm< _TInputImage, _TOutputImage >::
-_UpdateResult( const _TQueueNode& n )
-{
-  this->GetOutput( )->SetPixel( n.Vertex, n.Result );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-typename fpa::Image::Algorithm< _TInputImage, _TOutputImage >::TOutput
-fpa::Image::Algorithm< _TInputImage, _TOutputImage >::
-_GetResult( const TVertex& v ) const
-{
-  if( this->GetOutput( )->GetLargestPossibleRegion( ).IsInside( v ) )
-    return( this->GetOutput( )->GetPixel( v ) );
-  else
-    return( this->m_InitResult );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-unsigned int fpa::Image::Algorithm< _TInputImage, _TOutputImage >::
-_GetNumberOfDimensions( ) const
-{
-  return( _TInputImage::ImageDimension );
-}
-
-#endif // __fpa__Image__Algorithm__hxx__
-
-// eof - $RCSfile$
index 118cc27abc76593139574fc50b05d344e15a6006..1df0836a985668ee3f0f526144b63d80f8e2d7f8 100644 (file)
@@ -1,10 +1,17 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Image__Dijkstra__h__
 #define __fpa__Image__Dijkstra__h__
 
 #include <fpa/Base/Dijkstra.h>
-#include <fpa/Image/Algorithm.h>
+#include <fpa/Base/SeedsInterface.h>
+#include <fpa/Image/MarksInterface.h>
+#include <fpa/Image/Filter.h>
 #include <fpa/Image/MinimumSpanningTree.h>
-#include <fpa/Image/Functors/Base.h>
+#include <fpa/Image/Functors/VertexParentBase.h>
 
 namespace fpa
 {
@@ -14,29 +21,62 @@ namespace fpa
      */
     template< class _TInputImage, class _TOutputImage >
     class Dijkstra
-      : public fpa::Base::Dijkstra< fpa::Image::Algorithm< _TInputImage, _TOutputImage >, fpa::Image::MinimumSpanningTree< _TInputImage::ImageDimension > >
+      : public fpa::Base::Dijkstra< fpa::Image::Filter< _TInputImage, _TOutputImage >, fpa::Image::MarksInterface< _TInputImage::ImageDimension >, fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::IndexType::LexicographicCompare >, fpa::Image::MinimumSpanningTree< _TInputImage::ImageDimension > >
     {
     public:
-      typedef Dijkstra                                             Self;
-      typedef fpa::Image::Algorithm< _TInputImage, _TOutputImage > TAlgorithm;
+      // Interfaces
+      typedef fpa::Image::Filter< _TInputImage, _TOutputImage > TFilter;
+      typedef fpa::Image::MarksInterface< _TInputImage::ImageDimension > TMarksInterface;
+      typedef fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::IndexType::LexicographicCompare > TSeedsInterface;
       typedef fpa::Image::MinimumSpanningTree< _TInputImage::ImageDimension > TMST;
-      typedef fpa::Base::Dijkstra< TAlgorithm, TMST > Superclass;
-      typedef itk::SmartPointer< Self >               Pointer;
-      typedef itk::SmartPointer< const Self >         ConstPointer;
 
-      typedef typename Superclass::TOutput TOutput;
-      typedef typename Superclass::TVertex TVertex;
+      // Smart pointers
+      typedef Dijkstra Self;
+      typedef fpa::Base::Dijkstra< TFilter, TMarksInterface, TSeedsInterface, TMST > Superclass;
+      typedef itk::SmartPointer< Self > Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef typename TFilter::TInputImage TInputImage;
+      typedef typename TFilter::TOutputValue TOutputValue;
+      typedef typename TFilter::TVertex TVertex;
 
     public:
       itkNewMacro( Self );
       itkTypeMacro( fpa::Image::Dijkstra, fpa::Base::Dijkstra );
 
     protected:
-      Dijkstra( );
-      virtual ~Dijkstra( );
+      Dijkstra( ) : Superclass( ) { }
+      virtual ~Dijkstra( )        { }
+
+      virtual void _ConfigureOutputs( const TOutputValue& init_value ) override
+        {
+          this->Superclass::_ConfigureOutputs( init_value );
+
+          typename TVertex::OffsetType o;
+          o.Fill( 0 );
+          const TInputImage* input = this->GetInput( );
+          TMST* mst = this->GetMinimumSpanningTree( );
+          mst->CopyInformation( input );
+          mst->SetBufferedRegion( input->GetRequestedRegion( ) );
+          mst->Allocate( );
+          mst->FillBuffer( o );
+        }
+
+      virtual void GenerateData( ) override
+        {
+          // Configure functors with input image
+          typedef typename TFilter::TOutputValue _TOutputValue;
+          typedef fpa::Image::Functors::VertexParentBase< _TInputImage, _TOutputValue > _TVFunc;
+          _TVFunc* vfunc =
+            dynamic_cast< _TVFunc* >( this->m_VertexFunctor.GetPointer( ) );
+          if( vfunc != NULL )
+            vfunc->SetImage( this->GetInput( ) );
+
+          // Ok, continue
+          this->Superclass::GenerateData( );
+        }
 
     private:
-      // Purposely not defined
       Dijkstra( const Self& other );
       Self& operator=( const Self& other );
     };
@@ -45,10 +85,6 @@ namespace fpa
 
 } // ecapseman
 
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/Dijkstra.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
 #endif // __fpa__Image__Dijkstra__h__
 
 // eof - $RCSfile$
diff --git a/lib/fpa/Image/Dijkstra.hxx b/lib/fpa/Image/Dijkstra.hxx
deleted file mode 100644 (file)
index 1f21dc4..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef __fpa__Image__Dijkstra__hxx__
-#define __fpa__Image__Dijkstra__hxx__
-
-#include <fpa/Image/Functors/VertexCost.h>
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
-Dijkstra( )
-  : Superclass( )
-{
-  typedef fpa::Image::Functors::VertexCost< _TInputImage, TOutput > _TCost;
-  typename _TCost::Pointer cost = _TCost::New( );
-  this->SetVertexFunction( cost );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
-~Dijkstra( )
-{
-}
-
-#endif // __fpa__Image__Dijkstra__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/EndPointsFilter.h b/lib/fpa/Image/EndPointsFilter.h
deleted file mode 100644 (file)
index afbfb10..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef __fpa__Image__EndPointsFilter__h__
-#define __fpa__Image__EndPointsFilter__h__
-
-#include <fpa/Image/MinimumSpanningTree.h>
-#include <set>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TDistanceMap, class _TCostMap >
-    class EndPointsFilter
-      : public itk::Object
-    {
-    public:
-      typedef EndPointsFilter                 Self;
-      typedef itk::Object                     Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      typedef _TDistanceMap TDistanceMap;
-      typedef _TCostMap     TCostMap;
-      typedef typename TCostMap::IndexType TIndex;
-      typedef MinimumSpanningTree< TCostMap::ImageDimension > TMST;
-      
-      typedef itk::Functor::IndexLexicographicCompare< _TCostMap::ImageDimension > TIndexCompare;
-      typedef std::set< TIndex, TIndexCompare > TIndices;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::EndPointsFilter, itk::Object );
-
-      itkGetConstObjectMacro( DistanceMap, _TDistanceMap );
-      itkGetConstObjectMacro( CostMap, _TCostMap );
-      itkGetConstObjectMacro( MST, TMST );
-
-      itkSetConstObjectMacro( DistanceMap, _TDistanceMap );
-      itkSetConstObjectMacro( CostMap, _TCostMap );
-      itkSetConstObjectMacro( MST, TMST );
-
-    public:
-      const TIndices& GetBifurcations( ) const;
-      const TIndices& GetEndPoints( ) const;
-
-      void Compute( );
-
-    protected:
-      EndPointsFilter( );
-      virtual ~EndPointsFilter( );
-
-    private:
-      // Purposely not defined
-      EndPointsFilter( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      typename _TDistanceMap::ConstPointer m_DistanceMap;
-      typename _TCostMap::ConstPointer m_CostMap;
-      typename TMST::ConstPointer m_MST;
-
-      TIndices m_Bifurcations;
-      TIndices m_EndPoints;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/EndPointsFilter.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__EndPointsFilter__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/EndPointsFilter.hxx b/lib/fpa/Image/EndPointsFilter.hxx
deleted file mode 100644 (file)
index c2e1d1c..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-#ifndef __fpa__Image__EndPointsFilter__hxx__
-#define __fpa__Image__EndPointsFilter__hxx__
-
-#include <functional>
-#include <map>
-#include <queue>
-#include <itkImageRegionConstIteratorWithIndex.h>
-
-// -------------------------------------------------------------------------
-template< class _TDistanceMap, class _TCostMap >
-const typename fpa::Image::EndPointsFilter< _TDistanceMap, _TCostMap >::
-TIndices& fpa::Image::EndPointsFilter< _TDistanceMap, _TCostMap >::
-GetBifurcations( ) const
-{
-  return( this->m_Bifurcations );
-}
-
-// -------------------------------------------------------------------------
-template< class _TDistanceMap, class _TCostMap >
-const typename fpa::Image::EndPointsFilter< _TDistanceMap, _TCostMap >::
-TIndices& fpa::Image::EndPointsFilter< _TDistanceMap, _TCostMap >::
-GetEndPoints( ) const
-{
-  return( this->m_EndPoints );
-}
-
-// -------------------------------------------------------------------------
-template< class _TDistanceMap, class _TCostMap >
-void fpa::Image::EndPointsFilter< _TDistanceMap, _TCostMap >::
-Compute( )
-{
-  typedef itk::ImageRegionConstIteratorWithIndex< _TDistanceMap > _TDistMapIt;
-  typedef itk::ImageRegionConstIteratorWithIndex< _TCostMap > _TCostMapIt;
-  typedef std::multimap< double, TIndex, std::greater< double > > _TQueue;
-  typedef typename _TQueue::value_type _TQueueValue;
-  typedef itk::Image< unsigned char, _TCostMap::ImageDimension > _TMarks;
-
-  // Some values
-  typename _TDistanceMap::RegionType region =
-    this->m_DistanceMap->GetRequestedRegion( );
-  typename _TMarks::Pointer marks = _TMarks::New( );
-  marks->SetLargestPossibleRegion( this->m_DistanceMap->GetLargestPossibleRegion( ) );
-  marks->SetRequestedRegion( this->m_DistanceMap->GetRequestedRegion( ) );
-  marks->SetBufferedRegion( this->m_DistanceMap->GetBufferedRegion( ) );
-  marks->SetSpacing( this->m_DistanceMap->GetSpacing( ) );
-  marks->SetOrigin( this->m_DistanceMap->GetOrigin( ) );
-  marks->SetDirection( this->m_DistanceMap->GetDirection( ) );
-  marks->Allocate( );
-  marks->FillBuffer( 0 );
-
-  // Create queue
-  _TQueue queue;
-  _TDistMapIt dIt( this->m_DistanceMap, region );
-  _TCostMapIt cIt( this->m_CostMap, region );
-  dIt.GoToBegin( );
-  cIt.GoToBegin( );
-  for( ; !dIt.IsAtEnd( ) && !cIt.IsAtEnd( ); ++dIt, ++cIt )
-  {
-    double d = double( dIt.Get( ) );
-    if( d > 0 )
-    {
-      double v = double( cIt.Get( ) ) / ( d * d );
-      queue.insert( _TQueueValue( v, dIt.GetIndex( ) ) );
-
-    } // fi
-
-  } // rof
-
-  // BFS from maximum queue
-  while( queue.size( ) > 0 )
-  {
-    // Get node
-    auto nIt = queue.begin( );
-    auto n = *nIt;
-    queue.erase( nIt );
-
-    unsigned char m = marks->GetPixel( n.second );
-    if( ( m & 0x01 ) == 0x01 )
-      continue;
-
-    // Mark it
-    m |= 0x01;
-    marks->SetPixel( n.second, m );
-    this->m_EndPoints.insert( n.second );
-
-    // Get path
-    typename TMST::TPath::Pointer path;
-    this->m_MST->GetPath( path, n.second );
-    for( unsigned long i = 0; i < path->GetSize( ); ++i )
-    {
-      TIndex idx = path->GetVertex( path->GetSize( ) - 1 - i );
-      typename _TCostMap::PointType cnt;
-      this->m_CostMap->TransformIndexToPhysicalPoint( idx, cnt );
-      double d = double( this->m_DistanceMap->GetPixel( idx ) );
-      d *= double( 2 );
-
-      // Mark sphere
-      std::queue< TIndex > q;
-      q.push( idx );
-      while( q.size( ) > 0 )
-      {
-        TIndex v = q.front( );
-        q.pop( );
-        unsigned char m = marks->GetPixel( v );
-        if( ( m & 0x02 ) == 0x02 )
-          continue;
-        m |= 0x03;
-        marks->SetPixel( v, m );
-
-        for( unsigned int x = 0; x < _TCostMap::ImageDimension; ++x )
-        {
-          for( int y = -1; y <= 1; y += 2 )
-          {
-            TIndex w = v;
-            w[ x ] += y;
-            if( region.IsInside( w ) )
-            {
-              typename _TCostMap::PointType p;
-              this->m_CostMap->TransformIndexToPhysicalPoint( w, p );
-              if( cnt.EuclideanDistanceTo( p ) <= d )
-                q.push( w );
-
-            } // fi
-
-          } // rof
-
-        } // rof
-
-      } // elihw
-
-    } // rof
-
-  } // elihw
-}
-
-// -------------------------------------------------------------------------
-template< class _TDistanceMap, class _TCostMap >
-fpa::Image::EndPointsFilter< _TDistanceMap, _TCostMap >::
-EndPointsFilter( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TDistanceMap, class _TCostMap >
-fpa::Image::EndPointsFilter< _TDistanceMap, _TCostMap >::
-~EndPointsFilter( )
-{
-}
-
-#endif // __fpa__Image__EndPointsFilter__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/FastMarching.h b/lib/fpa/Image/FastMarching.h
deleted file mode 100644 (file)
index 2a4056f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef __fpa__Image__FastMarching__h__
-#define __fpa__Image__FastMarching__h__
-
-#include <fpa/Base/FastMarching.h>
-#include <fpa/Image/Algorithm.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TInputImage, class _TOutputImage >
-    class FastMarching
-      : public fpa::Base::FastMarching< fpa::Image::Algorithm< _TInputImage, _TOutputImage > >
-    {
-    public:
-      typedef FastMarching                                         Self;
-      typedef fpa::Image::Algorithm< _TInputImage, _TOutputImage > TAlgorithm;
-      typedef fpa::Base::FastMarching< TAlgorithm > Superclass;
-      typedef itk::SmartPointer< Self >             Pointer;
-      typedef itk::SmartPointer< const Self >       ConstPointer;
-
-      typedef typename Superclass::TOutput TOutput;
-      typedef typename Superclass::TVertex TVertex;
-      typedef typename Superclass::TFastMarchingNeighbor TFastMarchingNeighbor;
-      typedef typename Superclass::TFastMarchingNeighborhood TFastMarchingNeighborhood;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::FastMarching, fpa::Base::FastMarching );
-
-    protected:
-      FastMarching( );
-      virtual ~FastMarching( );
-
-      virtual TFastMarchingNeighborhood _FastMarchingNeighbors( const TVertex& v ) const override;
-
-    private:
-      // Purposely not defined
-      FastMarching( const Self& other );
-      Self& operator=( const Self& other );
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/FastMarching.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__FastMarching__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/FastMarching.hxx b/lib/fpa/Image/FastMarching.hxx
deleted file mode 100644 (file)
index fe75b21..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef __fpa__Image__FastMarching__hxx__
-#define __fpa__Image__FastMarching__hxx__
-
-#include <fpa/Image/Functors/VertexCost.h>
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-fpa::Image::FastMarching< _TInputImage, _TOutputImage >::
-FastMarching( )
-  : Superclass( )
-{
-  typedef fpa::Image::Functors::VertexCost< _TInputImage, TOutput > _TCost;
-  typename _TCost::Pointer cost = _TCost::New( );
-  this->SetVertexFunction( cost );
-  this->m_InitResult = std::numeric_limits< TOutput >::max( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-fpa::Image::FastMarching< _TInputImage, _TOutputImage >::
-~FastMarching( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-typename fpa::Image::FastMarching< _TInputImage, _TOutputImage >::
-TFastMarchingNeighborhood
-fpa::Image::FastMarching< _TInputImage, _TOutputImage >::
-_FastMarchingNeighbors( const TVertex& v ) const
-{
-  TFastMarchingNeighborhood neighs;
-  typename _TInputImage::SpacingType spac = this->GetInput( )->GetSpacing( );
-  for( unsigned int d = 0; d < _TInputImage::ImageDimension; ++d )
-  {
-    for( int i = -1; i <= 1; i += 2 )
-    {
-      TVertex n = v;
-      n[ d ] += i;
-      neighs.push_back( TFastMarchingNeighbor( n, spac[ d ] ) );
-
-    } // rof
-
-  } // rof
-  return( neighs );
-}
-
-#endif // __fpa__Image__FastMarching__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Filter.h b/lib/fpa/Image/Filter.h
new file mode 100644 (file)
index 0000000..ab86f81
--- /dev/null
@@ -0,0 +1,60 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__Filter__h__
+#define __fpa__Image__Filter__h__
+
+#include <vector>
+#include <itkImageToImageFilter.h>
+
+namespace fpa
+{
+  namespace Image
+  {
+    /**
+     */
+    template< class _TInputImage, class _TOutputImage >
+    class Filter
+      : public itk::ImageToImageFilter< _TInputImage, _TOutputImage >
+    {
+    public:
+      typedef Filter Self;
+      typedef itk::ImageToImageFilter< _TInputImage, _TOutputImage > Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef _TInputImage TInputImage;
+      typedef _TOutputImage TOutputImage;
+
+      typedef typename TInputImage::IndexType  TVertex;
+      typedef typename TInputImage::PixelType  TInputValue;
+      typedef typename TOutputImage::PixelType TOutputValue;
+
+      typedef std::vector< TVertex > TVertices;
+
+    protected:
+      Filter( );
+      virtual ~Filter( );
+
+      virtual void GenerateInputRequestedRegion( ) override;
+      virtual void EnlargeOutputRequestedRegion( itk::DataObject* output ) override;
+
+      virtual TInputValue _GetInputValue( const TVertex& vertex ) const;
+      virtual void _SetOutputValue( const TVertex& vertex, const TOutputValue& value );
+      virtual void _ConfigureOutputs( const TOutputValue& init_value );
+      virtual TVertices _GetNeighbors( const TVertex& vertex ) const;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Image/Filter.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Image__Filter__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Image/Filter.hxx b/lib/fpa/Image/Filter.hxx
new file mode 100644 (file)
index 0000000..ad8053b
--- /dev/null
@@ -0,0 +1,103 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__Filter__hxx__
+#define __fpa__Image__Filter__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage >
+fpa::Image::Filter< _TInputImage, _TOutputImage >::
+Filter( )
+  : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage >
+fpa::Image::Filter< _TInputImage, _TOutputImage >::
+~Filter( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage >
+void fpa::Image::Filter< _TInputImage, _TOutputImage >::
+GenerateInputRequestedRegion( )
+{
+  this->Superclass::GenerateInputRequestedRegion( );
+  if( this->GetInput( ) )
+  {
+    TInputImage* input = const_cast< TInputImage* >( this->GetInput( ) );
+    input->SetRequestedRegionToLargestPossibleRegion( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage >
+void fpa::Image::Filter< _TInputImage, _TOutputImage >::
+EnlargeOutputRequestedRegion( itk::DataObject* output )
+{
+  this->Superclass::EnlargeOutputRequestedRegion( output );
+  output->SetRequestedRegionToLargestPossibleRegion( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage >
+typename fpa::Image::Filter< _TInputImage, _TOutputImage >::
+TInputValue fpa::Image::Filter< _TInputImage, _TOutputImage >::
+_GetInputValue( const TVertex& vertex ) const
+{
+  return( this->GetInput( )->GetPixel( vertex ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage >
+void fpa::Image::Filter< _TInputImage, _TOutputImage >::
+_SetOutputValue( const TVertex& vertex, const TOutputValue& value )
+{
+  this->GetOutput( )->SetPixel( vertex, value );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage >
+void fpa::Image::Filter< _TInputImage, _TOutputImage >::
+_ConfigureOutputs( const TOutputValue& init_value )
+{
+  const TInputImage* input = this->GetInput( );
+  TOutputImage* output = this->GetOutput( );
+  output->SetBufferedRegion( input->GetRequestedRegion( ) );
+  output->Allocate( );
+  output->FillBuffer( init_value );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage >
+typename fpa::Image::Filter< _TInputImage, _TOutputImage >::
+TVertices fpa::Image::Filter< _TInputImage, _TOutputImage >::
+_GetNeighbors( const TVertex& vertex ) const
+{
+  typename TInputImage::RegionType region =
+    this->GetInput( )->GetRequestedRegion( );
+
+  TVertices vertices;
+  for( unsigned int d = 0; d < TInputImage::ImageDimension; ++d )
+  {
+    TVertex n = vertex;
+    for( int a = -1; a <= 1; a += 2 )
+    {
+      n[ d ] = vertex[ d ] + a;
+      if( region.IsInside( n ) )
+        vertices.push_back( n );
+
+    } // rof
+
+  } // rof
+  return( vertices );
+}
+
+#endif // __fpa__Image__Filter__hxx__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/Base.h b/lib/fpa/Image/Functors/Base.h
deleted file mode 100644 (file)
index 45bd846..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef __fpa__Image__Functors__Base__h__
-#define __fpa__Image__Functors__Base__h__
-
-#include <fpa/Config.h>
-#include <itkFunctionBase.h>
-#include <itkImageBase.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    namespace Functors
-    {
-      /**
-       */
-      template< class _TImage, class _TSuperclass >
-      class Base
-        : public _TSuperclass
-      {
-      public:
-        typedef Base                            Self;
-        typedef _TSuperclass                    Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-        typedef _TImage TImage;
-        typedef itk::ImageBase< TImage::ImageDimension > TImageBase;
-
-      public:
-        itkTypeMacro( Base, itk::FunctionBase );
-
-        itkGetConstObjectMacro( Image, TImage );
-        itkSetConstObjectMacro( Image, TImage );
-
-      protected:
-        Base( ) : Superclass( ) { }
-        virtual ~Base( )        { }
-
-      private:
-        // Purposely not implemented
-        Base( const Self& other );
-        Self& operator=( const Self& other );
-
-      protected:
-        typename TImage::ConstPointer m_Image;
-      };
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Image__Functors__Base__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/GaussianWeight.h b/lib/fpa/Image/Functors/GaussianWeight.h
new file mode 100644 (file)
index 0000000..3b2212a
--- /dev/null
@@ -0,0 +1,78 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__Functors__GaussianWeight__h__
+#define __fpa__Image__Functors__GaussianWeight__h__
+
+#include <fpa/Image/Functors/VertexParentBase.h>
+#include <cmath>
+
+namespace fpa
+{
+  namespace Image
+  {
+    namespace Functors
+    {
+      /**
+       */
+      template< class _TInputImage, class _TOutputValue >
+      class GaussianWeight
+        : public fpa::Image::Functors::VertexParentBase< _TInputImage, _TOutputValue >
+      {
+      public:
+        typedef _TInputImage                    TInputImage;
+        typedef _TOutputValue                   TOutputValue;
+        typedef GaussianWeight                  Self;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+        typedef fpa::Image::Functors::VertexParentBase< TInputImage, TOutputValue > Superclass;
+
+        typedef typename Superclass::TVertex TVertex;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro(
+          fpa::Image::Functors::GaussianWeight,
+          fpa::Image::Functors::VertexParentBase
+          );
+
+        itkGetConstMacro( Beta, double );
+        itkSetMacro( Beta, double );
+
+      public:
+        virtual TOutputValue Evaluate(
+          const TVertex& a, const TVertex& p
+          ) const override
+          {
+            double va = double( this->m_Image->GetPixel( a ) );
+            double vp = double( this->m_Image->GetPixel( p ) );
+            double d = va - vp;
+            return( TOutputValue( std::exp( -d * d * this->m_Beta ) ) );
+          }
+
+      protected:
+        GaussianWeight( )
+          : Superclass( ),
+            m_Beta( double( 1 ) )
+          { }
+        virtual ~GaussianWeight( ) { }
+
+      private:
+        GaussianWeight( const Self& other );
+        Self& operator=( const Self& other );
+
+      protected:
+        double m_Beta;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Image__Functors__GaussianWeight__h__
+
+// eof - $RCSfile$
index 70ac8d0027e8bca7c218a5c1cc11aeb493255590..3acbc5c20cd226822859c64ad5d5b9dd90d6d11e 100644 (file)
@@ -1,8 +1,12 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Image__Functors__RegionGrow__BinaryThreshold__h__
 #define __fpa__Image__Functors__RegionGrow__BinaryThreshold__h__
 
-#include <fpa/Image/Functors/Base.h>
-#include <fpa/Base/Functors/RegionGrow/Base.h>
+#include <itkFunctionBase.h>
 
 namespace fpa
 {
@@ -14,35 +18,33 @@ namespace fpa
       {
         /**
          */
-        template< class _TImage, class _TOutput >
+        template< class _TPixel >
         class BinaryThreshold
-          : public fpa::Image::Functors::Base< _TImage, fpa::Base::Functors::RegionGrow::Base< typename _TImage::IndexType, _TOutput > >
+          : public itk::FunctionBase< _TPixel, bool >
         {
         public:
-          typedef _TImage                    TImage;
-          typedef _TOutput                   TOutput;
-          typedef typename TImage::IndexType TIndex;
-          typedef typename TImage::PixelType TPixel;
+          typedef _TPixel  TPixel;
 
-          typedef fpa::Base::Functors::RegionGrow::Base< TIndex, TOutput > TBase;
-          typedef fpa::Image::Functors::Base< TImage, TBase > Superclass;
-          typedef BinaryThreshold                             Self;
-          typedef itk::SmartPointer< Self >                   Pointer;
-          typedef itk::SmartPointer< const Self >             ConstPointer;
+          typedef BinaryThreshold                         Self;
+          typedef itk::FunctionBase< TPixel, bool > Superclass;
+          typedef itk::SmartPointer< Self >         Pointer;
+          typedef itk::SmartPointer< const Self >   ConstPointer;
 
         public:
           itkNewMacro( Self );
-          itkTypeMacro( BinaryThreshold, Base );
+          itkTypeMacro(
+            fpa::Image::Functors::RegionGrow::BinaryThreshold,
+            itk::FunctionBase
+            );
 
           itkGetConstMacro( Lower, TPixel );
           itkGetConstMacro( Upper, TPixel );
+
           itkSetMacro( Lower, TPixel );
           itkSetMacro( Upper, TPixel );
 
         public:
-          virtual TOutput Evaluate(
-            const TIndex& a, const TIndex& b
-            ) const override;
+          virtual bool Evaluate( const TPixel& value ) const override;
 
         protected:
           BinaryThreshold( );
index 7f2b9dca99bc40f2e4b78cfdbe6a95d0ab3137ec..4184e03958d4ac649f3f25613ec54a6c762d7fe4 100644 (file)
@@ -1,32 +1,22 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Image__Functors__RegionGrow__BinaryThreshold__hxx__
 #define __fpa__Image__Functors__RegionGrow__BinaryThreshold__hxx__
 
-#include <limits>
-
 // -------------------------------------------------------------------------
-template< class _TImage, class _TOutput >
-_TOutput
-fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage, _TOutput >::
-Evaluate( const TIndex& a, const TIndex& b ) const
+template< class _TPixel >
+bool fpa::Image::Functors::RegionGrow::BinaryThreshold< _TPixel >::
+Evaluate( const TPixel& value ) const
 {
-  const _TImage* im =
-    dynamic_cast< const _TImage* >( this->m_Image.GetPointer( ) );
-  if( im != NULL )
-  {
-    TPixel v = im->GetPixel( b );
-    return(
-      ( this->m_Lower < v && v < this->m_Upper )?
-      this->m_InsideValue:
-      this->m_OutsideValue
-      );
-  }
-  else
-    return( this->m_OutsideValue );
+  return( this->m_Lower < value && value < this->m_Upper );
 }
 
 // -------------------------------------------------------------------------
-template< class _TImage, class _TOutput >
-fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage, _TOutput >::
+template< class _TPixel >
+fpa::Image::Functors::RegionGrow::BinaryThreshold< _TPixel >::
 BinaryThreshold( )
   : Superclass( )
 {
@@ -38,8 +28,8 @@ BinaryThreshold( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TImage, class _TOutput >
-fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage, _TOutput >::
+template< class _TPixel >
+fpa::Image::Functors::RegionGrow::BinaryThreshold< _TPixel >::
 ~BinaryThreshold( )
 {
 }
diff --git a/lib/fpa/Image/Functors/RegionGrow/Tautology.h b/lib/fpa/Image/Functors/RegionGrow/Tautology.h
new file mode 100644 (file)
index 0000000..0c7d283
--- /dev/null
@@ -0,0 +1,67 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__Functors__RegionGrow__Tautology__h__
+#define __fpa__Image__Functors__RegionGrow__Tautology__h__
+
+#include <itkFunctionBase.h>
+
+namespace fpa
+{
+  namespace Image
+  {
+    namespace Functors
+    {
+      namespace RegionGrow
+      {
+        /**
+         */
+        template< class _TPixel >
+        class Tautology
+          : public itk::FunctionBase< _TPixel, bool >
+        {
+        public:
+          typedef _TPixel  TPixel;
+
+          typedef Tautology                         Self;
+          typedef itk::FunctionBase< TPixel, bool > Superclass;
+          typedef itk::SmartPointer< Self >         Pointer;
+          typedef itk::SmartPointer< const Self >   ConstPointer;
+
+        public:
+          itkNewMacro( Self );
+          itkTypeMacro(
+            fpa::Image::Functors::RegionGrow::Tautology,
+            itk::FunctionBase
+            );
+
+        public:
+          virtual bool Evaluate( const TPixel& value ) const override
+            { return( true ); }
+
+        protected:
+          Tautology( )
+            : Superclass( )
+            { }
+          virtual ~Tautology( )
+            { }
+
+        private:
+          // Purposely not implemented
+          Tautology( const Self& other );
+          Self& operator=( const Self& other );
+        };
+
+      } // ecapseman
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Image__Functors__RegionGrow__Tautology__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/SimpleNeighborhood.h b/lib/fpa/Image/Functors/SimpleNeighborhood.h
deleted file mode 100644 (file)
index 0e4ebf7..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef __fpa__Image__Functors__SimpleNeighborhood__h__
-#define __fpa__Image__Functors__SimpleNeighborhood__h__
-
-#include <vector>
-#include <fpa/Image/Functors/Base.h>
-#include <itkFunctionBase.h>
-#include <itkImageBase.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    namespace Functors
-    {
-      /**
-       */
-      template< unsigned int _VDim >
-      class SimpleNeighborhood
-        : public fpa::Image::Functors::Base< itk::ImageBase< _VDim >, itk::FunctionBase< itk::Index< _VDim >, std::vector< itk::Index< _VDim > > > >
-      {
-      public:
-        typedef itk::ImageBase< _VDim >         TImage;
-        typedef typename TImage::IndexType      TIndex;
-        typedef typename TIndex::OffsetType     TOffset;
-        typedef std::vector< TIndex >           TOutput;
-        typedef itk::FunctionBase< TIndex, TOutput > TBaseFunctor;
-        typedef fpa::Image::Functors::Base< TImage, TBaseFunctor > Superclass;
-        typedef SimpleNeighborhood              Self;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( SimpleNeighborhood, Base );
-
-        itkGetConstMacro( Order, unsigned int );
-        itkSetMacro( Order, unsigned int );
-
-      public:
-        virtual TOutput Evaluate( const TIndex& center ) const override;
-
-      protected:
-        SimpleNeighborhood( );
-        virtual ~SimpleNeighborhood( );
-
-        void _1stCombination( ) const;
-        void _2ndCombination( ) const;
-
-      private:
-        // Purposely not implemented
-        SimpleNeighborhood( const Self& other );
-        Self& operator=( const Self& other );
-
-      protected:
-        unsigned int m_Order;
-        mutable std::vector< TOffset > m_Offsets;
-      };
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/Functors/SimpleNeighborhood.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__Functors__SimpleNeighborhood__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/SimpleNeighborhood.hxx b/lib/fpa/Image/Functors/SimpleNeighborhood.hxx
deleted file mode 100644 (file)
index 172425d..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-#ifndef __fpa__Image__Functors__SimpleNeighborhood__hxx__
-#define __fpa__Image__Functors__SimpleNeighborhood__hxx__
-
-// -------------------------------------------------------------------------
-template< unsigned int _VDim >
-typename fpa::Image::Functors::SimpleNeighborhood< _VDim >::
-TOutput fpa::Image::Functors::SimpleNeighborhood< _VDim >::
-Evaluate( const TIndex& center ) const
-{
-  if( this->m_Offsets.size( ) == 0 )
-  {
-    if( this->m_Order == 1 )
-      this->_1stCombination( );
-    else
-      this->_2ndCombination( );
-
-  } // fi
-
-  TOutput res;
-  typename TImage::RegionType reg = this->m_Image->GetRequestedRegion( );
-  for( int i = 0; i < this->m_Offsets.size( ); ++i )
-  {
-    TIndex idx = center + this->m_Offsets[ i ];
-    if( reg.IsInside( idx ) && idx != center )
-      res.push_back( idx );
-
-  } // rof
-  return( res );
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int _VDim >
-fpa::Image::Functors::SimpleNeighborhood< _VDim >::
-SimpleNeighborhood( )
-  : Superclass( ),
-    m_Order( 1 )
-{
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int _VDim >
- fpa::Image::Functors::SimpleNeighborhood< _VDim >::
-~SimpleNeighborhood( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int _VDim >
-void fpa::Image::Functors::SimpleNeighborhood< _VDim >::
-_1stCombination( ) const
-{
-  for( int d = 0; d < TImage::ImageDimension; ++d )
-  {
-    typename TIndex::OffsetType off;
-    off.Fill( 0 );
-    for( int i = -1; i <= 1; i += 2 )
-    {
-      off[ d ] = i;
-      this->m_Offsets.push_back( off );
-
-    } // rof
-
-  } // rof
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int _VDim >
-void fpa::Image::Functors::SimpleNeighborhood< _VDim >::
-_2ndCombination( ) const
-{
-  std::vector< std::vector< std::vector< int > > > M;
-  M.push_back( std::vector< std::vector< int > >( ) );
-
-  std::vector< int > base;
-  base.push_back( -1 );
-  base.push_back(  0 );
-  base.push_back(  1 );
-  int dim = TImage::ImageDimension;
-
-  M.push_back( std::vector< std::vector< int > >( ) );
-  for( int j = 0; j < base.size( ); ++j )
-    M[ 1 ].push_back( std::vector< int >( 1, base[ j ] ) );
-
-  for( int i = 2; i <= dim; ++i )
-  {
-    M.push_back( std::vector< std::vector< int > >( ) );
-    for( int j = 0; j < base.size( ); ++j )
-    {
-      for( int k = 0; k < M[ i - 1 ].size( ); ++k )
-      {
-        M[ i ].push_back( std::vector< int >( 1, base[ j ] ) );
-        for( int l = 0; l < M[ i - 1 ][ k ].size( ); ++l )
-          M[ i ].back( ).push_back( M[ i - 1 ][ k ][ l ] );
-
-      } // rof
-
-    } // rof
-
-  } // rof
-
-  for( int i = 0; i < M[ dim ].size( ); ++i )
-  {
-    TOffset off;
-    for( int j = 0; j < M[ dim ][ i ].size( ); ++j )
-      off[ j ] = M[ dim ][ i ][ j ];
-    this->m_Offsets.push_back( off );
-
-  } // rof
-}
-
-#endif // __fpa__Image__Functors__SimpleNeighborhood__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/VertexCost.h b/lib/fpa/Image/Functors/VertexCost.h
deleted file mode 100644 (file)
index a6f3e45..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef __fpa__Image__Functors__VertexCost__h__
-#define __fpa__Image__Functors__VertexCost__h__
-
-#include <fpa/Image/Functors/Base.h>
-#include <fpa/Base/Functors/VertexCostFunctionBase.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    namespace Functors
-    {
-      /**
-       */
-      template< class _TImage, class _TOutput >
-      class VertexCost
-        : public fpa::Image::Functors::Base< _TImage, fpa::Base::Functors::VertexCostFunctionBase< typename _TImage::IndexType, _TOutput > >
-      {
-      public:
-        typedef _TImage                    TImage;
-        typedef typename TImage::IndexType TIndex;
-        typedef _TOutput                   TOutput;
-
-        typedef fpa::Base::Functors::VertexCostFunctionBase< TIndex, TOutput > TBaseFunctor;
-        typedef fpa::Image::Functors::Base< TImage, TBaseFunctor > Superclass;
-        typedef VertexCost              Self;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( VertexCost, Base );
-
-        itkBooleanMacro( UseImageSpacing );
-        itkGetConstMacro( UseImageSpacing, bool );
-        itkSetMacro( UseImageSpacing, bool );
-
-      public:
-        virtual TOutput Evaluate(
-          const TIndex& a, const TIndex& b
-          ) const override;
-
-      protected:
-        VertexCost( );
-        virtual ~VertexCost( );
-
-      private:
-        // Purposely not implemented
-        VertexCost( const Self& other );
-        Self& operator=( const Self& other );
-
-      protected:
-        bool m_UseImageSpacing;
-      };
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/Functors/VertexCost.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__Functors__VertexCost__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/VertexCost.hxx b/lib/fpa/Image/Functors/VertexCost.hxx
deleted file mode 100644 (file)
index 3b59c52..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef __fpa__Image__Functors__VertexCost__hxx__
-#define __fpa__Image__Functors__VertexCost__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TImage, class _TOutput >
-typename fpa::Image::Functors::VertexCost< _TImage, _TOutput >::
-TOutput fpa::Image::Functors::VertexCost< _TImage, _TOutput >::
-Evaluate( const TIndex& a, const TIndex& b ) const
-{
-  const _TImage* im =
-    dynamic_cast< const _TImage* >( this->m_Image.GetPointer( ) );
-  TOutput coeff = TOutput( 1 );
-  if( this->m_UseImageSpacing )
-  {
-    typename _TImage::PointType pa, pb;
-    im->TransformIndexToPhysicalPoint( a, pa );
-    im->TransformIndexToPhysicalPoint( b, pb );
-    coeff = TOutput( pa.EuclideanDistanceTo( pb ) );
-
-  } // fi
-  return( TOutput( im->GetPixel( a ) ) * coeff );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage, class _TOutput >
-fpa::Image::Functors::VertexCost< _TImage, _TOutput >::
-VertexCost( )
-  : Superclass( ),
-    m_UseImageSpacing( false )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage, class _TOutput >
-fpa::Image::Functors::VertexCost< _TImage, _TOutput >::
-~VertexCost( )
-{
-}
-
-#endif // __fpa__Image__Functors__VertexCost__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/VertexIdentity.h b/lib/fpa/Image/Functors/VertexIdentity.h
new file mode 100644 (file)
index 0000000..716c2e7
--- /dev/null
@@ -0,0 +1,67 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__Functors__VertexIdentity__h__
+#define __fpa__Image__Functors__VertexIdentity__h__
+
+#include <fpa/Image/Functors/VertexParentBase.h>
+
+namespace fpa
+{
+  namespace Image
+  {
+    namespace Functors
+    {
+      /**
+       */
+      template< class _TInputImage, class _TOutputValue >
+      class VertexIdentity
+        : public fpa::Image::Functors::VertexParentBase< _TInputImage, _TOutputValue >
+      {
+      public:
+        typedef _TInputImage                    TInputImage;
+        typedef _TOutputValue                   TOutputValue;
+        typedef VertexIdentity                  Self;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+        typedef fpa::Image::Functors::VertexParentBase< TInputImage, TOutputValue > Superclass;
+
+        typedef typename Superclass::TVertex TVertex;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro(
+          fpa::Image::Functors::VertexIdentity,
+          fpa::Image::Functors::VertexParentBase
+          );
+
+      public:
+        virtual TOutputValue Evaluate(
+          const TVertex& a, const TVertex& p
+          ) const override
+          {
+            return( TOutputValue( this->m_Image->GetPixel( a ) ) );
+          }
+
+      protected:
+        VertexIdentity( )
+          : Superclass( )
+          { }
+        virtual ~VertexIdentity( ) { }
+
+      private:
+        VertexIdentity( const Self& other );
+        Self& operator=( const Self& other );
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Image__Functors__VertexIdentity__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/VertexParentBase.h b/lib/fpa/Image/Functors/VertexParentBase.h
new file mode 100644 (file)
index 0000000..20b76e0
--- /dev/null
@@ -0,0 +1,63 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__Functors__VertexParentBase__h__
+#define __fpa__Image__Functors__VertexParentBase__h__
+
+#include <fpa/Base/Functors/VertexParentBase.h>
+
+namespace fpa
+{
+  namespace Image
+  {
+    namespace Functors
+    {
+      /**
+       */
+      template< class _TInputImage, class _TOutputValue >
+      class VertexParentBase
+        : public fpa::Base::Functors::VertexParentBase< typename _TInputImage::IndexType, _TOutputValue >
+      {
+      public:
+        typedef _TInputImage                    TInputImage;
+        typedef _TOutputValue                   TOutputValue;
+        typedef typename TInputImage::IndexType TVertex;
+        typedef VertexParentBase                Self;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+        typedef fpa::Base::Functors::VertexParentBase< TVertex, TOutputValue > Superclass;
+
+      public:
+        itkTypeMacro(
+          fpa::Image::Functors::VertexParentBase,
+          fpa::Base::Functors::VertexParentBase
+          );
+
+        itkGetConstObjectMacro( Image, TInputImage );
+        itkSetConstObjectMacro( Image, TInputImage );
+
+      protected:
+        VertexParentBase( )
+          : Superclass( )
+          { }
+        virtual ~VertexParentBase( ) { }
+
+      private:
+        VertexParentBase( const Self& other );
+        Self& operator=( const Self& other );
+
+      protected:
+        typename TInputImage::ConstPointer m_Image;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Image__Functors__VertexParentBase__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Image/MarksInterface.h b/lib/fpa/Image/MarksInterface.h
new file mode 100644 (file)
index 0000000..d238d82
--- /dev/null
@@ -0,0 +1,59 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__MarksInterface__h__
+#define __fpa__Image__MarksInterface__h__
+
+#include <fpa/Base/MarksInterface.h>
+#include <itkIndex.h>
+#include <itkImage.h>
+
+namespace fpa
+{
+  namespace Image
+  {
+    /**
+     */
+    template< unsigned int _VDim >
+    class MarksInterface
+      : public fpa::Base::MarksInterface< itk::Index< _VDim > >
+    {
+    public:
+      typedef MarksInterface Self;
+      typedef fpa::Base::MarksInterface< itk::Index< _VDim > > Superclass;
+
+      typedef typename Superclass::TVertex        TVertex;
+      typedef typename Superclass::TCollision     TCollision;
+      typedef typename Superclass::TCollisionsRow TCollisionsRow;
+      typedef typename Superclass::TCollisions    TCollisions;
+
+      typedef itk::Image< unsigned long, _VDim > TMarks;
+
+    protected:
+      virtual bool _IsMarked( const TVertex& v ) const override;
+      virtual unsigned long _GetMark( const TVertex& v ) const override;
+      virtual void _Mark( const TVertex& v, unsigned long frontId ) override;
+      virtual void _FreeMarks( ) override;
+      virtual void _InitMarks( unsigned long nSeeds ) override;
+
+    protected:
+      MarksInterface( itk::ProcessObject* filter );
+      virtual ~MarksInterface( );
+
+    private:
+      typename TMarks::Pointer m_Marks;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Image/MarksInterface.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Image__MarksInterface__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Image/MarksInterface.hxx b/lib/fpa/Image/MarksInterface.hxx
new file mode 100644 (file)
index 0000000..4d639ac
--- /dev/null
@@ -0,0 +1,86 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__MarksInterface__hxx__
+#define __fpa__Image__MarksInterface__hxx__
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+bool fpa::Image::MarksInterface< _VDim >::
+_IsMarked( const TVertex& v ) const
+{
+  return( this->m_Marks->GetPixel( v ) != 0 );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+unsigned long fpa::Image::MarksInterface< _VDim >::
+_GetMark( const TVertex& v ) const
+{
+  return( this->m_Marks->GetPixel( v ) );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+void fpa::Image::MarksInterface< _VDim >::
+_Mark( const TVertex& v, unsigned long frontId )
+{
+  this->m_Marks->SetPixel( v, frontId );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+void fpa::Image::MarksInterface< _VDim >::
+_FreeMarks( )
+{
+  this->m_Marks = NULL;
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+void fpa::Image::MarksInterface< _VDim >::
+_InitMarks( unsigned long nSeeds )
+{
+  this->Superclass::_InitMarks( nSeeds );
+
+  // Try to guess input
+  if( this->m_Filter == NULL )
+    return;
+  if( this->m_Filter->GetInputs( ).size( ) == 0 )
+    return;
+  itk::ImageBase< _VDim >* input =
+    dynamic_cast< itk::ImageBase< _VDim >* >(
+      this->m_Filter->GetInputs( )[ 0 ].GetPointer( )
+      );
+  if( input == NULL )
+    return;
+
+  // Reserve memory for marks
+  this->m_Marks = TMarks::New( );
+  this->m_Marks->CopyInformation( input );
+  this->m_Marks->SetRequestedRegion( input->GetRequestedRegion( ) );
+  this->m_Marks->SetBufferedRegion( input->GetBufferedRegion( ) );
+  this->m_Marks->Allocate( );
+  this->m_Marks->FillBuffer( 0 );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+fpa::Image::MarksInterface< _VDim >::
+MarksInterface( itk::ProcessObject* filter )
+  : Superclass( filter )
+{
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+fpa::Image::MarksInterface< _VDim >::
+~MarksInterface( )
+{
+}
+
+#endif // __fpa__Image__MarksInterface__hxx__
+
+// eof - $RCSfile$
index 7d3941d23bbe57d904389af0161cffb74002f20a..a93157cac6acb00c3b4d524f66d12e66981af8db 100644 (file)
@@ -1,8 +1,12 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Image__MinimumSpanningTree__h__
 #define __fpa__Image__MinimumSpanningTree__h__
 
 #include <fpa/Base/MinimumSpanningTree.h>
-#include <cpExtensions/DataStructures/PolyLineParametricPath.h>
 #include <itkImage.h>
 
 namespace fpa
@@ -13,41 +17,47 @@ namespace fpa
      */
     template< unsigned int _VDim >
     class MinimumSpanningTree
-      : public fpa::Base::MinimumSpanningTree< itk::Index< _VDim >, cpExtensions::DataStructures::PolyLineParametricPath< _VDim >, itk::Image< itk::Offset< _VDim >, _VDim > >
+      : public fpa::Base::MinimumSpanningTree< itk::Index< _VDim >, itk::Image< itk::Offset< _VDim >, _VDim > >
     {
     public:
-      typedef itk::Index< _VDim >                               TVertex;
-      typedef cpExtensions::DataStructures::PolyLineParametricPath< _VDim > TPath;
-      typedef itk::Offset< _VDim >                                     TOffset;
-      typedef itk::Image< TOffset, _VDim >                             TImage;
-      typedef fpa::Base::MinimumSpanningTree< TVertex, TPath, TImage > Superclass;
-      typedef MinimumSpanningTree                                      Self;
-      typedef itk::SmartPointer< Self >                                Pointer;
-      typedef itk::SmartPointer< const Self >                          ConstPointer;
+      typedef itk::Index< _VDim > TVertex;
+      typedef itk::Image< itk::Offset< _VDim >, _VDim > TBaseImage;
+
+      typedef MinimumSpanningTree             Self;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+      typedef fpa::Base::MinimumSpanningTree< TVertex, TBaseImage > Superclass;
+
+      typedef typename Superclass::TCollision     TCollision;
+      typedef typename Superclass::TCollisionsRow TCollisionsRow;
+      typedef typename Superclass::TCollisions    TCollisions;
+      typedef typename Superclass::TVertices      TVertices;
 
     public:
       itkNewMacro( Self );
       itkTypeMacro(
-        fpa::Image::MinimumSpanningTree, fpa::Base::MinimumSpanningTree
+        fpa::Image::MinimumSpanningTree,
+        fpa::Base::MinimumSpanningTree
         );
 
     public:
-      virtual TVertex GetParent( const TVertex& v ) const override;
-      virtual void SetParent( const TVertex& v, const TVertex& p ) override;
-
-      virtual void GetPath(
-        typename TPath::Pointer& path, const TVertex& a
-        ) const override;
-      virtual void GetPath(
-        typename TPath::Pointer& path, const TVertex& a, const TVertex& b
-        ) const override;
+      virtual TVertex GetParent( const TVertex& v ) const override
+        {
+          return( v + this->GetPixel( v ) );
+        }
+      virtual void SetParent( const TVertex& v, const TVertex& p ) override
+        {
+          this->SetPixel( v, p - v );
+        }
 
     protected:
-      MinimumSpanningTree( );
-      virtual ~MinimumSpanningTree( );
+      MinimumSpanningTree( )
+        : Superclass( )
+        { }
+      virtual ~MinimumSpanningTree( )
+        { }
 
     private:
-      // Purposely not defined
       MinimumSpanningTree( const Self& other );
       Self& operator=( const Self& other );
     };
@@ -56,10 +66,6 @@ namespace fpa
 
 } // ecapseman
 
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/MinimumSpanningTree.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
 #endif // __fpa__Image__MinimumSpanningTree__h__
 
 // eof - $RCSfile$
diff --git a/lib/fpa/Image/MinimumSpanningTree.hxx b/lib/fpa/Image/MinimumSpanningTree.hxx
deleted file mode 100644 (file)
index b99953b..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef __fpa__Image__MinimumSpanningTree__hxx__
-#define __fpa__Image__MinimumSpanningTree__hxx__
-
-// -------------------------------------------------------------------------
-template< unsigned int _VDim >
-typename fpa::Image::MinimumSpanningTree< _VDim >::
-TVertex fpa::Image::MinimumSpanningTree< _VDim >::
-GetParent( const TVertex& v ) const
-{
-  TVertex p = v + this->GetPixel( v );
-  return( p );
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int _VDim >
-void fpa::Image::MinimumSpanningTree< _VDim >::
-SetParent( const TVertex& v, const TVertex& p )
-{
-  this->SetPixel( v, p - v );
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int _VDim >
-void fpa::Image::MinimumSpanningTree< _VDim >::
-GetPath( typename TPath::Pointer& path, const TVertex& a ) const
-{
-  if( path.GetPointer( ) == NULL )
-    path = TPath::New( );
-  path->SetReferenceImage( this );
-  this->Superclass::GetPath( path, a );
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int _VDim >
-void fpa::Image::MinimumSpanningTree< _VDim >::
-GetPath(
-  typename TPath::Pointer& path, const TVertex& a, const TVertex& b
-  ) const
-{
-  if( path.GetPointer( ) == NULL )
-    path = TPath::New( );
-  path->SetReferenceImage( this );
-  this->Superclass::GetPath( path, a, b );
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int _VDim >
-fpa::Image::MinimumSpanningTree< _VDim >::
-MinimumSpanningTree( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int _VDim >
-fpa::Image::MinimumSpanningTree< _VDim >::
-~MinimumSpanningTree( )
-{
-}
-
-#endif // __fpa__Image__MinimumSpanningTree__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/MinimumSpanningTreeToImageFilter.h b/lib/fpa/Image/MinimumSpanningTreeToImageFilter.h
new file mode 100644 (file)
index 0000000..a119702
--- /dev/null
@@ -0,0 +1,84 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__MinimumSpanningTreeToImageFilter__h__
+#define __fpa__Image__MinimumSpanningTreeToImageFilter__h__
+
+#include <itkRGBAPixel.h>
+#include <itkImageToImageFilter.h>
+#include <vector>
+
+namespace fpa
+{
+  namespace Image
+  {
+    /**
+     */
+    template< class _TMST, class _TOutputPixelValue >
+    class MinimumSpanningTreeToImageFilter
+      : public itk::ImageToImageFilter< _TMST, itk::Image< itk::RGBAPixel< _TOutputPixelValue >, _TMST::ImageDimension > >
+    {
+    public:
+      typedef _TMST TMST;
+      typedef _TOutputPixelValue TOutputPixelValue;
+      typedef itk::RGBAPixel< TOutputPixelValue > TOutputPixel;
+      typedef itk::Image< TOutputPixel, TMST::ImageDimension > TOutputImage;
+
+      typedef MinimumSpanningTreeToImageFilter              Self;
+      typedef itk::SmartPointer< Self >                     Pointer;
+      typedef itk::SmartPointer< const Self >               ConstPointer;
+      typedef itk::ImageToImageFilter< TMST, TOutputImage > Superclass;
+
+      typedef typename TMST::IndexType TIndex;
+      struct TPathData
+      {
+        TIndex Start;
+        TIndex End;
+        TOutputPixelValue Red;
+        TOutputPixelValue Green;
+        TOutputPixelValue Blue;
+      };
+      typedef std::vector< TPathData > TPaths;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro(
+        fpa::Image::MinimumSpanningTreeToImageFilter,
+        itk::ImageToImageFilter
+        );
+
+    public:
+      void AddPath(
+        const TIndex& start, const TIndex& end,
+        const TOutputPixelValue& r = TOutputPixelValue( 1 ),
+        const TOutputPixelValue& g = TOutputPixelValue( 0 ),
+        const TOutputPixelValue& b = TOutputPixelValue( 0 )
+        );
+
+    protected:
+      MinimumSpanningTreeToImageFilter( );
+      virtual ~MinimumSpanningTreeToImageFilter( );
+
+      virtual void GenerateData( ) override;
+
+    private:
+      MinimumSpanningTreeToImageFilter( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      TPaths m_Paths;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Image/MinimumSpanningTreeToImageFilter.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Image__MinimumSpanningTreeToImageFilter__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Image/MinimumSpanningTreeToImageFilter.hxx b/lib/fpa/Image/MinimumSpanningTreeToImageFilter.hxx
new file mode 100644 (file)
index 0000000..1ef0039
--- /dev/null
@@ -0,0 +1,77 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__MinimumSpanningTreeToImageFilter__hxx__
+#define __fpa__Image__MinimumSpanningTreeToImageFilter__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TMST, class _TOutputPixelValue >
+void fpa::Image::MinimumSpanningTreeToImageFilter< _TMST, _TOutputPixelValue >::
+AddPath(
+  const TIndex& start, const TIndex& end,
+  const TOutputPixelValue& r,
+  const TOutputPixelValue& g,
+  const TOutputPixelValue& b
+  )
+{
+  if( start != end )
+  {
+    TPathData d;
+    d.Start = start;
+    d.End = end;
+    d.Red = r;
+    d.Green = g;
+    d.Blue = b;
+    this->m_Paths.push_back( d );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TMST, class _TOutputPixelValue >
+fpa::Image::MinimumSpanningTreeToImageFilter< _TMST, _TOutputPixelValue >::
+MinimumSpanningTreeToImageFilter( )
+  : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TMST, class _TOutputPixelValue >
+fpa::Image::MinimumSpanningTreeToImageFilter< _TMST, _TOutputPixelValue >::
+~MinimumSpanningTreeToImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TMST, class _TOutputPixelValue >
+void fpa::Image::MinimumSpanningTreeToImageFilter< _TMST, _TOutputPixelValue >::
+GenerateData( )
+{
+  TOutputPixel color;
+  color.Fill( 0 );
+
+  const TMST* mst = this->GetInput( );
+  TOutputImage* output = this->GetOutput( );
+  output->SetBufferedRegion( mst->GetBufferedRegion( ) );
+  output->Allocate( );
+  output->FillBuffer( color );
+
+  for( TPathData d: this->m_Paths )
+  {
+    typename TMST::TVertices path = mst->GetPath( d.Start, d.End );
+    color[ 0 ] = d.Red;
+    color[ 1 ] = d.Green;
+    color[ 2 ] = d.Blue;
+    color[ 3 ] = std::numeric_limits< TOutputPixelValue >::max( );
+    for( TIndex i: path )
+      output->SetPixel( i, color );
+
+  } // rof
+}
+
+#endif // __fpa__Image__MinimumSpanningTreeToImageFilter__hxx__
+
+// eof - $RCSfile$
index 41c122e32d9caf0c5d5cc89cdcb0e493ff23fb12..182e004ba04e7cdc35ea34417a8dfc087ea338f2 100644 (file)
@@ -1,9 +1,15 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Image__MoriRegionGrow__h__
 #define __fpa__Image__MoriRegionGrow__h__
 
-#include <itkImageToImageFilter.h>
-#include <itkBinaryThresholdImageFilter.h>
-#include <fpa/Image/MoriRegionGrowHelper.h>
+#include <fpa/Base/MoriRegionGrow.h>
+#include <fpa/Base/SeedsInterface.h>
+#include <fpa/Image/MarksInterface.h>
+#include <fpa/Image/Filter.h>
 
 namespace fpa
 {
@@ -11,84 +17,39 @@ namespace fpa
   {
     /**
      */
-    template< class _TInputImage, class _TOutputImage, class _TAuxPixel = unsigned short >
+    template< class _TInputImage, class _TOutputImage >
     class MoriRegionGrow
-      : public itk::ImageToImageFilter< _TInputImage, _TOutputImage >
+      : public fpa::Base::MoriRegionGrow< fpa::Image::Filter< _TInputImage, _TOutputImage >, fpa::Image::MarksInterface< _TInputImage::ImageDimension >, fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::IndexType::LexicographicCompare > >
     {
     public:
-      typedef MoriRegionGrow                                         Self;
-      typedef itk::ImageToImageFilter< _TInputImage, _TOutputImage > Superclass;
-      typedef itk::SmartPointer< Self >                              Pointer;
-      typedef itk::SmartPointer< const Self >                        ConstPointer;
-
-      typedef itk::Image< _TAuxPixel, _TInputImage::ImageDimension >      TAuxImage;
-      typedef fpa::Image::MoriRegionGrowHelper< _TInputImage, TAuxImage > THelper;
-      typedef itk::BinaryThresholdImageFilter< TAuxImage, _TOutputImage > TThreshold;
+      // Interfaces
+      typedef fpa::Image::Filter< _TInputImage, _TOutputImage > TFilter;
+      typedef fpa::Image::MarksInterface< _TInputImage::ImageDimension > TMarksInterface;
+      typedef fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::IndexType::LexicographicCompare > TSeedsInterface;
 
-      typedef typename _TInputImage::IndexType  TIndex;
-      typedef typename _TInputImage::PixelType  TInputPixel;
-      typedef typename _TOutputImage::PixelType TOutputPixel;
+      // Smart pointers
+      typedef MoriRegionGrow Self;
+      typedef fpa::Base::MoriRegionGrow< TFilter, TMarksInterface, TSeedsInterface > Superclass;
+      typedef itk::SmartPointer< Self > Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
 
     public:
       itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::MoriRegionGrow, itk::ImageToImageFilter );
-
-      itkGetConstMacro( Seed, TIndex );
-      itkSetMacro( Seed, TIndex );
-
-    public:
-      TAuxImage* GetAuxiliaryImage( );
-      const TAuxImage* GetAuxiliaryImage( ) const;
-
-      TInputPixel GetLower( ) const;
-      TInputPixel GetUpper( ) const;
-      TInputPixel GetStep( ) const;
-      TOutputPixel GetInsideValue( ) const;
-      TOutputPixel GetOutsideValue( ) const;
-
-      void SetLower( const TInputPixel& v );
-      void SetUpper( const TInputPixel& v );
-      void SetStep( const TInputPixel& v );
-      void SetInsideValue( const TOutputPixel& v );
-      void SetOutsideValue( const TOutputPixel& v );
-
-
-      /* TODO
-         itkGetConstMacro( Lower, TPixel );
-         itkGetConstMacro( Upper, TPixel );
-         itkGetConstMacro( Step, TPixel );
-         itkGetConstMacro( Sensitivity, double );
-         itkSetMacro( Lower, TPixel );
-         itkSetMacro( Upper, TPixel );
-         itkSetMacro( Step, TPixel );
-         itkSetMacro( Sensitivity, double );
-      */
+      itkTypeMacro( fpa::Image::MoriRegionGrow, fpa::Base::MoriRegionGrow );
 
     protected:
-      MoriRegionGrow( );
-      virtual ~MoriRegionGrow( );
-
-      virtual void GenerateData( ) override;
+      MoriRegionGrow( ) : Superclass( ) { }
+      virtual ~MoriRegionGrow( )        { }
 
     private:
-      // Purposely not defined
       MoriRegionGrow( const Self& other );
       Self& operator=( const Self& other );
-
-    protected:
-      typename THelper::Pointer m_Helper;
-      typename TThreshold::Pointer m_Threshold;
-      TIndex m_Seed;
     };
 
   } // ecapseman
 
 } // ecapseman
 
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/MoriRegionGrow.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
 #endif // __fpa__Image__MoriRegionGrow__h__
 
 // eof - $RCSfile$
diff --git a/lib/fpa/Image/MoriRegionGrow.hxx b/lib/fpa/Image/MoriRegionGrow.hxx
deleted file mode 100644 (file)
index 737bf1f..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-#ifndef __fpa__Image__MoriRegionGrow__hxx__
-#define __fpa__Image__MoriRegionGrow__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-TAuxImage*
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-GetAuxiliaryImage( )
-{
-  return( this->m_Helper->GetOutput( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-const typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-TAuxImage*
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-GetAuxiliaryImage( ) const
-{
-  return( this->m_Helper->GetOutput( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-TInputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-GetLower( ) const
-{
-  return( this->m_Helper->GetLower( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-TInputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-GetUpper( ) const
-{
-  return( this->m_Helper->GetUpper( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-TInputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-GetStep( ) const
-{
-  return( this->m_Helper->GetStep( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-TOutputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-GetInsideValue( ) const
-{
-  return( this->m_Threshold->GetInsideValue( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-typename
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-TOutputPixel
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-GetOutsideValue( ) const
-{
-  return( this->m_Threshold->GetInsideValue( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-SetLower( const TInputPixel& v )
-{
-  this->m_Helper->SetLower( v );
-  this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-SetUpper( const TInputPixel& v )
-{
-  this->m_Helper->SetUpper( v );
-  this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-SetStep( const TInputPixel& v )
-{
-  this->m_Helper->SetStep( v );
-  this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-SetInsideValue( const TOutputPixel& v )
-{
-  this->m_Threshold->SetInsideValue( v );
-  this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-SetOutsideValue( const TOutputPixel& v )
-{
-  this->m_Threshold->SetOutsideValue( v );
-  this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-MoriRegionGrow( )
-  : Superclass( )
-{
-  this->m_Helper = THelper::New( );
-  this->m_Threshold = TThreshold::New( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-~MoriRegionGrow( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TAuxPixel >
-void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage, _TAuxPixel >::
-GenerateData( )
-{
-  this->m_Helper->ClearSeeds( );
-  this->m_Helper->AddSeed( this->m_Seed, 0 );
-  this->m_Helper->SetInput( this->GetInput( ) );
-  this->m_Helper->Update( );
-
-  this->m_Threshold->SetInput( this->m_Helper->GetOutput( ) );
-  this->m_Threshold->SetLowerThreshold( std::numeric_limits< _TAuxPixel >::min( ) );
-  this->m_Threshold->SetUpperThreshold( this->m_Helper->GetOptimumThreshold( ) );
-  this->m_Threshold->Update( );
-  this->GetOutput( )->Graft( this->m_Threshold->GetOutput( ) );
-}
-
-#endif // __fpa__Image__MoriRegionGrow__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/MoriRegionGrowHelper.h b/lib/fpa/Image/MoriRegionGrowHelper.h
deleted file mode 100644 (file)
index 02f51b6..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-#ifndef __fpa__Image__MoriRegionGrowHelper__h__
-#define __fpa__Image__MoriRegionGrowHelper__h__
-
-#include <utility>
-#include <vector>
-#include <fpa/Image/RegionGrow.h>
-#include <fpa/Image/Functors/RegionGrow/BinaryThreshold.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TInputImage, class _TOutputImage >
-    class MoriRegionGrowHelper
-      : public fpa::Image::RegionGrow< _TInputImage, _TOutputImage >
-    {
-    public:
-      typedef MoriRegionGrowHelper                                        Self;
-      typedef fpa::Image::RegionGrow< _TInputImage, _TOutputImage > Superclass;
-      typedef itk::SmartPointer< Self >                             Pointer;
-      typedef itk::SmartPointer< const Self >                       ConstPointer;
-
-      typedef typename Superclass::TOutput       TOutput;
-      typedef typename Superclass::TVertex       TVertex;
-      typedef typename Superclass::TGrowFunction TGrowFunction;
-      typedef typename _TInputImage::PixelType   TPixel;
-      typedef fpa::Image::Functors::RegionGrow::BinaryThreshold< _TInputImage, TOutput > TBinThresholdFunction;
-
-    protected:
-      typedef typename Superclass::_TQueueNode _TQueueNode;
-      typedef typename Superclass::_TQueue     _TQueue;
-
-      typedef std::pair< TPixel, unsigned long > TCurveData;
-      typedef std::vector< TCurveData >          TCurve;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::MoriRegionGrowHelper, fpa::Image::RegionGrow );
-
-      itkGetConstMacro( Lower, TPixel );
-      itkGetConstMacro( Upper, TPixel );
-      itkGetConstMacro( Step, TPixel );
-      itkGetConstMacro( OptimumThreshold, typename _TOutputImage::PixelType );
-
-      itkSetMacro( Lower, TPixel );
-      itkSetMacro( Upper, TPixel );
-      itkSetMacro( Step, TPixel );
-
-
-    protected:
-      MoriRegionGrowHelper( );
-      virtual ~MoriRegionGrowHelper( );
-
-      virtual bool _ContinueGenerateData( ) override;
-      virtual void _BeforeGenerateData( ) override;
-      virtual void _AfterGenerateData( ) override;
-      virtual void _BeforeLoop( ) override;
-      virtual void _AfterLoop( ) override;
-      virtual bool _UpdateValue( _TQueueNode& v, const _TQueueNode& p ) override;
-      virtual void _UpdateResult( const _TQueueNode& n ) override;
-
-    private:
-      // Purposely not defined
-      MoriRegionGrowHelper( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      TPixel m_Lower;
-      TPixel m_Upper;
-      TPixel m_Step;
-      typename _TOutputImage::PixelType m_OptimumThreshold;
-
-      _TQueue m_NextQueue;
-      unsigned long m_ActualCount;
-      TCurve m_Curve;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/MoriRegionGrowHelper.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__MoriRegionGrowHelper__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/MoriRegionGrowHelper.hxx b/lib/fpa/Image/MoriRegionGrowHelper.hxx
deleted file mode 100644 (file)
index 9dc1df3..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-#ifndef __fpa__Image__MoriRegionGrowHelper__hxx__
-#define __fpa__Image__MoriRegionGrowHelper__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-MoriRegionGrowHelper( )
-  : Superclass( ),
-    m_Step( TPixel( 1 ) )
-{
-  this->m_Upper = std::numeric_limits< TPixel >::max( );
-  if( std::numeric_limits< TPixel >::is_integer )
-    this->m_Lower = std::numeric_limits< TPixel >::min( );
-  else
-    this->m_Lower = -this->m_Upper;
-  typename TBinThresholdFunction::Pointer functor =
-    TBinThresholdFunction::New( );
-  this->SetGrowFunction( functor );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-~MoriRegionGrowHelper( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-bool fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-_ContinueGenerateData( )
-{
-  TBinThresholdFunction* functor =
-    dynamic_cast< TBinThresholdFunction* >( this->GetGrowFunction( ) );
-  TPixel u = functor->GetUpper( );
-
-  // Update flooding data
-  this->m_Curve.push_back( TCurveData( u, this->m_ActualCount ) );
-
-  // Update thresholds
-  if( u < this->m_Upper )
-  {
-    u += this->m_Step;
-    if( u > this->m_Upper )
-      u = this->m_Upper;
-    functor->SetUpper( u );
-    this->m_Queue = this->m_NextQueue;
-    while( this->m_NextQueue.size( ) > 0 )
-      this->m_NextQueue.pop( );
-    return( true );
-  }
-  else
-    return( false );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-_BeforeGenerateData( )
-{
-  this->Superclass::_BeforeGenerateData( );
-
-  while( this->m_NextQueue.size( ) > 0 )
-    this->m_NextQueue.pop( );
-  this->m_OptimumThreshold = ( typename _TOutputImage::PixelType )( 0 );
-  this->m_ActualCount = 0;
-  this->m_Curve.clear( );
-  TBinThresholdFunction* functor =
-    dynamic_cast< TBinThresholdFunction* >( this->GetGrowFunction( ) );
-  functor->SetLower( this->m_Lower );
-  functor->SetUpper( this->m_Lower + this->m_Step );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-_AfterGenerateData( )
-{
-  typedef typename _TOutputImage::PixelType _TOut;
-
-  this->Superclass::_AfterGenerateData( );
-  while( this->m_NextQueue.size( ) > 0 )
-    this->m_NextQueue.pop( );
-
-  // Find optimum threshold by dicotomy
-  unsigned long l = 0;
-  unsigned long r = this->m_Curve.size( ) - 1;
-  while( ( r - l ) > 1 )
-  {
-    unsigned long m = ( r + l ) >> 1;
-    double vm = double( this->m_Curve[ m ].second );
-    double dl = vm - double( this->m_Curve[ l ].second );
-    double dr = double( this->m_Curve[ r ].second ) - vm;
-    if( dl > dr )
-      r = m;
-    else
-      l = m;
-
-  } // elihw
-  this->m_OptimumThreshold = _TOut( ( r + l ) >> 1 );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-_BeforeLoop( )
-{
-  this->Superclass::_BeforeLoop( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-_AfterLoop( )
-{
-  this->Superclass::_AfterLoop( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-bool fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-_UpdateValue( _TQueueNode& v, const _TQueueNode& p )
-{
-  typedef typename _TOutputImage::PixelType _TOut;
-
-  bool ret = this->Superclass::_UpdateValue( v, p );
-  v.Result = _TOut( this->m_Curve.size( ) + 1 );
-  if( !ret )
-    this->m_NextQueue.push( v );
-  return( ret );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpa::Image::MoriRegionGrowHelper< _TInputImage, _TOutputImage >::
-_UpdateResult( const _TQueueNode& n )
-{
-  this->Superclass::_UpdateResult( n );
-  this->m_ActualCount += 1;
-}
-
-#endif // __fpa__Image__MoriRegionGrowHelper__hxx__
-
-// eof - $RCSfile$
index dbc57f00759be5d017c1c49bb0c42f0eba583c71..5d7b4db227fabcbf2aeda4fd19f4b09a3041400b 100644 (file)
@@ -1,8 +1,15 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Image__RegionGrow__h__
 #define __fpa__Image__RegionGrow__h__
 
 #include <fpa/Base/RegionGrow.h>
-#include <fpa/Image/Algorithm.h>
+#include <fpa/Base/SeedsInterface.h>
+#include <fpa/Image/MarksInterface.h>
+#include <fpa/Image/Filter.h>
 
 namespace fpa
 {
@@ -12,32 +19,29 @@ namespace fpa
      */
     template< class _TInputImage, class _TOutputImage >
     class RegionGrow
-      : public fpa::Base::RegionGrow< fpa::Image::Algorithm< _TInputImage, _TOutputImage > >
+      : public fpa::Base::RegionGrow< fpa::Image::Filter< _TInputImage, _TOutputImage >, fpa::Image::MarksInterface< _TInputImage::ImageDimension >, fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::IndexType::LexicographicCompare > >
     {
     public:
-      typedef fpa::Image::Algorithm< _TInputImage, _TOutputImage > TAlgorithm;
-      typedef RegionGrow                          Self;
-      typedef fpa::Base::RegionGrow< TAlgorithm > Superclass;
-      typedef itk::SmartPointer< Self >           Pointer;
-      typedef itk::SmartPointer< const Self >     ConstPointer;
-
-      typedef typename Superclass::TOutput TOutput;
-      typedef typename Superclass::TVertex TVertex;
+      // Interfaces
+      typedef fpa::Image::Filter< _TInputImage, _TOutputImage > TFilter;
+      typedef fpa::Image::MarksInterface< _TInputImage::ImageDimension > TMarksInterface;
+      typedef fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::IndexType::LexicographicCompare > TSeedsInterface;
 
-      typedef fpa::Image::Functors::Base< _TInputImage, typename Superclass::TGrowFunction > TGrowFunction;
+      // Smart pointers
+      typedef RegionGrow Self;
+      typedef fpa::Base::RegionGrow< TFilter, TMarksInterface, TSeedsInterface > Superclass;
+      typedef itk::SmartPointer< Self > Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
 
     public:
       itkNewMacro( Self );
       itkTypeMacro( fpa::Image::RegionGrow, fpa::Base::RegionGrow );
 
     protected:
-      RegionGrow( );
-      virtual ~RegionGrow( );
-
-      virtual void _BeforeGenerateData( ) override;
+      RegionGrow( ) : Superclass( ) { }
+      virtual ~RegionGrow( )        { }
 
     private:
-      // Purposely not defined
       RegionGrow( const Self& other );
       Self& operator=( const Self& other );
     };
@@ -46,10 +50,6 @@ namespace fpa
 
 } // ecapseman
 
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/RegionGrow.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
 #endif // __fpa__Image__RegionGrow__h__
 
 // eof - $RCSfile$
diff --git a/lib/fpa/Image/RegionGrow.hxx b/lib/fpa/Image/RegionGrow.hxx
deleted file mode 100644 (file)
index 326dc54..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef __fpa__Image__RegionGrow__hxx__
-#define __fpa__Image__RegionGrow__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-fpa::Image::RegionGrow< _TInputImage, _TOutputImage >::
-RegionGrow( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-fpa::Image::RegionGrow< _TInputImage, _TOutputImage >::
-~RegionGrow( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpa::Image::RegionGrow< _TInputImage, _TOutputImage >::
-_BeforeGenerateData( )
-{
-  this->Superclass::_BeforeGenerateData( );
-  this->m_InitResult = this->GetOutsideValue( );
-  TGrowFunction* grow =
-    dynamic_cast< TGrowFunction* >( this->GetGrowFunction( ) );
-  if( grow != NULL )
-    grow->SetImage( this->GetInput( ) );
-}
-
-#endif // __fpa__Image__RegionGrow__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/SkeletonFilter.h b/lib/fpa/Image/SkeletonFilter.h
deleted file mode 100644 (file)
index 0fbb3d5..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef __fpa__Image__SkeletonFilter__h__
-#define __fpa__Image__SkeletonFilter__h__
-
-#include <map>
-#include <vector>
-#include <fpa/Image/Dijkstra.h>
-#include <cpExtensions/DataStructures/Skeleton.h>
-#include <itkSimpleDataObjectDecorator.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TImage >
-    class SkeletonFilter
-      : public Dijkstra< _TImage, _TImage >
-    {
-    public:
-      typedef SkeletonFilter                  Self;
-      typedef Dijkstra< _TImage, _TImage >    Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      typedef _TImage TImage;
-      itkStaticConstMacro(
-        Dimension, unsigned int, TImage::ImageDimension
-        );
-
-      typedef typename Superclass::TMST  TMST;
-      typedef typename TImage::IndexType TIndex;
-      typedef itk::Image< unsigned char, Self::Dimension > TMarks;
-      typedef cpExtensions::DataStructures::Skeleton< Self::Dimension > TSkeleton;
-
-    protected:
-      typedef typename Superclass::_TQueueNode _TQueueNode;
-      typedef std::multimap< double, TIndex, std::greater< double > > _TSkeletonQueue;
-      typedef std::map< TIndex, TIndex, typename TIndex::LexicographicCompare > _TAdjacencies;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::SkeletonFilter, itk::Object );
-
-    public:
-      TSkeleton* GetSkeleton( );
-      TMarks* GetMarks( );
-
-    protected:
-      SkeletonFilter( );
-      virtual ~SkeletonFilter( );
-
-      virtual void _BeforeGenerateData( ) override;
-      virtual void _UpdateResult( const _TQueueNode& n ) override;
-      virtual void _AfterGenerateData( ) override;
-
-      void _EndPoints( std::vector< TIndex >& end_points, _TAdjacencies& A );
-      void _Skeleton( const std::vector< TIndex >& end_points, _TAdjacencies& A );
-      void _MarkSphere( const TIndex& idx );
-
-    private:
-      // Purposely not defined
-      SkeletonFilter( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      _TSkeletonQueue m_SkeletonQueue;
-
-      unsigned long m_SkeletonIdx;
-      unsigned long m_MarksIdx;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/SkeletonFilter.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__SkeletonFilter__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/SkeletonFilter.hxx b/lib/fpa/Image/SkeletonFilter.hxx
deleted file mode 100644 (file)
index c60e13c..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-#ifndef __fpa__Image__SkeletonFilter__hxx__
-#define __fpa__Image__SkeletonFilter__hxx__
-
-#include <fpa/Base/Functors/Inverse.h>
-#include <fpa/Image/Functors/SimpleNeighborhood.h>
-#include <itkImageRegionIteratorWithIndex.h>
-
-// -------------------------------------------------------------------------
-#define fpa_Image_SkeletonFilter_OutputMacro( o_n, o_t )                \
-  template< class _TImage >                                             \
-  typename fpa::Image::SkeletonFilter< _TImage >::                      \
-  o_t* fpa::Image::SkeletonFilter< _TImage >::                          \
-  Get##o_n( )                                                           \
-  {                                                                     \
-    return(                                                             \
-      dynamic_cast< o_t* >(                                             \
-        this->itk::ProcessObject::GetOutput( this->m_##o_n##Idx )       \
-        )                                                               \
-      );                                                                \
-  }
-
-fpa_Image_SkeletonFilter_OutputMacro( Skeleton, TSkeleton );
-fpa_Image_SkeletonFilter_OutputMacro( Marks, TMarks );
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-fpa::Image::SkeletonFilter< _TImage >::
-SkeletonFilter( )
-  : Superclass( )
-{
-  typedef typename _TImage::PixelType _TPixel;
-  typedef fpa::Image::Functors::SimpleNeighborhood< _TImage::ImageDimension > _TNeighFunc;
-  typedef fpa::Base::Functors::Inverse< _TPixel, _TPixel > _TInvFunc;
-
-  unsigned int nOutputs = this->GetNumberOfRequiredOutputs( );
-  this->SetNumberOfRequiredOutputs( nOutputs + 2 );
-  this->m_SkeletonIdx = nOutputs;
-  this->m_MarksIdx = nOutputs + 1;
-
-  typename TSkeleton::Pointer skeleton = TSkeleton::New( );
-  typename TMarks::Pointer marks = TMarks::New( );
-  this->SetNthOutput( this->m_SkeletonIdx, skeleton.GetPointer( ) );
-  this->SetNthOutput( this->m_MarksIdx, marks.GetPointer( ) );
-
-  typename _TNeighFunc::Pointer nfunc = _TNeighFunc::New( );
-  nfunc->SetOrder( 2 );
-  this->SetNeighborhoodFunction( nfunc );
-
-  typename _TInvFunc::Pointer ifunc = _TInvFunc::New( );
-  this->SetConversionFunction( ifunc );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-fpa::Image::SkeletonFilter< _TImage >::
-~SkeletonFilter( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpa::Image::SkeletonFilter< _TImage >::
-_BeforeGenerateData( )
-{
-  this->Superclass::_BeforeGenerateData( );
-  this->m_SkeletonQueue.clear( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpa::Image::SkeletonFilter< _TImage >::
-_UpdateResult( const _TQueueNode& n )
-{
-  typedef typename _TSkeletonQueue::value_type _TSkeletonQueueValue;
-
-  this->Superclass::_UpdateResult( n );
-  double d = double( this->GetInput( )->GetPixel( n.Vertex ) );
-  if( d >= double( 0 ) )
-  {
-    // Update skeleton candidates
-    d += double( 1e-5 );
-    double v = double( n.Result ) / ( d * d );
-    this->m_SkeletonQueue.insert( _TSkeletonQueueValue( v, n.Vertex ) );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpa::Image::SkeletonFilter< _TImage >::
-_AfterGenerateData( )
-{
-  this->Superclass::_AfterGenerateData( );
-
-  _TAdjacencies A;
-  std::vector< TIndex > end_points;
-  this->_EndPoints( end_points, A );
-  this->_Skeleton( end_points, A );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpa::Image::SkeletonFilter< _TImage >::
-_EndPoints( std::vector< TIndex >& end_points, _TAdjacencies& A )
-{
-  auto marks = this->GetMarks( );
-  auto mst = this->GetMinimumSpanningTree( );
-  auto spac = marks->GetSpacing( );
-
-  // Some values
-  marks->SetLargestPossibleRegion( mst->GetLargestPossibleRegion( ) );
-  marks->SetRequestedRegion( mst->GetRequestedRegion( ) );
-  marks->SetBufferedRegion( mst->GetBufferedRegion( ) );
-  marks->SetSpacing( mst->GetSpacing( ) );
-  marks->SetOrigin( mst->GetOrigin( ) );
-  marks->SetDirection( mst->GetDirection( ) );
-  marks->Allocate( );
-  marks->FillBuffer( 0 );
-
-  // BFS from maximum queue
-  while( this->m_SkeletonQueue.size( ) > 0 )
-  {
-    // Get node
-    auto nIt = this->m_SkeletonQueue.begin( );
-    auto n = *nIt;
-    this->m_SkeletonQueue.erase( nIt );
-
-    // Mark it and update end-points
-    unsigned char m = marks->GetPixel( n.second );
-    if( m != 0 )
-      continue;
-    marks->SetPixel( n.second, 1 );
-    end_points.push_back( n.second );
-
-    // Mark path
-    TIndex it = n.second;
-    TIndex p = mst->GetParent( it );
-    while( it != p )
-    {
-      this->_MarkSphere( it );
-      it = p;
-      p = mst->GetParent( it );
-
-    } // elihw
-    this->_MarkSphere( it );
-    A[ n.second ] = it;
-
-  } // elihw
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpa::Image::SkeletonFilter< _TImage >::
-_Skeleton( const std::vector< TIndex >& end_points, _TAdjacencies& A )
-{
-  typedef itk::Image< unsigned long, Self::Dimension > _TTagsImage;
-  typedef typename TMST::TPath _TPath;
-
-  auto mst = this->GetMinimumSpanningTree( );
-  auto skeleton = this->GetSkeleton( );
-
-  // Tag branches
-  typename _TTagsImage::Pointer tags = _TTagsImage::New( );
-  tags->SetLargestPossibleRegion( mst->GetLargestPossibleRegion( ) );
-  tags->SetRequestedRegion( mst->GetRequestedRegion( ) );
-  tags->SetBufferedRegion( mst->GetBufferedRegion( ) );
-  tags->Allocate( );
-  tags->FillBuffer( 0 );
-  for( auto eIt = end_points.begin( ); eIt != end_points.end( ); ++eIt )
-  {
-    TIndex it = *eIt;
-    TIndex p = mst->GetParent( it );
-    while( it != p )
-    {
-      tags->SetPixel( it, tags->GetPixel( it ) + 1 );
-      it = p;
-      p = mst->GetParent( it );
-
-    } // elihw
-    tags->SetPixel( it, tags->GetPixel( it ) + 1 );
-
-  } // rof
-
-  // Build paths (branches)
-  for( auto eIt = end_points.begin( ); eIt != end_points.end( ); ++eIt )
-  {
-    TIndex it = *eIt;
-    TIndex p = mst->GetParent( it );
-    TIndex sIdx = *eIt;
-    typename _TPath::Pointer path = _TPath::New( );
-    path->SetReferenceImage( mst );
-    while( it != p )
-    {
-      if( tags->GetPixel( sIdx ) != tags->GetPixel( it ) )
-      {
-        // Ok, a new branch has been added
-        path->AddVertex( it );
-        skeleton->AddBranch( path );
-
-        // Update a new starting index
-        path = _TPath::New( );
-        path->SetReferenceImage( mst );
-        sIdx = it;
-      }
-      else
-        path->AddVertex( it );
-      it = p;
-      p = mst->GetParent( it );
-
-    } // elihw
-
-    // Finally, add last branch
-    path->AddVertex( it );
-    skeleton->AddBranch( path );
-
-  } // rof
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpa::Image::SkeletonFilter< _TImage >::
-_MarkSphere( const TIndex& idx )
-{
-  typedef itk::ImageRegionIteratorWithIndex< TMarks > _TMarksIt;
-
-  static const double _eps = std::sqrt( double( Self::Dimension + 1 ) );
-  auto input = this->GetInput( );
-  auto marks = this->GetMarks( );
-  auto spac = input->GetSpacing( );
-  auto region = input->GetRequestedRegion( );
-
-  typename _TImage::PointType cnt;
-  input->TransformIndexToPhysicalPoint( idx, cnt );
-  double r = double( input->GetPixel( idx ) ) * _eps;
-
-  TIndex i0, i1;
-  for( unsigned int d = 0; d < Self::Dimension; ++d )
-  {
-    long off = long( std::ceil( r / double( spac[ d ] ) ) );
-    if( off < 3 )
-      off = 3;
-    i0[ d ] = idx[ d ] - off;
-    i1[ d ] = idx[ d ] + off;
-
-    if( i0[ d ] < region.GetIndex( )[ d ] )
-      i0[ d ] = region.GetIndex( )[ d ];
-
-    if( i1[ d ] >= region.GetIndex( )[ d ] + region.GetSize( )[ d ] )
-      i1[ d ] = region.GetIndex( )[ d ] + region.GetSize( )[ d ] - 1;
-
-  } // rof
-
-  typename _TImage::SizeType size;
-  for( unsigned int d = 0; d < Self::Dimension; ++d )
-    size[ d ] = i1[ d ] - i0[ d ] + 1;
-
-  typename _TImage::RegionType neighRegion;
-  neighRegion.SetIndex( i0 );
-  neighRegion.SetSize( size );
-
-  _TMarksIt mIt( marks, neighRegion );
-  for( mIt.GoToBegin( ); !mIt.IsAtEnd( ); ++mIt )
-  {
-    TIndex w = mIt.GetIndex( );
-    typename _TImage::PointType p;
-    marks->TransformIndexToPhysicalPoint( w, p );
-    mIt.Set( 1 );
-
-  } // rof
-}
-
-#endif // __fpa__Image__SkeletonFilter__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpaInstances/BaseFilters.i b/lib/fpaInstances/BaseFilters.i
deleted file mode 100644 (file)
index 0cc752f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-header #define ITK_MANUAL_INSTANTIATION
-
-*define i_scalars=#scalar_types#
-*define o_scalars=#scalar_types#
-
-*tinclude fpa/Base/Algorithm:h|hxx
-*tinclude fpa/Image/Algorithm:h|hxx
-
-*instances fpa::Base::Algorithm< itk::ImageToImageFilter< itk::Image< #i_scalars#, #pdims# >, itk::Image< #o_scalars#, #pdims# > >, itk::Index< #pdims# >, #o_scalars# >
-*instances fpa::Image::Algorithm< itk::Image< #i_scalars#, #pdims# >, itk::Image< #o_scalars#, #pdims# > >
-
-** eof - $RCSfile$
diff --git a/lib/fpaInstances/CMakeLists.txt b/lib/fpaInstances/CMakeLists.txt
deleted file mode 100644 (file)
index f7d1114..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-## ===========================
-## == Compile each instance ==
-## ===========================
-IF(USE_cpPlugins)
-  INCLUDE_DIRECTORIES(
-    ${PROJECT_SOURCE_DIR}/lib
-    ${PROJECT_BINARY_DIR}/lib
-    )
-  SET(_pfx fpaInstaces)
-  SET(_instances
-    DataObjects
-    ImageFunctors
-    ImageFilters
-    )
-  SET(_build_instances)
-  FOREACH(_i ${_instances})
-    cpPlugins_BuildLibrary(
-      ${_pfx}${_i} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/${_i}.i
-      )
-    TARGET_LINK_LIBRARIES(
-      ${_pfx}${_i}
-      ${cpPlugins_AllInstances} ${ITK_LIBRARIES} ${VTK_LIBRARIES}
-      )
-    LIST(APPEND _build_instances ${_pfx}${_i})
-  ENDFOREACH(_i)
-
-  TARGET_LINK_LIBRARIES(
-    ${_pfx}ImageFilters
-    ${_pfx}DataObjects
-    ${_pfx}ImageFunctors
-    cpPlugins_ITKUnaryFunctorFilters
-    )
-  SET(
-    fpa_AllInstances
-    ${_build_instances}
-    CACHE INTERNAL "All valid instances." FORCE
-    )
-ENDIF(USE_cpPlugins)
-
-## eof - $RCSfile$
diff --git a/lib/fpaInstances/DataObjects.i b/lib/fpaInstances/DataObjects.i
deleted file mode 100644 (file)
index 2cc585f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-header #define ITK_MANUAL_INSTANTIATION
-
-tinclude fpa/Base/MinimumSpanningTree:h|hxx
-tinclude fpa/Image/MinimumSpanningTree:h|hxx
-
-instances fpa::Base::MinimumSpanningTree< itk::Index< #pdims# >, cpExtensions::DataStructures::PolyLineParametricPath< #pdims# >, itk::Image< itk::Offset< #pdims# >, #pdims# > >
-instances fpa::Image::MinimumSpanningTree< #pdims# >
-
-** eof - $RCSfile$
diff --git a/lib/fpaInstances/ImageFilters.i b/lib/fpaInstances/ImageFilters.i
deleted file mode 100644 (file)
index e773c11..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-header #define ITK_MANUAL_INSTANTIATION
-
-define all_inputs=#scalar_types#
-define all_outputs=#scalar_types#
-define all_int_types=#int_types#;#uint_types#
-
-tinclude fpa/Base/Algorithm:h|hxx
-tinclude fpa/Image/Algorithm:h|hxx
-tinclude fpa/Image/RegionGrow:h|hxx
-tinclude fpa/Base/RegionGrow:h|hxx
-tinclude fpa/Image/Dijkstra:h|hxx
-tinclude fpa/Image/FastMarching:h|hxx
-
-cinclude fpa/Base/QueueAlgorithm.hxx
-cinclude fpa/Base/PriorityQueueAlgorithm.hxx
-cinclude fpa/Base/Dijkstra.hxx
-cinclude fpa/Base/FastMarching.hxx
-
-instances fpa::Base::Algorithm< itk::ImageToImageFilter< itk::Image< #all_inputs#, #pdims# >, itk::Image< #all_outputs#, #pdims# > >, itk::Index< #pdims# >, #all_outputs# >
-instances fpa::Image::Algorithm< itk::Image< #scalar_types#, #pdims# >, itk::Image< #all_int_types#, #pdims# > >
-
-instances fpa::Base::RegionGrow< fpa::Image::Algorithm< itk::Image< #scalar_types#, #pdims# >, itk::Image< #all_int_types#, #pdims# > > >
-instances fpa::Image::RegionGrow< itk::Image< #scalar_types#, #pdims# >, itk::Image< #all_int_types#, #pdims# > >
-
-instances fpa::Image::Dijkstra< itk::Image< #scalar_types#, #pdims# >, itk::Image< #real_types#, #pdims# > >
-instances fpa::Image::FastMarching< itk::Image< #scalar_types#, #pdims# >, itk::Image< #real_types#, #pdims# > >
-
-** eof - $RCSfile$
diff --git a/lib/fpaInstances/ImageFunctors.i b/lib/fpaInstances/ImageFunctors.i
deleted file mode 100644 (file)
index e410091..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-header #define ITK_MANUAL_INSTANTIATION
-
-define all_int_types=#int_types#;#uint_types#
-define i_scalar_types=#scalar_types#
-define o_scalar_types=#scalar_types#
-
-tinclude fpa/Image/Functors/VertexCost:h|hxx
-tinclude fpa/Image/Functors/SimpleNeighborhood:h|hxx
-tinclude fpa/Image/Functors/RegionGrow/BinaryThreshold:h|hxx
-cinclude itkImage.h
-
-instances fpa::Image::Functors::VertexCost< itk::Image< #i_scalar_types#, #pdims# >, #o_scalar_types# >
-instances fpa::Image::Functors::SimpleNeighborhood< #pdims# >
-instances fpa::Image::Functors::RegionGrow::BinaryThreshold< itk::Image< #scalar_types#, #pdims# >, #all_int_types# >
-
-** eof - $RCSfile$
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
deleted file mode 100644 (file)
index 7a565b0..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-## ==========================
-## == Build plugin library ==
-## ==========================
-
-IF(USE_cpPlugins)
-  INCLUDE_DIRECTORIES(
-    ${PROJECT_SOURCE_DIR}/lib
-    ${PROJECT_BINARY_DIR}/lib
-    ${PROJECT_SOURCE_DIR}/plugins
-    ${PROJECT_BINARY_DIR}/plugins
-    )
-
-  SET(
-    _dirs
-    Functors
-    ImageFunctors
-    ImageAlgorithms
-    # RegionGrowFunctors
-    # DijkstraFunctors
-    )
-
-  FOREACH(_d ${_dirs})
-    cpPlugins_BuildPluginsLibrary(
-      fpaPlugins_${_d} ${CMAKE_CURRENT_SOURCE_DIR}/${_d}
-      )
-    TARGET_LINK_LIBRARIES(
-      fpaPlugins_${_d}
-      cpPlugins cpPluginsDataObjects cpExtensions
-      ${fpa_AllInstances}
-      )
-  ENDFOREACH(_d)
-
-
-#  OPTION(BUILD_ExperimentationPlugins "Build plugins for experimentation?" OFF)
-#  IF(BUILD_ExperimentationPlugins)
-#    LIST(APPEND _dirs Experiments)
-#  ENDIF(BUILD_ExperimentationPlugins)
-
-#  FOREACH(_d ${_dirs})
-#    cpPlugins_BuildPluginsLibrary(
-#      fpaPlugins${_d} ${CMAKE_CURRENT_SOURCE_DIR}/${_d}
-#      )
-#    TARGET_LINK_LIBRARIES(
-#      fpaPlugins${_d}
-#      cpPlugins cpPluginsDataObjects cpExtensions
-#      ${fpa_AllInstances}
-#      )
-#  ENDFOREACH(_d)
-#  TARGET_LINK_LIBRARIES(
-#    fpaPluginsImageAlgorithms
-#    cpPlugins_ITKUnaryFunctorFilters
-#    fpaPluginsRegionGrowFunctors
-#    fpaPluginsDijkstraFunctors
-#    )
-ENDIF(USE_cpPlugins)
-
-## eof - $RCSfile$
diff --git a/plugins/DijkstraFunctors/DijkstraFunctors.i b/plugins/DijkstraFunctors/DijkstraFunctors.i
deleted file mode 100644 (file)
index b251418..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-header #define ITK_MANUAL_INSTANTIATION
-
-define i_reals=#real_types#
-define o_reals=#real_types#
-tinclude fpa/Base/Functors/Inverse:h|hxx
-tinclude fpa/Base/Functors/GaussianModel:h|hxx
-
-instances fpa::Base::Functors::Inverse< #i_reals#, #o_reals# >
-instances fpa::Base::Functors::GaussianModel< #i_reals#, #o_reals# >
-
-
-** eof - $RCSfile$
diff --git a/plugins/DijkstraFunctors/ExtractPathFromMinimumSpanningTree.cxx b/plugins/DijkstraFunctors/ExtractPathFromMinimumSpanningTree.cxx
deleted file mode 100644 (file)
index 1aa6d48..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#include <DijkstraFunctors/ExtractPathFromMinimumSpanningTree.h>
-#include <cpInstances/DataObjects/Image.h>
-#include <cpInstances/DataObjects/PolyLineParametricPath.h>
-#include <vtkPolyData.h>
-#include <fpa/Image/MinimumSpanningTree.h>
-
-// -------------------------------------------------------------------------
-fpaPluginsDijkstraFunctors::ExtractPathFromMinimumSpanningTree::
-ExtractPathFromMinimumSpanningTree( )
-  : Superclass( )
-{
-  typedef cpPlugins::Pipeline::DataObject             _TData;
-  typedef cpInstances::DataObjects::Image                  _TMST;
-  typedef cpInstances::DataObjects::PolyLineParametricPath _TPath;
-
-  this->_ConfigureInput< _TMST >( "MST", true, false );
-  this->_ConfigureInput< _TData >( "Seeds", true, false );
-  this->_ConfigureOutput< _TPath >( "Output" );
-}
-
-// -------------------------------------------------------------------------
-fpaPluginsDijkstraFunctors::ExtractPathFromMinimumSpanningTree::
-~ExtractPathFromMinimumSpanningTree( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPluginsDijkstraFunctors::ExtractPathFromMinimumSpanningTree::
-_GenerateData( )
-{
-  typedef fpa::Image::MinimumSpanningTree< 2 > _TMST2;
-  typedef fpa::Image::MinimumSpanningTree< 3 > _TMST3;
-
-  auto mst2 = this->GetInputData< _TMST2 >( "MST" );
-  auto mst3 = this->GetInputData< _TMST3 >( "MST" );
-  if     ( mst2 != NULL ) this->_GD0( mst2 );
-  else if( mst3 != NULL ) this->_GD0( mst3 );
-  else this->_Error( "Invalid input spanning tree." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TMST >
-void fpaPluginsDijkstraFunctors::ExtractPathFromMinimumSpanningTree::
-_GD0( _TMST* mst )
-{
-  typedef typename _TMST::IndexType _TIndex;
-  typedef typename _TMST::TPath     _TPath;
-
-  // Get seeds
-  std::vector< _TIndex > seeds;
-  auto points = this->GetInputData< vtkPolyData >( "Seeds" );
-  if( points != NULL )
-  {
-    if( points->GetNumberOfPoints( ) < 2 )
-      this->_Error( "Not enough seeds (<2)." );
-
-    typename _TMST::PointType pnt;
-    typename _TMST::IndexType idx;
-    unsigned int dim =
-      ( _TMST::ImageDimension < 3 )? _TMST::ImageDimension: 3;
-    for( unsigned int i = 0; i < 2; ++i )
-    {
-      double buf[ 3 ];
-      points->GetPoint( i, buf );
-      pnt.Fill( 0 );
-      for( unsigned int d = 0; d < dim; ++d )
-        pnt[ d ] = buf[ d ];
-      if( mst->TransformPhysicalPointToIndex( pnt, idx ) )
-        seeds.push_back( idx );
-
-    } // rof
-
-  } // fi
-
-  typename _TPath::Pointer path;
-  mst->GetPath( path, seeds[ 0 ], seeds[ 1 ] );
-  this->GetOutput( "Output" )->SetITK( path );
-}
-
-// eof - $RCSfile$
diff --git a/plugins/DijkstraFunctors/ExtractPathFromMinimumSpanningTree.h b/plugins/DijkstraFunctors/ExtractPathFromMinimumSpanningTree.h
deleted file mode 100644 (file)
index f98e959..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __fpaPluginsDijkstraFunctors__ExtractPathFromMinimumSpanningTree__h__
-#define __fpaPluginsDijkstraFunctors__ExtractPathFromMinimumSpanningTree__h__
-
-#include <fpaPluginsDijkstraFunctors_Export.h>
-#include <cpPlugins/Pipeline/ProcessObject.h>
-
-namespace fpaPluginsDijkstraFunctors
-{
-  /**
-   */
-  class fpaPluginsDijkstraFunctors_EXPORT ExtractPathFromMinimumSpanningTree
-    : public cpPlugins::Pipeline::ProcessObject
-  {
-    cpPluginsObject(
-      ExtractPathFromMinimumSpanningTree,
-      cpPlugins::Pipeline::ProcessObject,
-      fpaDijkstraFunctors
-      );
-
-  protected:
-    template< class _TMST >
-    inline void _GD0( _TMST* mst );
-  };
-
-} // ecapseman
-
-#endif // __fpaPluginsDijkstraFunctors__ExtractPathFromMinimumSpanningTree__h__
-
-// eof - $RCSfile$
diff --git a/plugins/DijkstraFunctors/GaussianModelCost.cxx b/plugins/DijkstraFunctors/GaussianModelCost.cxx
deleted file mode 100644 (file)
index 0b62621..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <DijkstraFunctors/GaussianModelCost.h>
-#include <cpInstances/DataObjects/Image.h>
-
-#include <fpa/Base/Functors/GaussianModel.h>
-
-// -------------------------------------------------------------------------
-fpaPluginsDijkstraFunctors::GaussianModelCost::
-GaussianModelCost( )
-  : Superclass( )
-{
-  typedef cpPlugins::Pipeline::DataObject _TData;
-  this->_ConfigureOutput< _TData >( "Output" );
-
-  std::vector< std::string > choices;
-  choices.push_back( "float" );
-  choices.push_back( "double" );
-  this->m_Parameters.ConfigureAsChoices( "ResultType", choices );
-  this->m_Parameters.SetSelectedChoice( "ResultType", "float" );
-}
-
-// -------------------------------------------------------------------------
-fpaPluginsDijkstraFunctors::GaussianModelCost::
-~GaussianModelCost( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPluginsDijkstraFunctors::GaussianModelCost::
-_GenerateData( )
-{
-  auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" );
-  if     ( rtype == "float"  ) this->_GD0< float >( );
-  else if( rtype == "double" ) this->_GD0< double >( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TOutput >
-void fpaPluginsDijkstraFunctors::GaussianModelCost::
-_GD0( )
-{
-  typedef fpa::Base::Functors::GaussianModel< _TOutput, _TOutput > _TFunctor;
-
-  auto out = this->GetOutput( "Output" );
-  auto f = out->GetITK< _TFunctor >( );
-  if( f == NULL )
-  {
-    typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
-    f = ptr_f.GetPointer( );
-    out->SetITK( f );
-
-  } // fi
-}
-
-// eof - $RCSfile$
diff --git a/plugins/DijkstraFunctors/GaussianModelCost.h b/plugins/DijkstraFunctors/GaussianModelCost.h
deleted file mode 100644 (file)
index 8a204ab..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __fpa__Plugins__GaussianModelCost__h__
-#define __fpa__Plugins__GaussianModelCost__h__
-
-#include <fpaPluginsDijkstraFunctors_Export.h>
-#include <cpPlugins/Pipeline/ProcessObject.h>
-
-namespace fpaPluginsDijkstraFunctors
-{
-  /**
-   */
-  class fpaPluginsDijkstraFunctors_EXPORT GaussianModelCost
-    : public cpPlugins::Pipeline::ProcessObject
-  {
-    cpPluginsObject(
-      GaussianModelCost,
-      cpPlugins::Pipeline::ProcessObject,
-      fpaDijkstraFunctors
-      );
-
-  protected:
-    template< class _TOutput >
-    inline void _GD0( );
-  };
-
-} // ecapseman
-
-#endif // __fpa__Plugins__GaussianModelCost__h__
-
-// eof - $RCSfile$
diff --git a/plugins/DijkstraFunctors/InvertCost.cxx b/plugins/DijkstraFunctors/InvertCost.cxx
deleted file mode 100644 (file)
index f5a1338..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <DijkstraFunctors/InvertCost.h>
-#include <cpInstances/DataObjects/Image.h>
-
-#include <fpa/Base/Functors/Inverse.h>
-
-// -------------------------------------------------------------------------
-fpaPluginsDijkstraFunctors::InvertCost::
-InvertCost( )
-  : Superclass( )
-{
-  typedef cpPlugins::Pipeline::DataObject _TData;
-  this->_ConfigureOutput< _TData >( "Output" );
-
-  std::vector< std::string > choices;
-  choices.push_back( "float" );
-  choices.push_back( "double" );
-  this->m_Parameters.ConfigureAsChoices( "ResultType", choices );
-  this->m_Parameters.ConfigureAsReal( "NegativeValue", -1 );
-  this->m_Parameters.SetSelectedChoice( "ResultType", "float" );
-}
-
-// -------------------------------------------------------------------------
-fpaPluginsDijkstraFunctors::InvertCost::
-~InvertCost( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPluginsDijkstraFunctors::InvertCost::
-_GenerateData( )
-{
-  auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" );
-  if     ( rtype == "float"  ) this->_GD0< float >( );
-  else if( rtype == "double" ) this->_GD0< double >( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TOutput >
-void fpaPluginsDijkstraFunctors::InvertCost::
-_GD0( )
-{
-  typedef fpa::Base::Functors::Inverse< _TOutput, _TOutput > _TFunctor;
-
-  auto out = this->GetOutput( "Output" );
-  auto f = out->GetITK< _TFunctor >( );
-  if( f == NULL )
-  {
-    typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
-    f = ptr_f.GetPointer( );
-    out->SetITK( f );
-
-  } // fi
-  f->SetNegativeValue( this->m_Parameters.GetReal( "NegativeValue" ) );
-}
-
-// eof - $RCSfile$
diff --git a/plugins/DijkstraFunctors/InvertCost.h b/plugins/DijkstraFunctors/InvertCost.h
deleted file mode 100644 (file)
index c45c732..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __fpa__Plugins__InvertCost__h__
-#define __fpa__Plugins__InvertCost__h__
-
-#include <fpaPluginsDijkstraFunctors_Export.h>
-#include <cpPlugins/Pipeline/ProcessObject.h>
-
-namespace fpaPluginsDijkstraFunctors
-{
-  /**
-   */
-  class fpaPluginsDijkstraFunctors_EXPORT InvertCost
-    : public cpPlugins::Pipeline::ProcessObject
-  {
-    cpPluginsObject(
-      InvertCost,
-      cpPlugins::Pipeline::ProcessObject,
-      fpaDijkstraFunctors
-      );
-
-  protected:
-    template< class _TOutput >
-    inline void _GD0( );
-  };
-
-} // ecapseman
-
-#endif // __fpa__Plugins__InvertCost__h__
-
-// eof - $RCSfile$
diff --git a/plugins/DijkstraFunctors/SimpleImageDijkstraCost.cxx b/plugins/DijkstraFunctors/SimpleImageDijkstraCost.cxx
deleted file mode 100644 (file)
index a053e86..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#include <DijkstraFunctors/SimpleImageDijkstraCost.h>
-#include <cpInstances/DataObjects/Image.h>
-
-#include <itkImage.h>
-
-// TODO: #include <fpa/Image/Functors/SimpleDijkstraCost.h>
-
-// -------------------------------------------------------------------------
-fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost::
-SimpleImageDijkstraCost( )
-  : Superclass( )
-{
-  typedef cpPlugins::Pipeline::DataObject _TData;
-  typedef cpInstances::DataObjects::Image _TImage;
-
-  this->_ConfigureInput< _TImage >( "Input", true, false );
-  this->_ConfigureOutput< _TData >( "Output" );
-
-  std::vector< std::string > choices;
-  choices.push_back( "float" );
-  choices.push_back( "double" );
-  this->m_Parameters.ConfigureAsChoices( "ResultType", choices );
-  this->m_Parameters.SetSelectedChoice( "ResultType", "float" );
-  this->m_Parameters.ConfigureAsBool( "UseImageSpacing", false );
-}
-
-// -------------------------------------------------------------------------
-fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost::
-~SimpleImageDijkstraCost( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost::
-_GenerateData( )
-{
-  auto o = this->GetInputData( "Input" );
-  cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
-    this->_Error( "Invalid input image." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost::
-_GD0( _TImage* image )
-{
-  auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" );
-  if     ( rtype == "float"  ) this->_GD1< _TImage, float >( image );
-  else if( rtype == "double" ) this->_GD1< _TImage, double >( image );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage, class _TOutput >
-void fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost::
-_GD1( _TImage* image )
-{
-  /* TODO
-     typedef
-     fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput >
-     _TFunctor;
-     auto out = this->GetOutput( "Output" );
-     auto f = out->GetITK< _TFunctor >( );
-     if( f == NULL )
-     {
-     typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
-     f = ptr_f.GetPointer( );
-     out->SetITK( f );
-
-     } // fi
-     f->SetUseImageSpacing( this->m_Parameters.GetBool( "UseImageSpacing" ) );
-  */
-}
-
-// eof - $RCSfile$
diff --git a/plugins/DijkstraFunctors/SimpleImageDijkstraCost.h b/plugins/DijkstraFunctors/SimpleImageDijkstraCost.h
deleted file mode 100644 (file)
index e1ff8e4..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __fpa__Plugins__SimpleImageDijkstraCost__h__
-#define __fpa__Plugins__SimpleImageDijkstraCost__h__
-
-#include <fpaPluginsDijkstraFunctors_Export.h>
-#include <cpPlugins/Pipeline/ProcessObject.h>
-
-namespace fpaPluginsDijkstraFunctors
-{
-  /**
-   */
-  class fpaPluginsDijkstraFunctors_EXPORT SimpleImageDijkstraCost
-    : public cpPlugins::Pipeline::ProcessObject
-  {
-    cpPluginsObject(
-      SimpleImageDijkstraCost,
-      cpPlugins::Pipeline::ProcessObject,
-      fpaDijkstraFunctors
-      );
-
-  protected:
-    template< class _TImage >
-    inline void _GD0( _TImage* image );
-
-    template< class _TImage, class _TOutput >
-    inline void _GD1( _TImage* image );
-  };
-
-} // ecapseman
-
-#endif // __fpa__Plugins__SimpleImageDijkstraCost__h__
-
-// eof - $RCSfile$
diff --git a/plugins/Experiments/InsertNoiseIntoPoints.cxx b/plugins/Experiments/InsertNoiseIntoPoints.cxx
deleted file mode 100644 (file)
index 0b98400..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#include <Experiments/InsertNoiseIntoPoints.h>
-#include <cpInstances/DataObjects/Image.h>
-#include <cpInstances/DataObjects/Mesh.h>
-
-#include <random>
-#include <vtkImageData.h>
-#include <vtkPolyData.h>
-
-// -------------------------------------------------------------------------
-fpaPluginsExperiments::InsertNoiseIntoPoints::
-InsertNoiseIntoPoints( )
-  : Superclass( )
-{
-  typedef cpInstances::DataObjects::Image _TImage;
-  typedef cpInstances::DataObjects::Mesh  _TMesh;
-
-  this->_ConfigureInput< _TMesh >( "Seeds", true, false );
-  this->_ConfigureInput< _TImage >( "DistanceMap", true, false );
-  this->_ConfigureOutput< _TMesh >( "Output" );
-  this->m_Parameters.ConfigureAsBool( "InsertNoise", false );
-
-  // Create output data
-  auto out = this->_CreateVTK< vtkPolyData >( );
-  out->SetPoints( vtkSmartPointer< vtkPoints >::New( ) );
-  out->SetVerts( vtkSmartPointer< vtkCellArray >::New( ) );
-  out->SetLines( vtkSmartPointer< vtkCellArray >::New( ) );
-  out->SetPolys( vtkSmartPointer< vtkCellArray >::New( ) );
-  out->SetStrips( vtkSmartPointer< vtkCellArray >::New( ) );
-  this->GetOutput( "Output" )->SetVTK( out );
-}
-
-// -------------------------------------------------------------------------
-fpaPluginsExperiments::InsertNoiseIntoPoints::
-~InsertNoiseIntoPoints( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPluginsExperiments::InsertNoiseIntoPoints::
-_GenerateData( )
-{
-  auto dmap = this->GetInputData< vtkImageData >( "DistanceMap" );
-  auto seeds = this->GetInputData< vtkPolyData >( "Seeds" );
-  auto out = this->GetOutputData< vtkPolyData >( "Output" );
-
-  typedef std::uniform_real_distribution< double > _TDist;
-  std::random_device rd;
-  std::mt19937 gen( rd( ) );
-  for( int i = 0; i < seeds->GetNumberOfPoints( ); ++i )
-  {
-    double buf[ 3 ], pcoords[ 3 ];
-    seeds->GetPoint( i, buf );
-
-    if( this->m_Parameters.GetBool( "InsertNoise" ) )
-    {
-      int ijk[ 3 ];
-      dmap->ComputeStructuredCoordinates( buf, ijk, pcoords );
-      double radius =
-        dmap->GetScalarComponentAsDouble( ijk[ 0 ], ijk[ 1 ], ijk[ 2 ], 0 );
-      double rad_dis = _TDist( 1e-2, radius * 0.9 )( gen );
-      double the_dis = _TDist( 0, 3.14159265359 )( gen );
-      double phi_dis = _TDist( 0, 6.28318530718 )( gen );
-      buf[ 0 ] += rad_dis * std::sin( the_dis ) * std::cos( phi_dis );
-      buf[ 1 ] += rad_dis * std::sin( the_dis ) * std::sin( phi_dis );
-      buf[ 2 ] += rad_dis * std::cos( the_dis );
-
-    } // fi
-    out->GetPoints( )->InsertNextPoint( buf );
-    out->GetVerts( )->InsertNextCell( 1 );
-    out->GetVerts( )->InsertCellPoint( i );
-    out->Modified( );
-
-  } // rof
-}
-
-// eof - $RCSfile$
diff --git a/plugins/Experiments/InsertNoiseIntoPoints.h b/plugins/Experiments/InsertNoiseIntoPoints.h
deleted file mode 100644 (file)
index 2b33086..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef __fpaPluginsExperiments__InsertNoiseIntoPoints__h__
-#define __fpaPluginsExperiments__InsertNoiseIntoPoints__h__
-
-#include <fpaPluginsExperiments_Export.h>
-#include <cpPlugins/Pipeline/ProcessObject.h>
-
-namespace fpaPluginsExperiments
-{
-  /**
-   */
-  class fpaPluginsExperiments_EXPORT InsertNoiseIntoPoints
-    : public cpPlugins::Pipeline::ProcessObject
-  {
-    cpPluginsObject(
-      InsertNoiseIntoPoints,
-      cpPlugins::Pipeline::ProcessObject,
-      fpaExperiments
-      );
-  };
-
-} // ecapseman
-
-#endif // __fpaPluginsExperiments__InsertNoiseIntoPoints__h__
-
-// eof - $RCSfile$
diff --git a/plugins/Experiments/SkeletonHausdorffDistance.cxx b/plugins/Experiments/SkeletonHausdorffDistance.cxx
deleted file mode 100644 (file)
index af6fe76..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-#include <Experiments/SkeletonHausdorffDistance.h>
-#include <cpInstances/DataObjects/Image.h>
-#include <cpInstances/DataObjects/Mesh.h>
-#include <cpInstances/DataObjects/Skeleton.h>
-#include <cpExtensions/DataStructures/Skeleton.h>
-
-#include <vtkImageData.h>
-#include <vtkPolyData.h>
-
-// -------------------------------------------------------------------------
-fpaPluginsExperiments::SkeletonHausdorffDistance::
-SkeletonHausdorffDistance( )
-  : Superclass( )
-{
-  this->_ConfigureInput< cpInstances::DataObjects::Image >( "DistanceMap", true, false );
-  this->_ConfigureInput< cpInstances::DataObjects::Mesh >( "Seeds", true, false );
-  this->_ConfigureInput< cpInstances::DataObjects::Skeleton >( "Skeleton1", true, false );
-  this->_ConfigureInput< cpInstances::DataObjects::Skeleton >( "Skeleton2", true, false );
-}
-
-// -------------------------------------------------------------------------
-fpaPluginsExperiments::SkeletonHausdorffDistance::
-~SkeletonHausdorffDistance( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPluginsExperiments::SkeletonHausdorffDistance::
-_GenerateData( )
-{
-  typedef cpExtensions::DataStructures::Skeleton< 3 > _TSkeleton;
-
-  auto dmap = this->GetInputData< vtkImageData >( "DistanceMap" );
-  auto seeds = this->GetInputData< vtkPolyData >( "Seeds" );
-  auto sk1 = this->GetInputData< _TSkeleton >( "Skeleton1" );
-  auto sk2 = this->GetInputData< _TSkeleton >( "Skeleton2" );
-
-  double buf[ 3 ], pcoords[ 3 ];
-  seeds->GetPoint( 0, buf );
-  int ijk[ 3 ];
-  dmap->ComputeStructuredCoordinates( buf, ijk, pcoords );
-  double radius =
-    dmap->GetScalarComponentAsDouble( ijk[ 0 ], ijk[ 1 ], ijk[ 2 ], 0 );
-
-  double d1 = this->_Distance( sk1, sk2, NULL, 0 );
-  double d2 = this->_Distance( sk1, sk2, buf, radius );
-
-  std::cout
-    << std::endl
-    << "-------------------------------" << std::endl
-    << "D1    : " << d1 << std::endl
-    << "D2    : " << d2 << std::endl
-    << "Radius: " << radius << std::endl
-    << "Seed  : " << buf[ 0 ] << " " << buf[ 1 ] << " " << buf[ 2 ] << std::endl
-    << "-------------------------------" << std::endl;
-}
-
-// -------------------------------------------------------------------------
-template< class _TSkeleton >
-double fpaPluginsExperiments::SkeletonHausdorffDistance::
-_Distance( _TSkeleton* sk1, _TSkeleton* sk2, double* center, double radius )
-{
-  auto lst1 = this->_PointList( sk1, center, radius );
-  auto lst2 = this->_PointList( sk2, center, radius );
-  double dist = -std::numeric_limits< double >::max( );
-  typename _TSkeleton::TPath::TPoint point;
-  for( auto p1 : lst1 )
-  {
-    double ldist = std::numeric_limits< double >::max( );
-    typename _TSkeleton::TPath::TPoint lpoint;
-    for( auto p2 : lst2 )
-    {
-      double d = p1.EuclideanDistanceTo( p2 );
-      if( d < ldist )
-      {
-        ldist = d;
-        lpoint = p2;
-
-      } // fi
-
-    } // rof
-    if( ldist > dist )
-    {
-      dist = ldist;
-      point = lpoint;
-
-    } // fi
-
-  } // rof
-  return( dist );
-}
-
-// -------------------------------------------------------------------------
-template< class _TSkeleton >
-std::vector< typename _TSkeleton::TPath::TPoint >
-fpaPluginsExperiments::SkeletonHausdorffDistance::
-_PointList( _TSkeleton* sk, double* center, double radius )
-{
-  typename _TSkeleton::TPath::TPoint p_center;
-  if( center != NULL )
-    for( unsigned int d = 0; d < _TSkeleton::Dimension; ++d )
-      p_center[ d ] = center[ d ];
-
-  std::vector< typename _TSkeleton::TPath::TPoint > lst;
-  auto mIt = sk->BeginEdgesRows( );
-  for( ; mIt != sk->EndEdgesRows( ); ++mIt )
-  {
-    auto rIt = mIt->second.begin( );
-    for( ; rIt != mIt->second.end( ); ++rIt )
-    {
-      auto eIt = rIt->second.begin( );
-      for( ; eIt != rIt->second.end( ); ++eIt )
-      {
-        auto path = *eIt;
-        for( unsigned int i = 0; i < path->GetSize( ); ++i )
-        {
-          auto p = path->GetPoint( i );
-          if( center != NULL )
-          {
-            if( p_center.EuclideanDistanceTo( p ) > radius )
-              lst.push_back( p );
-          }
-          else
-            lst.push_back( p );
-
-        } // rof
-
-      } // rof
-
-    } // rof
-
-  } // rof
-  return( lst );
-}
-
-// eof - $RCSfile$
diff --git a/plugins/Experiments/SkeletonHausdorffDistance.h b/plugins/Experiments/SkeletonHausdorffDistance.h
deleted file mode 100644 (file)
index 7ac8820..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef __fpaPluginsExperiments__SkeletonHausdorffDistance__h__
-#define __fpaPluginsExperiments__SkeletonHausdorffDistance__h__
-
-#include <fpaPluginsExperiments_Export.h>
-#include <cpPlugins/Pipeline/ProcessObject.h>
-
-namespace fpaPluginsExperiments
-{
-  /**
-   */
-  class fpaPluginsExperiments_EXPORT SkeletonHausdorffDistance
-    : public cpPlugins::Pipeline::ProcessObject
-  {
-    cpPluginsObject(
-      SkeletonHausdorffDistance,
-      cpPlugins::Pipeline::ProcessObject,
-      fpaExperiments
-      );
-
-  protected:
-    template< class _TSkeleton >
-    inline double _Distance(
-      _TSkeleton* sk1, _TSkeleton* sk2,
-      double* center,
-      double radius
-      );
-
-    template< class _TSkeleton >
-    inline std::vector< typename _TSkeleton::TPath::TPoint > _PointList(
-      _TSkeleton* sk,
-      double* center,
-      double radius
-      );
-  };
-
-} // ecapseman
-
-#endif // __fpaPluginsExperiments__SkeletonHausdorffDistance__h__
-
-// eof - $RCSfile$
diff --git a/plugins/Functors/Functors.i b/plugins/Functors/Functors.i
deleted file mode 100644 (file)
index c12aa36..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-
-tinclude fpa/Base/Functors/Inverse:h|hxx
-
-instances fpa::Base::Functors::Inverse< #scalar_types#, #real_types# >
-
-** eof - $RCSfile$
diff --git a/plugins/Functors/Inverse.cxx b/plugins/Functors/Inverse.cxx
deleted file mode 100644 (file)
index 1786d38..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "Inverse.h"
-
-#include <cpInstances/DataObjects/Image.h>
-
-#include <itkImage.h>
-#include <fpa/Base/Functors/Inverse.h>
-
-// -------------------------------------------------------------------------
-void fpaPlugins_Functors::Inverse::
-Instantiate( itk::LightObject* filter )
-{
-  auto itk_filter = dynamic_cast< itk::ProcessObject* >( filter );
-  if( itk_filter != NULL )
-  {
-    auto inputs = itk_filter->GetInputs( );
-    if( inputs.size( ) > 0 )
-    {
-      cpPlugins_Demangle_Image_ScalarPixels_AllDims_2(
-        inputs[ 0 ].GetPointer( ), _GD0, itk_filter
-        )
-        this->_Error( "Invalid input data." );
-    }
-    else
-      this->_Error( "Not enough inputs." );
-  }
-  else
-    this->_Error( "Invalid instantiation filter." );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_Functors::Inverse::
-Inverse( )
-  : Superclass( )
-{
-  this->_ConfigureOutput< cpPlugins::Pipeline::DataObject >( "Functor" );
-  this->m_Parameters.ConfigureAsReal( "NegativeValue", -1 );
-  this->GetOutput( "Functor" )->SetITK( this );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_Functors::Inverse::
-~Inverse( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPlugins_Functors::Inverse::
-_GenerateData( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput >
-void fpaPlugins_Functors::Inverse::
-_GD0( _TInput* input, itk::ProcessObject* filter )
-{
-  auto outputs = filter->GetOutputs( );
-  if( outputs.size( ) > 0 )
-  {
-    cpPlugins_Demangle_Image_RealPixels_3(
-      outputs[ 0 ].GetPointer( ), _GD1, _TInput::ImageDimension, input, filter
-      )
-      this->_Error( "Invalid output data." );
-  }
-  else
-    this->_Error( "Not enough outputs." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput, class _TOutput >
-void fpaPlugins_Functors::Inverse::
-_GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter )
-{
-  typedef typename _TInput::PixelType  _TIValue;
-  typedef typename _TOutput::PixelType _TOValue;
-  typedef fpa::Base::Functors::Inverse< _TIValue, _TOValue > _TFunctor;
-
-  auto f = dynamic_cast< _TFunctor* >( this->m_Functor.GetPointer( ) );
-  if( f == NULL )
-  {
-    typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
-    f = ptr_f.GetPointer( );
-    this->m_Functor = f;
-
-  } // fi
-  f->SetNegativeValue( this->m_Parameters.GetReal( "NegativeValue" ) );
-}
-
-// eof - $RCSfile$
diff --git a/plugins/Functors/Inverse.h b/plugins/Functors/Inverse.h
deleted file mode 100644 (file)
index 634eeaf..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __fpaPlugins_Functors__Inverse__h__
-#define __fpaPlugins_Functors__Inverse__h__
-
-#include <itkProcessObject.h>
-#include <fpaPlugins_Functors_Export.h>
-#include <cpPlugins/Pipeline/Functor.h>
-
-namespace fpaPlugins_Functors
-{
-  /**
-   */
-  class fpaPlugins_Functors_EXPORT Inverse
-    : public cpPlugins::Pipeline::Functor
-  {
-    cpPluginsObject( Inverse, cpPlugins::Pipeline::Functor, fpaFunctors );
-
-  public:
-    virtual void Instantiate( itk::LightObject* filter ) override;
-
-  protected:
-    template< class _TInput >
-    inline void _GD0( _TInput* input, itk::ProcessObject* filter );
-
-    template< class _TInput, class _TOutput >
-    inline void _GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter );
-  };
-
-} // ecapseman
-
-#endif // __fpaPlugins_Functors__Inverse__h__
-
-// eof - $RCSfile$
diff --git a/plugins/ImageAlgorithms/BaseFilter.cxx b/plugins/ImageAlgorithms/BaseFilter.cxx
deleted file mode 100644 (file)
index 00393b4..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "BaseFilter.h"
-#include <cpInstances/DataObjects/Image.h>
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageAlgorithms::BaseFilter::
-BaseFilter( )
-  : Superclass( )
-{
-  typedef cpPlugins::Pipeline::DataObject _TData;
-  typedef cpInstances::DataObjects::Image _TImage;
-
-  this->_ConfigureInput< _TImage >( "Input", true, false );
-  this->_ConfigureInput< _TData >( "Seeds", true, false );
-  this->_ConfigureOutput< _TImage >( "Output" );
-
-  this->m_Parameters.ConfigureAsUint( "NeighborhoodOrder", 1 );
-  this->m_Parameters.ConfigureAsBool( "VisualDebug", false );
-  this->m_Parameters.ConfigureAsBool( "StopAtOneFront", false );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageAlgorithms::BaseFilter::
-~BaseFilter( )
-{
-}
-
-// eof - $RCSfile$
diff --git a/plugins/ImageAlgorithms/BaseFilter.h b/plugins/ImageAlgorithms/BaseFilter.h
deleted file mode 100644 (file)
index b03abaa..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef __fpaPlugins_ImageAlgorithms__BaseFilter__h__
-#define __fpaPlugins_ImageAlgorithms__BaseFilter__h__
-
-#include <fpaPlugins_ImageAlgorithms_Export.h>
-
-#include <vtkPolyData.h>
-#include <cpPlugins/Pipeline/ProcessObject.h>
-
-namespace fpaPlugins_ImageAlgorithms
-{
-  /**
-   */
-  class fpaPlugins_ImageAlgorithms_EXPORT BaseFilter
-    : public cpPlugins::Pipeline::ProcessObject
-  {
-  public:
-    typedef BaseFilter                         Self;
-    typedef cpPlugins::Pipeline::ProcessObject Superclass;
-    typedef itk::SmartPointer< Self >          Pointer;
-    typedef itk::SmartPointer< const Self >    ConstPointer;
-
-  public:
-    itkTypeMacro( BaseFilter, cpPlugins::Pipeline::ProcessObject );
-    cpPlugins_Id_Macro( BaseFilter, fpaImageAlgorithm );
-
-  protected:
-    BaseFilter( );
-    virtual ~BaseFilter( );
-
-    template< class _TFilter, class _TImage >
-    inline void _ConfigureFilter(
-      _TFilter* filter, _TImage* image,
-      std::vector< typename _TImage::IndexType >& seeds
-      );
-
-  private:
-    // Purposely not implemented.
-    BaseFilter( const Self& other );
-    Self& operator=( const Self& other );
-  };
-
-} // ecapseman
-
-// -------------------------------------------------------------------------
-#define ITK_MANUAL_INSTANTIATION
-#include <fpa/Image/Functors/SimpleNeighborhood.h>
-
-// -------------------------------------------------------------------------
-template< class _TFilter, class _TImage >
-void fpaPlugins_ImageAlgorithms::BaseFilter::
-_ConfigureFilter(
-  _TFilter* filter, _TImage* image,
-  std::vector< typename _TImage::IndexType >& seeds
-  )
-{
-  typedef typename _TFilter::TNeighborhoodFunction _TNeighborhood;
-  typedef
-    fpa::Image::Functors::SimpleNeighborhood< _TImage::ImageDimension >
-    _TSimpleNeigh;
-
-  // Simple configuration
-  filter->SetInput( image );
-  filter->SetStopAtOneFront( this->m_Parameters.GetBool( "StopAtOneFront" ) );
-
-  // Neighborhood function
-  typename _TSimpleNeigh::Pointer sfunc = _TSimpleNeigh::New( );
-  sfunc->SetOrder( this->m_Parameters.GetUint( "NeighborhoodOrder" ) );
-  filter->SetNeighborhoodFunction( sfunc );
-
-  // Assign seeds
-  seeds.clear( );
-  auto pnt_seeds = this->GetInputData< vtkPolyData >( "Seeds" );
-  if( pnt_seeds != NULL )
-  {
-    typename _TImage::PointType pnt;
-    typename _TImage::IndexType idx;
-    unsigned int dim =
-      ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
-
-    for( int i = 0; i < pnt_seeds->GetNumberOfPoints( ); ++i )
-    {
-      double buf[ 3 ];
-      pnt_seeds->GetPoint( i, buf );
-      pnt.Fill( 0 );
-      for( unsigned int d = 0; d < dim; ++d )
-        pnt[ d ] = buf[ d ];
-
-      if( image->TransformPhysicalPointToIndex( pnt, idx ) )
-        seeds.push_back( idx );
-
-    } // rof
-
-  } // fi
-}
-
-#endif // __fpaPlugins_ImageAlgorithms__BaseFilter__h__
-
-// eof - $RCSfile$
diff --git a/plugins/ImageAlgorithms/Dijkstra.cxx b/plugins/ImageAlgorithms/Dijkstra.cxx
deleted file mode 100644 (file)
index 33e2ab4..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-#include "Dijkstra.h"
-#include <cpPlugins/Pipeline/Functor.h>
-#include <cpInstances/DataObjects/Image.h>
-
-#include <fpa/Image/Dijkstra.h>
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageAlgorithms::Dijkstra::
-Dijkstra( )
-  : Superclass( )
-{
-  typedef cpPlugins::Pipeline::DataObject _TFunctor;
-  typedef cpInstances::DataObjects::Image _TMST;
-
-  this->_ConfigureInput< _TFunctor >( "VertexFunction", false, false );
-  this->_ConfigureInput< _TFunctor >( "ConversionFunction", false, false );
-  this->_ConfigureOutput< _TMST >( "MST" );
-
-  std::vector< std::string > choices;
-  choices.push_back( "float" );
-  choices.push_back( "double" );
-  this->m_Parameters.ConfigureAsChoices( "ResultType", choices );
-  this->m_Parameters.SetSelectedChoice( "ResultType", "float" );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageAlgorithms::Dijkstra::
-~Dijkstra( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPlugins_ImageAlgorithms::Dijkstra::
-_GenerateData( )
-{
-  auto o = this->GetInputData( "Input" );
-  cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
-    this->_Error( "Invalid input image." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpaPlugins_ImageAlgorithms::Dijkstra::
-_GD0( _TImage* image )
-{
-  typedef itk::Image< float, _TImage::ImageDimension >  _TFloat;
-  typedef itk::Image< double, _TImage::ImageDimension > _TDouble;
-
-  auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" );
-  if     ( rtype == "float"  ) this->_GD1< _TImage, _TFloat >( image );
-  else if( rtype == "double" ) this->_GD1< _TImage, _TDouble >( image );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpaPlugins_ImageAlgorithms::Dijkstra::
-_GD1( _TInputImage* image )
-{
-  typedef cpPlugins::Pipeline::Functor _TFunctor;
-  typedef fpa::Image::Dijkstra< _TInputImage, _TOutputImage > _TFilter;
-  typedef typename _TFilter::TConversionFunction  _TConversionFunction;
-  typedef typename _TFilter::TVertexFunction          _TVertexFunction;
-
-  // Create filter
-  auto filter = this->_CreateITK< _TFilter >( );
-  std::vector< typename _TInputImage::IndexType > seeds;
-  this->_ConfigureFilter( filter, image, seeds );
-
-  // Instantiate functors
-  auto cost_conversion = this->GetInputData< _TFunctor >( "ConversionFunction" );
-  if( cost_conversion != NULL )
-  {
-    cost_conversion->Instantiate( filter );
-    auto cost_conversion_functor = cost_conversion->GetFunctor< _TConversionFunction >( );
-    if( cost_conversion_functor != NULL )
-      filter->SetConversionFunction( cost_conversion_functor );
-
-  } // fi
-
-  auto vertex = this->GetInputData< _TFunctor >( "VertexFunction" );
-  if( vertex != NULL )
-  {
-    vertex->Instantiate( filter );
-    auto vertex_functor = vertex->GetFunctor< _TVertexFunction >( );
-    if( vertex_functor != NULL )
-      filter->SetVertexFunction( vertex_functor );
-
-  } // fi
-
-  // Finish filter's configuration
-  filter->ClearSeeds( );
-  for( auto seed : seeds )
-    filter->AddSeed( seed, ( typename _TOutputImage::PixelType )( 0 ) );
-  filter->Update( );
-  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
-  this->GetOutput( "MST" )->SetITK( filter->GetMinimumSpanningTree( ) );
-}
-
-// eof - $RCSfile$
diff --git a/plugins/ImageAlgorithms/Dijkstra.h b/plugins/ImageAlgorithms/Dijkstra.h
deleted file mode 100644 (file)
index 5482e8d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef __fpaPlugins_ImageAlgorithms__Dijkstra__h__
-#define __fpaPlugins_ImageAlgorithms__Dijkstra__h__
-
-#include <ImageAlgorithms/BaseFilter.h>
-
-namespace fpaPlugins_ImageAlgorithms
-{
-  /**
-   */
-  class fpaPlugins_ImageAlgorithms_EXPORT Dijkstra
-    : public BaseFilter
-  {
-    cpPluginsObject( Dijkstra, BaseFilter, fpaImageAlgorithms );
-
-  protected:
-    template< class _TImage >
-    inline void _GD0( _TImage* image );
-
-    template< class _TInputImage, class _TOutputImage >
-    inline void _GD1( _TInputImage* image );
-  };
-
-} // ecapseman
-
-#endif // __fpaPlugins_ImageAlgorithms__Dijkstra__h__
-
-// eof - $RCSfile$
diff --git a/plugins/ImageAlgorithms/ExtractPathFromMinimumSpanningTree.cxx b/plugins/ImageAlgorithms/ExtractPathFromMinimumSpanningTree.cxx
deleted file mode 100644 (file)
index 664929b..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "ExtractPathFromMinimumSpanningTree.h"
-#include <cpInstances/DataObjects/Image.h>
-#include <cpInstances/DataObjects/PolyLineParametricPath.h>
-#include <vtkPolyData.h>
-#include <fpa/Image/MinimumSpanningTree.h>
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageAlgorithms::ExtractPathFromMinimumSpanningTree::
-ExtractPathFromMinimumSpanningTree( )
-  : Superclass( )
-{
-  typedef cpPlugins::Pipeline::DataObject                  _TData;
-  typedef cpInstances::DataObjects::Image                  _TMST;
-  typedef cpInstances::DataObjects::PolyLineParametricPath _TPath;
-
-  this->_ConfigureInput< _TMST >( "MST", true, false );
-  this->_ConfigureInput< _TData >( "Seeds", true, false );
-  this->_ConfigureOutput< _TPath >( "Output" );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageAlgorithms::ExtractPathFromMinimumSpanningTree::
-~ExtractPathFromMinimumSpanningTree( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPlugins_ImageAlgorithms::ExtractPathFromMinimumSpanningTree::
-_GenerateData( )
-{
-  typedef fpa::Image::MinimumSpanningTree< 2 > _TMST2;
-  typedef fpa::Image::MinimumSpanningTree< 3 > _TMST3;
-
-  auto mst2 = this->GetInputData< _TMST2 >( "MST" );
-  auto mst3 = this->GetInputData< _TMST3 >( "MST" );
-  if     ( mst2 != NULL ) this->_GD0( mst2 );
-  else if( mst3 != NULL ) this->_GD0( mst3 );
-  else this->_Error( "Invalid input spanning tree." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TMST >
-void fpaPlugins_ImageAlgorithms::ExtractPathFromMinimumSpanningTree::
-_GD0( _TMST* mst )
-{
-  typedef typename _TMST::IndexType _TIndex;
-  typedef typename _TMST::TPath     _TPath;
-
-  // Get seeds
-  std::vector< _TIndex > seeds;
-  auto points = this->GetInputData< vtkPolyData >( "Seeds" );
-  if( points != NULL )
-  {
-    if( points->GetNumberOfPoints( ) < 2 )
-      this->_Error( "Not enough seeds (<2)." );
-
-    typename _TMST::PointType pnt;
-    typename _TMST::IndexType idx;
-    unsigned int dim =
-      ( _TMST::ImageDimension < 3 )? _TMST::ImageDimension: 3;
-    for( unsigned int i = 0; i < 2; ++i )
-    {
-      double buf[ 3 ];
-      points->GetPoint( i, buf );
-      pnt.Fill( 0 );
-      for( unsigned int d = 0; d < dim; ++d )
-        pnt[ d ] = buf[ d ];
-      if( mst->TransformPhysicalPointToIndex( pnt, idx ) )
-        seeds.push_back( idx );
-
-    } // rof
-
-  } // fi
-
-  typename _TPath::Pointer path;
-  mst->GetPath( path, seeds[ 0 ], seeds[ 1 ] );
-  this->GetOutput( "Output" )->SetITK( path );
-}
-
-// eof - $RCSfile$
diff --git a/plugins/ImageAlgorithms/ExtractPathFromMinimumSpanningTree.h b/plugins/ImageAlgorithms/ExtractPathFromMinimumSpanningTree.h
deleted file mode 100644 (file)
index a331457..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __fpaPlugins_ImageAlgorithms__ExtractPathFromMinimumSpanningTree__h__
-#define __fpaPlugins_ImageAlgorithms__ExtractPathFromMinimumSpanningTree__h__
-
-#include <fpaPlugins_ImageAlgorithms_Export.h>
-#include <cpPlugins/Pipeline/ProcessObject.h>
-
-namespace fpaPlugins_ImageAlgorithms
-{
-  /**
-   */
-  class fpaPlugins_ImageAlgorithms_EXPORT ExtractPathFromMinimumSpanningTree
-    : public cpPlugins::Pipeline::ProcessObject
-  {
-    cpPluginsObject(
-      ExtractPathFromMinimumSpanningTree,
-      cpPlugins::Pipeline::ProcessObject,
-      fpaImageAlgorithms
-      );
-
-  protected:
-    template< class _TMST >
-    inline void _GD0( _TMST* mst );
-  };
-
-} // ecapseman
-
-#endif // __fpaPlugins_ImageAlgorithms__ExtractPathFromMinimumSpanningTree__h__
-
-// eof - $RCSfile$
diff --git a/plugins/ImageAlgorithms/FastMarching.cxx b/plugins/ImageAlgorithms/FastMarching.cxx
deleted file mode 100644 (file)
index 355c882..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-#include "FastMarching.h"
-#include <cpPlugins/Pipeline/Functor.h>
-#include <cpInstances/DataObjects/Image.h>
-
-#include <fpa/Image/FastMarching.h>
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageAlgorithms::FastMarching::
-FastMarching( )
-  : Superclass( )
-{
-  typedef cpPlugins::Pipeline::DataObject _TFunctor;
-
-  this->_ConfigureInput< _TFunctor >( "VertexFunction", false, false );
-  this->_ConfigureInput< _TFunctor >( "ConversionFunction", false, false );
-
-  std::vector< std::string > choices;
-  choices.push_back( "float" );
-  choices.push_back( "double" );
-  this->m_Parameters.ConfigureAsChoices( "ResultType", choices );
-  this->m_Parameters.SetSelectedChoice( "ResultType", "float" );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageAlgorithms::FastMarching::
-~FastMarching( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPlugins_ImageAlgorithms::FastMarching::
-_GenerateData( )
-{
-  auto o = this->GetInputData( "Input" );
-  cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
-    this->_Error( "Invalid input image." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpaPlugins_ImageAlgorithms::FastMarching::
-_GD0( _TImage* image )
-{
-  typedef itk::Image< float, _TImage::ImageDimension >  _TFloat;
-  typedef itk::Image< double, _TImage::ImageDimension > _TDouble;
-
-  auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" );
-  if     ( rtype == "float"  ) this->_GD1< _TImage, _TFloat >( image );
-  else if( rtype == "double" ) this->_GD1< _TImage, _TDouble >( image );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpaPlugins_ImageAlgorithms::FastMarching::
-_GD1( _TInputImage* image )
-{
-  typedef cpPlugins::Pipeline::Functor _TFunctor;
-  typedef fpa::Image::FastMarching< _TInputImage, _TOutputImage > _TFilter;
-  typedef typename _TFilter::TConversionFunction      _TConversionFunction;
-  typedef typename _TFilter::TVertexFunction              _TVertexFunction;
-
-  // Create filter
-  auto filter = this->_CreateITK< _TFilter >( );
-  std::vector< typename _TInputImage::IndexType > seeds;
-  this->_ConfigureFilter( filter, image, seeds );
-
-  // Instantiate functors
-  auto cost_conversion = this->GetInputData< _TFunctor >( "ConversionFunction" );
-  if( cost_conversion != NULL )
-  {
-    cost_conversion->Instantiate( filter );
-    auto cost_conversion_functor = cost_conversion->GetFunctor< _TConversionFunction >( );
-    if( cost_conversion_functor != NULL )
-      filter->SetConversionFunction( cost_conversion_functor );
-
-  } // fi
-
-  auto vertex = this->GetInputData< _TFunctor >( "VertexFunction" );
-  if( vertex != NULL )
-  {
-    vertex->Instantiate( filter );
-    auto vertex_functor = vertex->GetFunctor< _TVertexFunction >( );
-    if( vertex_functor != NULL )
-      filter->SetVertexFunction( vertex_functor );
-
-  } // fi
-
-  // Finish filter's configuration
-  filter->ClearSeeds( );
-  for( auto seed : seeds )
-    filter->AddSeed( seed, ( typename _TOutputImage::PixelType )( 0 ) );
-  filter->Update( );
-  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
-}
-
-// eof - $RCSfile$
diff --git a/plugins/ImageAlgorithms/FastMarching.h b/plugins/ImageAlgorithms/FastMarching.h
deleted file mode 100644 (file)
index 2bd6207..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef __fpaPlugins_ImageAlgorithms__FastMarching__h__
-#define __fpaPlugins_ImageAlgorithms__FastMarching__h__
-
-#include <ImageAlgorithms/BaseFilter.h>
-
-namespace fpaPlugins_ImageAlgorithms
-{
-  /**
-   */
-  class fpaPlugins_ImageAlgorithms_EXPORT FastMarching
-    : public BaseFilter
-  {
-    cpPluginsObject( FastMarching, BaseFilter, fpaImageAlgorithms );
-
-  protected:
-    template< class _TImage >
-    inline void _GD0( _TImage* image );
-
-    template< class _TInputImage, class _TOutputImage >
-    inline void _GD1( _TInputImage* image );
-  };
-
-} // ecapseman
-
-#endif // __fpaPlugins_ImageAlgorithms__FastMarching__h__
-
-// eof - $RCSfile$
diff --git a/plugins/ImageAlgorithms/RegionGrow.cxx b/plugins/ImageAlgorithms/RegionGrow.cxx
deleted file mode 100644 (file)
index bd0fc74..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#include "RegionGrow.h"
-#include <cpPlugins/Pipeline/Functor.h>
-#include <cpInstances/DataObjects/Image.h>
-
-#include <fpa/Image/RegionGrow.h>
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageAlgorithms::RegionGrow::
-RegionGrow( )
-  : Superclass( )
-{
-  typedef cpPlugins::Pipeline::DataObject _TFunctor;
-  typedef cpInstances::DataObjects::Image _TMST;
-
-  this->_ConfigureInput< _TFunctor >( "GrowFunction", true, false );
-  this->m_Parameters.ConfigureAsInt( "InsideValue", 1 );
-  this->m_Parameters.ConfigureAsInt( "OutsideValue", 0 );
-  this->m_Parameters.ConfigureAsIntTypesChoices( "ResultType" );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageAlgorithms::RegionGrow::
-~RegionGrow( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPlugins_ImageAlgorithms::RegionGrow::
-_GenerateData( )
-{
-  auto o = this->GetInputData( "Input" );
-  cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
-    this->_Error( "Invalid input image." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpaPlugins_ImageAlgorithms::RegionGrow::
-_GD0( _TImage* image )
-{
-  auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" );
-  if( rtype == "char" )        this->_GD1< _TImage, char >( image );
-  else if( rtype == "uchar" )  this->_GD1< _TImage, unsigned char >( image );
-  else if( rtype == "short" )  this->_GD1< _TImage, short >( image );
-  else if( rtype == "ushort" ) this->_GD1< _TImage, unsigned short >( image );
-  else if( rtype == "int" )    this->_GD1< _TImage, int >( image );
-  else if( rtype == "uint" )   this->_GD1< _TImage, unsigned int >( image );
-  else if( rtype == "long" )   this->_GD1< _TImage, long >( image );
-  else if( rtype == "ulong" )  this->_GD1< _TImage, unsigned long >( image );
-  else                         this->_GD1< _TImage, char >( image );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputPixel >
-void fpaPlugins_ImageAlgorithms::RegionGrow::
-_GD1( _TInputImage* image )
-{
-  typedef cpPlugins::Pipeline::Functor _TFunctor;
-  typedef itk::Image< _TOutputPixel, _TInputImage::ImageDimension > _TOutputImage;
-  typedef fpa::Image::RegionGrow< _TInputImage, _TOutputImage > _TFilter;
-  typedef typename _TFilter::TGrowFunction _TGrowFunction;
-
-  // Create filter
-  auto filter = this->_CreateITK< _TFilter >( );
-  std::vector< typename _TInputImage::IndexType > seeds;
-  this->_ConfigureFilter( filter, image, seeds );
-
-  // Instantiate functors
-  auto growfunc = this->GetInputData< _TFunctor >( "GrowFunction" );
-  if( growfunc != NULL )
-  {
-    growfunc->Instantiate( filter );
-    auto growfunc_functor = growfunc->GetFunctor< _TGrowFunction >( );
-    if( growfunc_functor != NULL )
-      filter->SetGrowFunction( growfunc_functor );
-
-  } // fi
-
-  // Finish filter's configuration
-  filter->ClearSeeds( );
-  for( auto seed : seeds )
-    filter->AddSeed( seed, ( typename _TOutputImage::PixelType )( 0 ) );
-  filter->Update( );
-  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
-}
-
-// eof - $RCSfile$
diff --git a/plugins/ImageAlgorithms/RegionGrow.h b/plugins/ImageAlgorithms/RegionGrow.h
deleted file mode 100644 (file)
index c9e59a7..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef __fpaPlugins_ImageAlgorithms__RegionGrow__h__
-#define __fpaPlugins_ImageAlgorithms__RegionGrow__h__
-
-#include <ImageAlgorithms/BaseFilter.h>
-
-namespace fpaPlugins_ImageAlgorithms
-{
-  /**
-   */
-  class fpaPlugins_ImageAlgorithms_EXPORT RegionGrow
-    : public BaseFilter
-  {
-    cpPluginsObject( RegionGrow, BaseFilter, fpaImageAlgorithms );
-
-  protected:
-    template< class _TImage >
-    inline void _GD0( _TImage* image );
-
-    template< class _TInputImage, class _TOutputPixel >
-    inline void _GD1( _TInputImage* image );
-  };
-
-} // ecapseman
-
-#endif // __fpaPlugins_ImageAlgorithms__RegionGrow__h__
-
-// eof - $RCSfile$
diff --git a/plugins/ImageFunctors/BinaryThreshold.cxx b/plugins/ImageFunctors/BinaryThreshold.cxx
deleted file mode 100644 (file)
index 4d4589e..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-#include "BinaryThreshold.h"
-
-#include <cpInstances/DataObjects/Image.h>
-
-#include <itkImage.h>
-#include <fpa/Image/Functors/RegionGrow/BinaryThreshold.h>
-
-// -------------------------------------------------------------------------
-void fpaPlugins_ImageFunctors::BinaryThreshold::
-Instantiate( itk::LightObject* filter )
-{
-  auto itk_filter = dynamic_cast< itk::ProcessObject* >( filter );
-  if( itk_filter != NULL )
-  {
-    auto inputs = itk_filter->GetInputs( );
-    if( inputs.size( ) > 0 )
-    {
-      cpPlugins_Demangle_Image_ScalarPixels_AllDims_2(
-        inputs[ 0 ].GetPointer( ), _GD0, itk_filter
-        )
-        this->_Error( "Invalid input data." );
-    }
-    else
-      this->_Error( "Not enough inputs." );
-  }
-  else
-    this->_Error( "Invalid instantiation filter." );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageFunctors::BinaryThreshold::
-BinaryThreshold( )
-  : Superclass( )
-{
-  this->_ConfigureOutput< cpPlugins::Pipeline::DataObject >( "Functor" );
-  this->GetOutput( "Functor" )->SetITK( this );
-  this->m_Parameters.ConfigureAsReal( "Lower", 0 );
-  this->m_Parameters.ConfigureAsReal( "Upper", 1 );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageFunctors::BinaryThreshold::
-~BinaryThreshold( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPlugins_ImageFunctors::BinaryThreshold::
-_GenerateData( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput >
-void fpaPlugins_ImageFunctors::BinaryThreshold::
-_GD0( _TInput* input, itk::ProcessObject* filter )
-{
-  auto outputs = filter->GetOutputs( );
-  if( outputs.size( ) > 0 )
-  {
-    cpPlugins_Demangle_Image_IntPixels_3(
-      outputs[ 0 ].GetPointer( ), _GD1, _TInput::ImageDimension, input, filter
-      )
-      this->_Error( "Invalid output data." );
-  }
-  else
-    this->_Error( "Not enough outputs." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput, class _TOutput >
-void fpaPlugins_ImageFunctors::BinaryThreshold::
-_GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter )
-{
-  typedef typename _TOutput::PixelType _TValue;
-  typedef fpa::Image::Functors::RegionGrow::BinaryThreshold< _TInput, _TValue > _TFunctor;
-
-  auto f = dynamic_cast< _TFunctor* >( this->m_Functor.GetPointer( ) );
-  if( f == NULL )
-  {
-    typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
-    f = ptr_f.GetPointer( );
-    this->m_Functor = f;
-
-  } // fi
-  f->SetLower( this->m_Parameters.GetReal( "Lower" ) );
-  f->SetUpper( this->m_Parameters.GetReal( "Upper" ) );
-}
-
-// eof - $RCSfile$
diff --git a/plugins/ImageFunctors/BinaryThreshold.h b/plugins/ImageFunctors/BinaryThreshold.h
deleted file mode 100644 (file)
index 73cdad1..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __fpaPlugins_ImageFunctors__BinaryThreshold__h__
-#define __fpaPlugins_ImageFunctors__BinaryThreshold__h__
-
-#include <itkProcessObject.h>
-#include <fpaPlugins_ImageFunctors_Export.h>
-#include <cpPlugins/Pipeline/Functor.h>
-
-namespace fpaPlugins_ImageFunctors
-{
-  /**
-   */
-  class fpaPlugins_ImageFunctors_EXPORT BinaryThreshold
-    : public cpPlugins::Pipeline::Functor
-  {
-    cpPluginsObject( BinaryThreshold, cpPlugins::Pipeline::Functor, fpaImageFunctors );
-
-  public:
-    virtual void Instantiate( itk::LightObject* filter ) override;
-
-  protected:
-    template< class _TInput >
-    inline void _GD0( _TInput* input, itk::ProcessObject* filter );
-
-    template< class _TInput, class _TOutput >
-    inline void _GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter );
-  };
-
-} // ecapseman
-
-#endif // __fpaPlugins_ImageFunctors__BinaryThreshold__h__
-
-// eof - $RCSfile$
diff --git a/plugins/ImageFunctors/Tautology.cxx b/plugins/ImageFunctors/Tautology.cxx
deleted file mode 100644 (file)
index 6763602..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#include "Tautology.h"
-
-#include <cpInstances/DataObjects/Image.h>
-
-#include <itkImage.h>
-#include <fpa/Base/Functors/RegionGrow/Tautology.h>
-
-// -------------------------------------------------------------------------
-void fpaPlugins_ImageFunctors::Tautology::
-Instantiate( itk::LightObject* filter )
-{
-  auto itk_filter = dynamic_cast< itk::ProcessObject* >( filter );
-  if( itk_filter != NULL )
-  {
-    auto inputs = itk_filter->GetInputs( );
-    if( inputs.size( ) > 0 )
-    {
-      cpPlugins_Demangle_Image_ScalarPixels_AllDims_2(
-        inputs[ 0 ].GetPointer( ), _GD0, itk_filter
-        )
-        this->_Error( "Invalid input data." );
-    }
-    else
-      this->_Error( "Not enough inputs." );
-  }
-  else
-    this->_Error( "Invalid instantiation filter." );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageFunctors::Tautology::
-Tautology( )
-  : Superclass( )
-{
-  this->_ConfigureOutput< cpPlugins::Pipeline::DataObject >( "Functor" );
-  this->GetOutput( "Functor" )->SetITK( this );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageFunctors::Tautology::
-~Tautology( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPlugins_ImageFunctors::Tautology::
-_GenerateData( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput >
-void fpaPlugins_ImageFunctors::Tautology::
-_GD0( _TInput* input, itk::ProcessObject* filter )
-{
-  auto outputs = filter->GetOutputs( );
-  if( outputs.size( ) > 0 )
-  {
-    cpPlugins_Demangle_Image_IntPixels_3(
-      outputs[ 0 ].GetPointer( ), _GD1, _TInput::ImageDimension, input, filter
-      )
-      this->_Error( "Invalid output data." );
-  }
-  else
-    this->_Error( "Not enough outputs." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput, class _TOutput >
-void fpaPlugins_ImageFunctors::Tautology::
-_GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter )
-{
-  typedef typename _TInput::IndexType  _TVertex;
-  typedef typename _TOutput::PixelType _TValue;
-  typedef fpa::Base::Functors::RegionGrow::Tautology< _TVertex, _TValue > _TFunctor;
-
-  auto f = dynamic_cast< _TFunctor* >( this->m_Functor.GetPointer( ) );
-  if( f == NULL )
-  {
-    typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
-    f = ptr_f.GetPointer( );
-    this->m_Functor = f;
-
-  } // fi
-}
-
-// eof - $RCSfile$
diff --git a/plugins/ImageFunctors/Tautology.h b/plugins/ImageFunctors/Tautology.h
deleted file mode 100644 (file)
index 1a846c1..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __fpaPlugins_ImageFunctors__Tautology__h__
-#define __fpaPlugins_ImageFunctors__Tautology__h__
-
-#include <itkProcessObject.h>
-#include <fpaPlugins_ImageFunctors_Export.h>
-#include <cpPlugins/Pipeline/Functor.h>
-
-namespace fpaPlugins_ImageFunctors
-{
-  /**
-   */
-  class fpaPlugins_ImageFunctors_EXPORT Tautology
-    : public cpPlugins::Pipeline::Functor
-  {
-    cpPluginsObject( Tautology, cpPlugins::Pipeline::Functor, fpaImageFunctors );
-
-  public:
-    virtual void Instantiate( itk::LightObject* filter ) override;
-
-  protected:
-    template< class _TInput >
-    inline void _GD0( _TInput* input, itk::ProcessObject* filter );
-
-    template< class _TInput, class _TOutput >
-    inline void _GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter );
-  };
-
-} // ecapseman
-
-#endif // __fpaPlugins_ImageFunctors__Tautology__h__
-
-// eof - $RCSfile$
diff --git a/plugins/ImageFunctors/VertexCost.cxx b/plugins/ImageFunctors/VertexCost.cxx
deleted file mode 100644 (file)
index 222cdb5..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "VertexCost.h"
-
-#include <cpInstances/DataObjects/Image.h>
-
-#include <itkImage.h>
-#include <fpa/Image/Functors/VertexCost.h>
-
-// -------------------------------------------------------------------------
-void fpaPlugins_ImageFunctors::VertexCost::
-Instantiate( itk::LightObject* filter )
-{
-  auto itk_filter = dynamic_cast< itk::ProcessObject* >( filter );
-  if( itk_filter != NULL )
-  {
-    auto inputs = itk_filter->GetInputs( );
-    if( inputs.size( ) > 0 )
-    {
-      cpPlugins_Demangle_Image_ScalarPixels_AllDims_2(
-        inputs[ 0 ].GetPointer( ), _GD0, itk_filter
-        )
-        this->_Error( "Invalid input data." );
-    }
-    else
-      this->_Error( "Not enough inputs." );
-  }
-  else
-    this->_Error( "Invalid instantiation filter." );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageFunctors::VertexCost::
-VertexCost( )
-  : Superclass( )
-{
-  this->_ConfigureOutput< cpPlugins::Pipeline::DataObject >( "Functor" );
-  this->m_Parameters.ConfigureAsBool( "UseImageSpacing", false );
-  this->GetOutput( "Functor" )->SetITK( this );
-}
-
-// -------------------------------------------------------------------------
-fpaPlugins_ImageFunctors::VertexCost::
-~VertexCost( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPlugins_ImageFunctors::VertexCost::
-_GenerateData( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput >
-void fpaPlugins_ImageFunctors::VertexCost::
-_GD0( _TInput* input, itk::ProcessObject* filter )
-{
-  auto outputs = filter->GetOutputs( );
-  if( outputs.size( ) > 0 )
-  {
-    cpPlugins_Demangle_Image_ScalarPixels_3(
-      outputs[ 0 ].GetPointer( ), _GD1, _TInput::ImageDimension, input, filter
-      )
-      this->_Error( "Invalid output data." );
-  }
-  else
-    this->_Error( "Not enough outputs." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput, class _TOutput >
-void fpaPlugins_ImageFunctors::VertexCost::
-_GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter )
-{
-  typedef typename _TInput::PixelType  _TIValue;
-  typedef typename _TOutput::PixelType _TOValue;
-  typedef fpa::Image::Functors::VertexCost< _TInput, _TOValue > _TFunctor;
-
-  auto f = dynamic_cast< _TFunctor* >( this->m_Functor.GetPointer( ) );
-  if( f == NULL )
-  {
-    typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
-    f = ptr_f.GetPointer( );
-    this->m_Functor = f;
-
-  } // fi
-  f->SetUseImageSpacing( this->m_Parameters.GetReal( "UseImageSpacing" ) );
-}
-
-// eof - $RCSfile$
diff --git a/plugins/ImageFunctors/VertexCost.h b/plugins/ImageFunctors/VertexCost.h
deleted file mode 100644 (file)
index 7a0bc14..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __fpaPlugins_ImageFunctors__VertexCost__h__
-#define __fpaPlugins_ImageFunctors__VertexCost__h__
-
-#include <itkProcessObject.h>
-#include <fpaPlugins_ImageFunctors_Export.h>
-#include <cpPlugins/Pipeline/Functor.h>
-
-namespace fpaPlugins_ImageFunctors
-{
-  /**
-   */
-  class fpaPlugins_ImageFunctors_EXPORT VertexCost
-    : public cpPlugins::Pipeline::Functor
-  {
-    cpPluginsObject( VertexCost, cpPlugins::Pipeline::Functor, fpaImageFunctors );
-
-  public:
-    virtual void Instantiate( itk::LightObject* filter ) override;
-
-  protected:
-    template< class _TInput >
-    inline void _GD0( _TInput* input, itk::ProcessObject* filter );
-
-    template< class _TInput, class _TOutput >
-    inline void _GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter );
-  };
-
-} // ecapseman
-
-#endif // __fpaPlugins_ImageFunctors__VertexCost__h__
-
-// eof - $RCSfile$
diff --git a/plugins/RegionGrowFunctors/BinaryThreshold.cxx b/plugins/RegionGrowFunctors/BinaryThreshold.cxx
deleted file mode 100644 (file)
index 3a4da31..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-#include <RegionGrowFunctors/BinaryThreshold.h>
-#include <cpInstances/DataObjects/Image.h>
-
-#include <fpa/Image/Functors/RegionGrow/BinaryThreshold.h>
-#include <itkConstNeighborhoodIterator.h>
-#include <vtkPolyData.h>
-
-// -------------------------------------------------------------------------
-fpaPluginsRegionGrowFunctors::BinaryThreshold::
-BinaryThreshold( )
-  : Superclass( )
-{
-  typedef cpPlugins::Pipeline::DataObject _TData;
-  typedef cpInstances::DataObjects::Image _TImage;
-
-  this->_ConfigureInput< _TImage >( "Input", true, false );
-  this->_ConfigureInput< _TData >( "Seeds", false, false );
-  this->_ConfigureOutput< _TData >( "Output" );
-
-  this->m_Parameters.ConfigureAsUint( "Radius", 1 );
-  this->m_Parameters.ConfigureAsReal( "Lower", 0 );
-  this->m_Parameters.ConfigureAsReal( "Upper", 0 );
-}
-
-// -------------------------------------------------------------------------
-fpaPluginsRegionGrowFunctors::BinaryThreshold::
-~BinaryThreshold( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPluginsRegionGrowFunctors::BinaryThreshold::
-_GenerateData( )
-{
-  auto o = this->GetInputData( "Input" );
-  cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
-    this->_Error( "Invalid input image." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpaPluginsRegionGrowFunctors::BinaryThreshold::
-_GD0( _TImage* image )
-{
-  /* TODO
-     typedef itk::ConstNeighborhoodIterator< _TImage > _TInIt;
-     typedef
-     fpa::Image::Functors::RegionGrow::BinaryThreshold< _TImage >
-     _TFunctor;
-     auto out = this->GetOutput( "Output" );
-     auto f = out->GetITK< _TFunctor >( );
-     if( f == NULL )
-     {
-     typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
-     f = ptr_f.GetPointer( );
-     out->SetITK( f );
-
-     } // fi
-
-     // Compute thresholds from seeds
-     auto seeds = this->GetInputData< vtkPolyData >( "Seeds" );
-     if( seeds != NULL )
-     {
-     std::vector< typename _TImage::IndexType > indices;
-     typename _TImage::PointType pnt;
-     typename _TImage::IndexType idx;
-     unsigned int dim =
-     ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
-
-     for( int i = 0; i < seeds->GetNumberOfPoints( ); ++i )
-     {
-     double buf[ 3 ];
-     seeds->GetPoint( i, buf );
-     pnt.Fill( 0 );
-     for( unsigned int d = 0; d < dim; ++d )
-     pnt[ d ] = buf[ d ];
-     if( image->TransformPhysicalPointToIndex( pnt, idx ) )
-     indices.push_back( idx );
-
-     } // rof
-
-     typename _TImage::SizeType r;
-     r.Fill( this->m_Parameters.GetUint( "Radius" ) );
-
-     _TInIt iIt( r, image, image->GetRequestedRegion( ) );
-     double v_s1 = double( 0 );
-     double v_s2 = double( 0 );
-     double v_n = double( 0 );
-     double v_min = std::numeric_limits< double >::max( );
-     double v_max = -v_min;
-     for( auto idxIt = indices.begin( ); idxIt != indices.end( ); ++idxIt )
-     {
-     iIt.SetLocation( *idxIt );
-     for( unsigned int i = 0; i < iIt.Size( ); ++i )
-     {
-     double v = double( iIt.GetPixel( i ) );
-     v_s1 += v;
-     v_s2 += v * v;
-     v_n += double( 1 );
-     v_min = ( v < v_min )? v: v_min;
-     v_max = ( v_max < v )? v: v_max;
-
-     } // rof
-
-     } // rof
-     double m = v_s1 / v_n;
-     double s = ( v_s2 - ( ( v_s1 * v_s1 ) / v_n ) ) / ( v_n - double( 1 ) );
-     s = std::sqrt( s );
-     v_min = m - s;
-     v_max = m + s;
-     f->SetLower( v_min );
-     f->SetUpper( v_max );
-     this->m_Parameters.SetReal( "Lower", f->GetLower( ) );
-     this->m_Parameters.SetReal( "Upper", f->GetUpper( ) );
-     }
-     else
-     {
-     f->SetLower( this->m_Parameters.GetReal( "Lower" ) );
-     f->SetUpper( this->m_Parameters.GetReal( "Upper" ) );
-
-     } // fi
-  */
-}
-
-// eof - $RCSfile$
diff --git a/plugins/RegionGrowFunctors/BinaryThreshold.h b/plugins/RegionGrowFunctors/BinaryThreshold.h
deleted file mode 100644 (file)
index cc5a814..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __fpaPluginsRegionGrowFunctors__BinaryThreshold__h__
-#define __fpaPluginsRegionGrowFunctors__BinaryThreshold__h__
-
-#include <fpaPluginsRegionGrowFunctors_Export.h>
-#include <cpPlugins/Pipeline/ProcessObject.h>
-
-namespace fpaPluginsRegionGrowFunctors
-{
-  /**
-   */
-  class fpaPluginsRegionGrowFunctors_EXPORT BinaryThreshold
-    : public cpPlugins::Pipeline::ProcessObject
-  {
-    cpPluginsObject(
-      BinaryThreshold,
-      cpPlugins::Pipeline::ProcessObject,
-      fpaRegionGrowFunctors
-      );
-
-  protected:
-    template< class _TImage >
-    inline void _GD0( _TImage* image );
-  };
-
-} // ecapseman
-
-#endif // __fpaPluginsRegionGrowFunctors__BinaryThreshold__h__
-
-// eof - $RCSfile$
diff --git a/plugins/RegionGrowFunctors/RegionGrowFunctors.i b/plugins/RegionGrowFunctors/RegionGrowFunctors.i
deleted file mode 100644 (file)
index 8279950..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-header #define ITK_MANUAL_INSTANTIATION
-
-cinclude itkImage.h
-tinclude fpa/Image/Functors/RegionGrow/BinaryThreshold:h|hxx
-** instances fpa::Image::Functors::RegionGrow::BinaryThreshold< itk::Image< #scalar_types#, #pdims# > >
-
-** eof - $RCSfile$