]> Creatis software - cpPlugins.git/commitdiff
Plugin system is now instalable. Dependency to boost eliminated.
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 1 Oct 2015 22:18:18 +0000 (17:18 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 1 Oct 2015 22:18:18 +0000 (17:18 -0500)
CMakeLists.txt
appli/ImageMPR/ImageMPR.cxx
appli/bash/CMakeLists.txt
appli/bash/cpPlugins_createHost.cxx
cmake/cpPluginsConfig.cmake.in
lib/cpExtensions/Algorithms/SecondRankDiffusionTensorToPolyData.cxx [deleted file]
lib/cpExtensions/Algorithms/SecondRankDiffusionTensorToPolyData.h [deleted file]
lib/cpPlugins/Plugins/SecondRankDiffusionTensorToPolyData.cxx [deleted file]
lib/cpPlugins/Plugins/SecondRankDiffusionTensorToPolyData.h [deleted file]

index d1ed48acf920919462f47ef3eb936f4dfab48f51..83c4b843c7568a621d7a3c7fb8228d59d2cd736c 100644 (file)
@@ -50,12 +50,6 @@ ENDIF(BUILD_SHARED_LIBRARIES)
 # Prepare header to build shared libs (windows)
 INCLUDE(GenerateExportHeader)
 
-# Find boost
-FIND_PACKAGE(Boost 1.30 COMPONENTS filesystem system REQUIRED)
-IF(Boost_FOUND)
-  INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
-ENDIF(Boost_FOUND)
-
 # Find ITK and VTK
 FIND_PACKAGE(ITK REQUIRED)
 FIND_PACKAGE(VTK REQUIRED)
index f9613cb9819b87332bda13b5eff45f4fd9b63912..5951d1fd1872acffdd35b4278d5275b93f6b93c5 100644 (file)
@@ -298,7 +298,6 @@ _triggered_actionOpenSegmentation( )
 void ImageMPR::
 _triggered_actionOpenInputPolyData( )
 {
-  /*
   // Show dialog and check if it was accepted
   QFileDialog dialog( this );
   dialog.setFileMode( QFileDialog::ExistingFile );
@@ -360,14 +359,12 @@ _triggered_actionOpenInputPolyData( )
       tr( "Error reading mesh" ),
       tr( err.c_str( ) )
       );
-  */
 }
 
 // -------------------------------------------------------------------------
 void ImageMPR::
 _triggered_actionImageToImage( )
 {
-  /*
   if( this->m_InputImage.IsNull( ) )
     return;
 
@@ -407,14 +404,12 @@ _triggered_actionImageToImage( )
       tr( "Error executing filter" ),
       tr( err.c_str( ) )
       );
-  */
 }
 
 // -------------------------------------------------------------------------
 void ImageMPR::
 _triggered_actionImageToMesh( )
 {
-  /*
   if( this->m_InputImage.IsNull( ) )
     return;
 
@@ -456,7 +451,6 @@ _triggered_actionImageToMesh( )
       tr( "Error executing filter" ),
       tr( err.c_str( ) )
       );
-      */
 }
 
 // eof - $RCSfile$
index 33785d170abd36d355c24699423e3d8cb88ec74a..da6d729411fe3d264010b8cfebabc221c9bf6367 100644 (file)
@@ -9,7 +9,6 @@ SET(
 
 FOREACH(prog ${BASH_PROGRAMS}) 
   ADD_EXECUTABLE(${prog} ${prog}.cxx)
-  TARGET_LINK_LIBRARIES(${prog} ${Boost_LIBRARIES})
 ENDFOREACH(prog)
 
 ## eof - $RCSfile$
index 0914cca5a607def05c39aee0aaf771e039f6e097..6f8214d1bb828c1f0f0d9b0f11d92a21dce4aa7e 100644 (file)
@@ -1,9 +1,35 @@
+#include <cstring>
 #include <fstream>
 #include <iostream>
 #include <string>
 
-#include <boost/filesystem/path.hpp>
+// -------------------------------------------------------------------------
+std::string GetFileName( const std::string& path )
+{
+  // Extract filename
+  char* buffer = new char[ path.size( ) + 1 ];
+  std::memcpy( buffer, path.c_str( ), path.size( ) );
+  buffer[ path.size( ) ] = '\0';
+  char* tok = std::strtok( buffer, "/\\" );
+  char* ptr_fname = tok;
+  while( tok != NULL )
+  {
+    ptr_fname = tok;
+    tok = std::strtok( NULL, "/\\" );
 
+  } // elihw
+  std::string fname( ptr_fname );
+  delete [] buffer;
+
+  // Delete extension
+  std::size_t pos = fname.find_last_of( "." );
+  if( pos != std::string::npos )
+    fname = fname.substr( 0, pos );
+  
+  return( fname );
+}
+
+// -------------------------------------------------------------------------
 int main( int argc, char* argv[] )
 {
   // Open file
@@ -37,16 +63,12 @@ int main( int argc, char* argv[] )
     << "  using namespace " << argv[ 2 ] << ";" << std::endl;
 
   for( int i = 3; i < argc; ++i )
-  {
-    boost::filesystem::path p( argv[ i ] );
     output_code
       << "  host.add( new "
-      << p.stem( ).generic_string( )
+      << GetFileName( argv[ i ] )
       << "Provider( ) );"
       << std::endl;
 
-  } // rof
-
   output_code
     << "  return( true );" << std::endl
     << "}" << std::endl;
index df933c79bec3f01c82ffe4cfc5ea3822e00985ba..8c2e0a86998995b665759ff65f8536f323725d1e 100644 (file)
@@ -46,4 +46,13 @@ SET(cpExtensions_LIBRARY cpExtensions)
 SET(cpPlugins_Interface_LIBRARY cpPlugins_Interface)
 SET(cpPlugins_LIBRARY cpPlugins)
 
+# ======================
+# -- Executable names --
+# ======================
+
+SET(
+  cpPlugins_createHost_APP
+  @PROJECT_BINARY_DIR@/cpPlugins_createHost
+  )
+
 ## eof - $RCSfile$
diff --git a/lib/cpExtensions/Algorithms/SecondRankDiffusionTensorToPolyData.cxx b/lib/cpExtensions/Algorithms/SecondRankDiffusionTensorToPolyData.cxx
deleted file mode 100644 (file)
index 0645898..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-// -------------------------------------------------------------------------
-// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
-// -------------------------------------------------------------------------
-
-#include <cpExtensions/Algorithms/SecondRankDiffusionTensorToPolyData.h>
-#include <itkImage.h>
-#include <itkSymmetricSecondRankTensor.h>
-#include <itkImageRegionConstIteratorWithIndex.h>
-#include <vtkInformation.h>
-#include <vtkInformationVector.h>
-#include <vtkPoints.h>
-#include <vtkPointData.h>
-#include <vtkSmartPointer.h>
-#include <vtkDoubleArray.h>
-
-// -------------------------------------------------------------------------
-template< class I >
-typename cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I >::
-Self* cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I >::
-New( )
-{
-  return( new Self );
-}
-
-// -------------------------------------------------------------------------
-template< class I >
-void cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I >::
-SetInputData( const I* image )
-{
-  this->m_ITKImage = image;
-  this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template< class I >
-cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I >::
-SecondRankDiffusionTensorToPolyData( )
-  : vtkPolyDataAlgorithm( )
-{
-  this->SetNumberOfInputPorts( 0 );
-}
-
-// -------------------------------------------------------------------------
-template< class I >
-cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I >::
-~SecondRankDiffusionTensorToPolyData( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class I >
-int cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I >::
-RequestData(
-  vtkInformation* request,
-  vtkInformationVector** inputVector,
-  vtkInformationVector* outputVector
-  )
-{
-  if( this->m_ITKImage.IsNull( ) )
-    return( 0 );
-  
-  // get the info objects
-  vtkInformation* outInfo = outputVector->GetInformationObject( 0 );
-  vtkPolyData* polyData = vtkPolyData::SafeDownCast(
-    outInfo->Get(vtkDataObject::DATA_OBJECT())
-    );
-
-  itk::ImageRegionConstIteratorWithIndex< I > tensorIt( this->m_ITKImage, this->m_ITKImage->GetRequestedRegion() );
-
-  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
-  vtkSmartPointer<vtkDoubleArray> vtkTensors = vtkSmartPointer<vtkDoubleArray>::New();
-  vtkTensors->SetNumberOfComponents(9);
-  for ( tensorIt.GoToBegin(); !tensorIt.IsAtEnd(); ++tensorIt )
-  {
-    typename I::IndexType tensorIndex = tensorIt.GetIndex();
-    typename I::PixelType tensor = tensorIt.Get();
-    typename I::PointType ptensor;
-
-    // TODO: std::cout << "\n Index [" << tensorIndex[0] << ", " << tensorIndex[1] << ", " << tensorIndex[2] << "]" << std::endl;
-    this->m_ITKImage->TransformIndexToPhysicalPoint( tensorIndex, ptensor );
-    vtkIdType vtkPointID = points->InsertNextPoint(ptensor[0], ptensor[1], ptensor[2]);
-
-    /**
-     * Definition included in cdifTypes.
-     * typedef itk::SymmetricSecondRankTensor< double > Diffusion2ndRankTensor;
-     */
-    //Diffusion2ndRankTensor Diffusion2ndRankTensor;
-        
-        
-    /**
-     * SYMMETRIC SECOND RANK TENSOR
-     *
-     * The upper-right triangle of the matrix:
-     *
-     *       | 0  1  2  |
-     *       | X  3  4  |
-     *       | X  X  5  |
-     *
-     *       | xx  xy  xz  |
-     *       | X   yy  yz  |
-     *       | X   X   zz  |
-     */
-    /*
-      Diffusion2ndRankTensor = tensor[0];
-      Diffusion2ndRankTensor = tensor[1];
-      Diffusion2ndRankTensor = tensor[2];
-      Diffusion2ndRankTensor = tensor[3];
-      Diffusion2ndRankTensor = tensor[4];
-      Diffusion2ndRankTensor = tensor[5];
-    */
-    typename I::PixelType::EigenValuesArrayType    evalues;
-    typename I::PixelType::EigenVectorsMatrixType  evectors;
-        
-    /**
-     * Return an array containing EigenValues,
-     * and a matrix containing Eigenvectors.
-     */
-    tensor.ComputeEigenAnalysis(evalues, evectors);
-        
-    /*
-      std::cout << "[C-DIFFUSION - NRRD Tensors Example] Eigen values: " << evalues[0] << ", " << evalues[1] << ", " << evalues[2] << std::endl;
-      
-      std::cout << "[C-DIFFUSION - NRRD Tensors Example] Eigen vectors: "
-      
-      << "(" << evectors(0,0) << ", " << evectors(0,1) << ", " << evectors(0,2) << "), "
-      << "(" << evectors(1,0) << ", " << evectors(1,1) << ", " << evectors(1,2) << "), "
-      << "(" << evectors(2,0) << ", " << evectors(2,1) << ", " << evectors(2,2) << ")" << std::endl;
-    */
-    evectors.GetVnlMatrix().scale_row(0, evalues[0]);
-    evectors.GetVnlMatrix().scale_row(1, evalues[1]);
-    evectors.GetVnlMatrix().scale_row(2, evalues[2]);
-    
-    /*
-      std::cout << "[C-DIFFUSION - NRRD Tensors Example] Eigen values x Eigen vectors : "
-      
-      << "(" << evectors(0,0) << ", " << evectors(0,1) << ", " << evectors(0,2) << "), "
-      << "(" << evectors(1,0) << ", " << evectors(1,1) << ", " << evectors(1,2) << "), "
-      << "(" << evectors(2,0) << ", " << evectors(2,1) << ", " << evectors(2,2) << ")" << std::endl;
-    */
-    vtkTensors->InsertTuple9(
-      vtkPointID,
-      evectors(0,0), evectors(0,1), evectors(0,2),
-      evectors(1,0), evectors(1,1), evectors(1,2),
-      evectors(2,0), evectors(2,1), evectors(2,2)
-      );
-  } // rof
-    
-  polyData->SetPoints( points );
-  vtkSmartPointer<vtkPointData> pointData = polyData->GetPointData();
-  pointData->SetTensors( vtkTensors );
-  return( 1 );
-
-  /**
-   * VISUALISATION CODE BELOW
-   */
-  
-//    vtkSmartPointer<vtkCubeSource> cubeSource = vtkSmartPointer<vtkCubeSource>::New();
-//    cubeSource->Update();
-//
-//    vtkSmartPointer<vtkTensorGlyph> tensorGlyph = vtkSmartPointer<vtkTensorGlyph>::New();
-//#if VTK_MAJOR_VERSION <= 5
-//    tensorGlyph->SetInput(polyData);
-//#else
-//    tensorGlyph->SetInputData(polyData);
-//#endif
-//    tensorGlyph->SetSourceConnection(cubeSource->GetOutputPort());
-//    tensorGlyph->ColorGlyphsOff();
-//    tensorGlyph->ThreeGlyphsOff();
-//    tensorGlyph->ExtractEigenvaluesOff();
-//    tensorGlyph->Update();
-//    .
-//    .
-//    .
-
-}
-
-// -------------------------------------------------------------------------
-template class cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< itk::Image< itk::SymmetricSecondRankTensor< float, 3 >, 3 > >;
-template class cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< itk::Image< itk::SymmetricSecondRankTensor< double, 3 >, 3 > >;
-
-// eof - $RCSfile$
diff --git a/lib/cpExtensions/Algorithms/SecondRankDiffusionTensorToPolyData.h b/lib/cpExtensions/Algorithms/SecondRankDiffusionTensorToPolyData.h
deleted file mode 100644 (file)
index 1861263..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// -------------------------------------------------------------------------
-// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
-// -------------------------------------------------------------------------
-
-#ifndef __CPEXTENSIONS__ALGORITHMS__SECONDRANKDIFFUSIONTENSORTOPOLYDATA__H__
-#define __CPEXTENSIONS__ALGORITHMS__SECONDRANKDIFFUSIONTENSORTOPOLYDATA__H__
-
-#include <cpExtensions/cpExtensions_Export.h>
-
-#include <vtkPolyDataAlgorithm.h>
-
-namespace cpExtensions
-{
-  namespace Algorithms
-  {
-    /**
-     */
-    template< class I >
-    class cpExtensions_EXPORT SecondRankDiffusionTensorToPolyData
-      : public vtkPolyDataAlgorithm
-    {
-    public:
-      typedef SecondRankDiffusionTensorToPolyData Self;
-
-    public:
-      static Self* New( );
-      vtkTypeMacro( SecondRankDiffusionTensorToPolyData, vtkPolyDataAlgorithm );
-
-      void SetInputData( const I* image );
-
-    protected:
-      SecondRankDiffusionTensorToPolyData( );
-      virtual ~SecondRankDiffusionTensorToPolyData( );
-
-      virtual int RequestData(
-        vtkInformation* , vtkInformationVector**, vtkInformationVector*
-        );
-
-    private:
-      SecondRankDiffusionTensorToPolyData( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      typename I::ConstPointer m_ITKImage;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __CPEXTENSIONS__ALGORITHMS__SECONDRANKDIFFUSIONTENSORTOPOLYDATA__H__
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Plugins/SecondRankDiffusionTensorToPolyData.cxx b/lib/cpPlugins/Plugins/SecondRankDiffusionTensorToPolyData.cxx
deleted file mode 100644 (file)
index 62a5907..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#include <cpPlugins/Plugins/SecondRankDiffusionTensorToPolyData.h>
-#include <cpPlugins/Interface/Image.h>
-#include <cpPlugins/Interface/Mesh.h>
-
-#include <cpExtensions/Algorithms/SecondRankDiffusionTensorToPolyData.h>
-#include <itkSymmetricSecondRankTensor.h>
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::SecondRankDiffusionTensorToPolyData::
-SecondRankDiffusionTensorToPolyData( )
-  : Superclass( ),
-    m_Algorithm( NULL )
-{
-  this->m_ClassName = "cpPlugins::SecondRankDiffusionTensorToPolyData";
-  this->m_ClassCategory = "ImageToMeshFilter";
-
-  this->SetNumberOfInputs( 1 );
-  this->SetNumberOfOutputs( 1 );
-  this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
-
-  using namespace cpPlugins::Interface;
-  this->m_Parameters = this->m_DefaultParameters;
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::SecondRankDiffusionTensorToPolyData::
-~SecondRankDiffusionTensorToPolyData( )
-{
-  if( this->m_Algorithm != NULL )
-    this->m_Algorithm->Delete( );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::SecondRankDiffusionTensorToPolyData::
-_GenerateData( )
-{
-  // Get input
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( 0 );
-  if( image == NULL )
-    return( "SecondRankDiffusionTensorToPolyData: Input data is not a valid image." );
-
-  itk::DataObject* itk_image = NULL;
-  std::string r = "";
-  cpPlugins_ImageArray_Input_Demangle( itk::SymmetricSecondRankTensor, float, 3, 3, image, itk_image, r, _RealGD );
-  else cpPlugins_ImageArray_Input_Demangle( itk::SymmetricSecondRankTensor, double, 3, 3, image, itk_image, r, _RealGD );
-  else
-    r = "SecondRankDiffusionTensorToPolyData: Input does not have a DiffusionTensor3D.";
-  return( r );
-}
-
-// -------------------------------------------------------------------------
-template< class I >
-std::string cpPlugins::Plugins::SecondRankDiffusionTensorToPolyData::
-_RealGD( itk::DataObject* image )
-{
-  typedef cpExtensions::Algorithms::SecondRankDiffusionTensorToPolyData< I > _F;
-
-  // Configure filter
-  _F* f = NULL;
-  if( this->m_Algorithm == NULL )
-  {
-    f = _F::New( );
-    this->m_Algorithm = f;
-
-  } // fi
-  f->SetInputData( dynamic_cast< I* >( image ) );
-  this->m_Algorithm->Update( );
-
-  // Connect output
-  cpPlugins::Interface::Mesh* out =
-    this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
-  if( out != NULL )
-  {
-    out->SetVTKMesh( this->m_Algorithm->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "OtsuThresholdImageFilter: output not correctly created." );
-}
-
-// eof - $RCSfile$
diff --git a/lib/cpPlugins/Plugins/SecondRankDiffusionTensorToPolyData.h b/lib/cpPlugins/Plugins/SecondRankDiffusionTensorToPolyData.h
deleted file mode 100644 (file)
index ff03716..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef __CPPLUGINS__PLUGINS__SECONDRANKDIFFUSIONTENSORTOPOLYDATA__H__
-#define __CPPLUGINS__PLUGINS__SECONDRANKDIFFUSIONTENSORTOPOLYDATA__H__
-
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
-#include <cpPlugins/Interface/BaseProcessObjects.h>
-
-class vtkPolyDataAlgorithm;
-
-namespace cpPlugins
-{
-  namespace Plugins
-  {
-    /**
-     */
-    class cpPlugins_EXPORT SecondRankDiffusionTensorToPolyData
-      : public cpPlugins::Interface::ImageToMeshFilter
-    {
-    public:
-      typedef SecondRankDiffusionTensorToPolyData     Self;
-      typedef cpPlugins::Interface::ImageToMeshFilter Superclass;
-      typedef itk::SmartPointer< Self >               Pointer;
-      typedef itk::SmartPointer< const Self >         ConstPointer;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( SecondRankDiffusionTensorToPolyData, cpPluginsInterfaceImageToMeshFilter );
-
-    protected:
-      SecondRankDiffusionTensorToPolyData( );
-      virtual ~SecondRankDiffusionTensorToPolyData( );
-
-      virtual std::string _GenerateData( );
-
-      template< class I >
-        inline std::string _RealGD( itk::DataObject* image );
-
-    private:
-      // Purposely not implemented
-      SecondRankDiffusionTensorToPolyData( const Self& );
-      Self& operator=( const Self& );
-
-    protected:
-      vtkPolyDataAlgorithm* m_Algorithm;
-    };
-
-    // ---------------------------------------------------------------------
-    CPPLUGINS_INHERIT_PROVIDER( SecondRankDiffusionTensorToPolyData );
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__PLUGINS__SECONDRANKDIFFUSIONTENSORTOPOLYDATA__H__
-
-// eof - $RCSfile$