]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 11 Apr 2016 23:14:44 +0000 (18:14 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 11 Apr 2016 23:14:44 +0000 (18:14 -0500)
appli/bash/CMakeLists.txt
cmake/cpPluginsConfig.cmake.in
cmake/cpPlugins_Functions.cmake
lib/cpPlugins_Instances/ScalarVectorImagesBaseFilters.i
plugins/cpPluginsWidgets/SeedWidget.cxx
plugins/cpPluginsWidgets/SeedWidget.h

index 221ab370f26dfad48dcc1a1aff65ffe19d914182..6d2c288096c6769c91ed663ab8ec854560992ba5 100644 (file)
@@ -21,6 +21,7 @@ FOREACH(source ${all_SOURCE_CXX_FILES})
     LIBRARY DESTINATION lib
     ARCHIVE DESTINATION lib/static
     )
+  SET(${name}_APP ${name} CACHE INTERNAL "bash program ${name}")
 ENDFOREACH(source)
 
 ## eof - $RCSfile$
index a07c54cb2c4ba13a9e73605b5e3e79c713ddde60..0fcd4992d929aaf3a5c9c28b467e4610e7b5c2e7 100644 (file)
@@ -3,46 +3,41 @@
 # ===================================
 
 SET(USE_QT4 "@QT4_FOUND@")
-
-# =======================
-# == Find dependencies ==
-# =======================
-
-# Find ITK and VTK
 SET(ITK_DIR @ITK_DIR@)
-FIND_PACKAGE(ITK REQUIRED)
-INCLUDE(${ITK_USE_FILE})
-
 SET(VTK_DIR @VTK_DIR@)
-FIND_PACKAGE(VTK REQUIRED)
-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)
-
 IF(USE_QT4 EQUAL "1")
   SET(QT_QMAKE_EXECUTABLE @QT_QMAKE_EXECUTABLE@)
-  FIND_PACKAGE(Qt4 REQUIRED)
-  INCLUDE(${QT_USE_FILE})
-
-  ## Check for required vtk-qt4 modules
-  SET(
-    vtk_required_modules
-    vtkGUISupportQt
-    vtkGUISupportQtOpenGL
-    )
-  FOREACH(vtk_module ${vtk_required_modules})
-    IF(NOT ${vtk_module}_LOADED)
-      MESSAGE(
-        FATAL_ERROR
-        "${vtk_module} module is required but not available."
-        )
-    ENDIF(NOT ${vtk_module}_LOADED)
-  ENDFOREACH(vtk_module)
 ENDIF(USE_QT4 EQUAL "1")
 
+# ===========================
+# == Include cmake scripts ==
+# ===========================
+
+FIND_FILE(
+  cpPlugins_FUNCTIONS
+  NAMES cpPlugins_Functions.cmake
+  HINTS /usr/share/cmake /usr/local/share/cmake
+  PATHS @CMAKE_INSTALL_PREFIX@/share/cmake @PROJECT_SOURCE_DIR@/cmake
+  DOC "Where is \"cpPlugins_Functions.cmake\"?"
+  )
+IF(NOT cpPlugins_FUNCTIONS)
+  MESSAGE(FATAL_ERROR "Where is \"cpPlugins_Functions.cmake\"?")
+ENDIF(NOT cpPlugins_FUNCTIONS)
+GET_FILENAME_COMPONENT(
+  cpPlugins_FUNCTIONS_ABSOLUTE ${cpPlugins_FUNCTIONS}
+  ABSOLUTE
+  )
+GET_FILENAME_COMPONENT(
+  cpPlugins_CMAKE_DIR ${cpPlugins_FUNCTIONS_ABSOLUTE}
+  DIRECTORY
+  )
+INCLUDE(${cpPlugins_FUNCTIONS})
+INCLUDE(${cpPlugins_CMAKE_DIR})
+INCLUDE(${cpPlugins_CMAKE_DIR}/cpPlugins_Options.cmake)
+INCLUDE(${cpPlugins_CMAKE_DIR}/cpPlugins_KitwareTools.cmake)
+IF(USE_QT4 EQUAL "1")
+  INCLUDE(${cpPlugins_CMAKE_DIR}/cpPlugins_Qt4Tools.cmake)
+ENDIF(USE_QT4 EQUAL "1")
 
 # =========================
 # == Include directories ==
@@ -106,6 +101,7 @@ SET(
 FOREACH(prog ${exec_PROGRAMS})
   IF(MSVC)
     FIND_PROGRAM(
+      ${prog}_APP
       NAMES ${prog}
       HINTS /usr /usr/local
       PATHS @CMAKE_INSTALL_PREFIX@/bin @PROJECT_BINARY_DIR@/Debug @PROJECT_BINARY_DIR@/Release @PROJECT_BINARY_DIR@/MinSizeRel @PROJECT_BINARY_DIR@/RelWithDebInfo
@@ -114,7 +110,7 @@ FOREACH(prog ${exec_PROGRAMS})
       )
   ELSE(MSVC)
     FIND_PROGRAM(
-      ${prog}
+      ${prog}_APP
       NAMES ${prog}
       HINTS /usr /usr/local
       PATHS @CMAKE_INSTALL_PREFIX@/bin @PROJECT_BINARY_DIR@
index ca9644ed94fbe796e5caa81e9ebe7d5bb4f62604..d2ec9ca333e5c5cb1c62da9533e4aa1743e2ad8b 100644 (file)
@@ -10,8 +10,8 @@ SET(l_NAME "${libprefix}${name}")
 SET(x_FILE "${CMAKE_CURRENT_BINARY_DIR}/${l_NAME}_Export.h")
 ADD_CUSTOM_COMMAND(
   OUTPUT ${h_FILE} ${s_FILE}
-  DEPENDS cpPlugins_CreateInstances ${i_FILE}
-  COMMAND cpPlugins_CreateInstances ${i_FILE} ${l_NAME} ${h_FILE} ${s_FILE}
+  DEPENDS ${cpPlugins_CreateInstances_APP} ${i_FILE}
+  COMMAND ${cpPlugins_CreateInstances_APP} ${i_FILE} ${l_NAME} ${h_FILE} ${s_FILE}
   )
 IF(EXISTS ${e_FILE})
   ADD_LIBRARY(${l_NAME} SHARED ${s_FILE} ${e_FILE})
@@ -38,8 +38,8 @@ FUNCTION(cpPlugins_WrapPlugins libname ver sver headers sources other_sources qt
 SET(host ${CMAKE_CURRENT_BINARY_DIR}/${libname}_Host.cxx)
 ADD_CUSTOM_COMMAND(
   OUTPUT ${host}
-  DEPENDS cpPlugins_HostCreator ${headers}
-  COMMAND cpPlugins_HostCreator ${host} ${headers}
+  DEPENDS ${cpPlugins_HostCreator_APP} ${headers}
+  COMMAND ${cpPlugins_HostCreator_APP} ${host} ${headers}
   )
 ADD_LIBRARY(${libname} SHARED ${host} ${sources} ${other_sources})
 SET_TARGET_PROPERTIES(
index c017bf9953f7491fb44920c5d5cdc3c715b8ef02..4b47a37b12ec8dd09df0f9f61ed41d44161b7680 100644 (file)
@@ -15,5 +15,6 @@ t itk{#itk_filters}Filter.h
 * = Base filter types =
 * =====================
 c itk::{#itk_filters}Filter< itk::Image< #pixels, #dims >, itk::Image< itk::CovariantVector< #floats, #dims >, #dims > >
+c itk::{#itk_filters}Filter< itk::Image< itk::CovariantVector< #floats, #dims >, #dims >, itk::Image< #floats, #dims > >
 
 * eof - $RCSfile$
index 03e721572851e1d1dbbd80bff1153df355af75c8..b65d29f06de5e4f97f3d965d66721a2e0d23077f 100644 (file)
@@ -1,6 +1,7 @@
 #include "SeedWidget.h"
 
 #include <cpPlugins/Image.h>
+#include <cpExtensions/DataStructures/ImageIndexesContainer.h>
 #include <cpExtensions/QT/SimpleMPRWidget.h>
 #include <cpExtensions/Interaction/ImageInteractorStyle.h>
 #include <vtkRenderWindowInteractor.h>
@@ -23,9 +24,6 @@ SeedWidget( )
 {
   this->_AddInput( "ReferenceImage" );
   this->_AddOutput< cpPlugins::DataObject >( "Output" );
-
-  this->m_Parameters.ConfigureAsBool( "SeedsAreInRealSpace" );
-  this->m_Parameters.SetBool( "SeedsAreInRealSpace", false );
 }
 
 // -------------------------------------------------------------------------
@@ -49,167 +47,81 @@ template< class _TImage >
 std::string cpPluginsWidgets::SeedWidget::
 _GD0( _TImage* image )
 {
-  if( image != NULL )
-  {
-    if( this->m_Parameters.GetBool( "SeedsAreInRealSpace" ) )
-      return( this->_GD1_Points( image ) );
-    else
-      return( this->_GD1_Vertices( image ) );
-  }
-  else
-    return( "Widgets::SeedWidget: Input image dimension not supported." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-std::string cpPluginsWidgets::SeedWidget::
-_GD1_Points( _TImage* image )
-{
+  typedef
+    cpExtensions::DataStructures::ImageIndexesContainer< _TImage::ImageDimension >
+    _TContainer;
   typedef cpExtensions::Interaction::ImageInteractorStyle _S;
-  typedef itk::Point< double, _TImage::ImageDimension > _P;
-  typedef itk::SimpleDataObjectDecorator< std::vector< _P > > _Container;
-
-  auto container = this->_CreateITK< _Container >( );
 
-  double aux_pnt[ 3 ];
-  unsigned int dim = ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
-
-  container->Get( ).clear( );
-
-  // MPR
-  if( this->m_MPRViewer != NULL )
+  if( image != NULL )
   {
-    for( unsigned int i = 0; i < 4; ++i )
+    auto container = this->_CreateITK< _TContainer >( );
+    double aux_pnt[ 3 ];
+    unsigned int dim = ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
+    container->Get( ).clear( );
+
+    // MPR
+    if( this->m_MPRViewer != NULL )
     {
-      _S* s =
-        dynamic_cast< _S* >(
-          this->m_MPRViewer->GetInteractor( i )->GetInteractorStyle( )
-          );
-      if( s != NULL )
+      for( unsigned int i = 0; i < 4; ++i )
       {
-        if( this->m_Configured )
+        _S* s =
+          dynamic_cast< _S* >(
+            this->m_MPRViewer->GetInteractor( i )->GetInteractorStyle( )
+            );
+        if( s != NULL )
         {
-          for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
+          if( this->m_Configured )
           {
-            s->GetSeedAsPoint( i, aux_pnt );
-            _P seed;
-            for( unsigned int d = 0; d < dim; ++d )
-              seed[ d ] = aux_pnt[ d ];
-            container->Get( ).push_back( seed );
-
-          } // rof
-        }
-        else
-          s->SeedWidgetOn( );
-
-      } // fi
-
-    } // rof
-
-  } // fi
-
-  // Single interactor
-  _S* s = dynamic_cast< _S* >( this->m_SingleInteractor );
-  if( s != NULL )
-  {
-    if( this->m_Configured )
-    {
-      for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
-      {
-        s->GetSeedAsPoint( i, aux_pnt );
-        _P seed;
-        for( unsigned int d = 0; d < dim; ++d )
-          seed[ d ] = aux_pnt[ d ];
-        container->Get( ).push_back( seed );
+            for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
+            {
+              s->GetSeedAsPoint( i, aux_pnt );
+              typename _TImage::PointType seed;
+              for( unsigned int d = 0; d < dim; ++d )
+                seed[ d ] = aux_pnt[ d ];
+              typename _TImage::IndexType idx;
+              if( image->TransformPhysicalPointToIndex( seed, idx ) )
+                container->Get( ).push_back( idx );
+
+            } // rof
+          }
+          else
+            s->SeedWidgetOn( );
+
+        } // fi
 
       } // rof
-    }
-    else
-      s->SeedWidgetOn( );
-
-  } // fi
-  this->m_Configured = true;
 
-  this->GetOutputData( "Output" )->SetITK( container );
-  return( "" );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-std::string cpPluginsWidgets::SeedWidget::
-_GD1_Vertices( _TImage* image )
-{
-  typedef cpExtensions::Interaction::ImageInteractorStyle _S;
-  typedef
-    itk::SimpleDataObjectDecorator< std::vector< typename _TImage::IndexType > >
-    _Container;
-  auto container = this->_CreateITK< _Container >( );
-
-  double aux_pnt[ 3 ];
-  unsigned int dim = ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
+    } // fi
 
-  container->Get( ).clear( );
-
-  // MPR
-  if( this->m_MPRViewer != NULL )
-  {
-    for( unsigned int i = 0; i < 4; ++i )
+    // Single interactor
+    _S* s = dynamic_cast< _S* >( this->m_SingleInteractor );
+    if( s != NULL )
     {
-      _S* s =
-        dynamic_cast< _S* >(
-          this->m_MPRViewer->GetInteractor( i )->GetInteractorStyle( )
-          );
-      if( s != NULL )
+      if( this->m_Configured )
       {
-        if( this->m_Configured )
+        for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
         {
-          for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
-          {
-            s->GetSeedAsPoint( i, aux_pnt );
-            typename _TImage::PointType seed;
-            for( unsigned int d = 0; d < dim; ++d )
-              seed[ d ] = aux_pnt[ d ];
-            typename _TImage::IndexType idx;
-            if( image->TransformPhysicalPointToIndex( seed, idx ) )
-              container->Get( ).push_back( idx );
-
-          } // rof
-        }
-        else
-          s->SeedWidgetOn( );
-
-      } // fi
-
-    } // rof
-
-  } // fi
-
-  // Single interactor
-  _S* s = dynamic_cast< _S* >( this->m_SingleInteractor );
-  if( s != NULL )
-  {
-    if( this->m_Configured )
-    {
-      for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
-      {
-        s->GetSeedAsPoint( i, aux_pnt );
-        typename _TImage::PointType seed;
-        for( unsigned int d = 0; d < dim; ++d )
-          seed[ d ] = aux_pnt[ d ];
-        typename _TImage::IndexType idx;
-        if( image->TransformPhysicalPointToIndex( seed, idx ) )
-          container->Get( ).push_back( idx );
-
-      } // rof
-    }
-    else
-      s->SeedWidgetOn( );
-
-  } // fi
-  this->m_Configured = true;
-
-  this->GetOutputData( "Output" )->SetITK( container );
-  return( "" );
+          s->GetSeedAsPoint( i, aux_pnt );
+          typename _TImage::PointType seed;
+          for( unsigned int d = 0; d < dim; ++d )
+            seed[ d ] = aux_pnt[ d ];
+          typename _TImage::IndexType idx;
+          if( image->TransformPhysicalPointToIndex( seed, idx ) )
+            container->Get( ).push_back( idx );
+
+        } // rof
+      }
+      else
+        s->SeedWidgetOn( );
+
+    } // fi
+    this->m_Configured = true;
+    container->SetReferenceImage( image );
+    this->GetOutputData( "Output" )->SetITK( container );
+    return( "" );
+  }
+  else
+    return( "Widgets::SeedWidget: Input image dimension not supported." );
 }
 
 // eof - $RCSfile$
index 2ae4976b05abdf4c9d7756d708c07f6285336d28..52f61c5a8a1b0e897538a031f1d4b33931c6f7d9 100644 (file)
@@ -34,12 +34,6 @@ namespace cpPluginsWidgets
     template< class _TImage >
       inline std::string _GD0( _TImage* image );
 
-    template< class _TImage >
-      inline std::string _GD1_Points( _TImage* image );
-
-    template< class _TImage >
-      inline std::string _GD1_Vertices( _TImage* image );
-
   private:
     // Purposely not implemented
     SeedWidget( const Self& );