]> Creatis software - cpPlugins.git/commitdiff
..
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Wed, 23 Nov 2016 16:19:12 +0000 (11:19 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Wed, 23 Nov 2016 16:19:12 +0000 (11:19 -0500)
appli/PipelineEditor/PipelineEditor.cxx
lib/cpBaseQtApplication/MainWindow.cxx
lib/cpInstances/CMakeLists.txt
lib/cpInstances/ITKLevelSetFilters.i
plugins/ITKLevelSetFilters/LaplacianSegmentationLevelSetImageFilter.cxx [new file with mode: 0644]
plugins/ITKLevelSetFilters/LaplacianSegmentationLevelSetImageFilter.h [new file with mode: 0644]

index f0b8616da37f708cd484a2ec532c971acdea48f7..5751a904d68f776f9a632fff29ea7a7a1da9819f 100644 (file)
@@ -92,7 +92,10 @@ _slotView( const std::string& name, bool show )
       }
       else if( mesh != NULL )
       {
-        // TODO
+        viewer =
+          this->_configureViewer< cpExtensions::QT::SimpleMPRWidget >(
+            this->m_UI->Viewer
+            );
 
       } // fi
       if(
index 37b18aa56168693a98df86b999010b239002e2db..9b16236acb94760f09af7f12bf3fb1f8d7e8c6ad 100644 (file)
@@ -133,6 +133,14 @@ void cpBaseQtApplication::MainWindow::
 setViewer( cpExtensions::QT::ActorsWidgetInterface* v )
 {
   this->m_Viewer = v;
+  if( this->m_Viewer != NULL )
+  {
+    auto interactors = this->m_Viewer->GetInteractors( );
+    for( auto wIt : this->m_Workspaces )
+      for( auto i : interactors )
+        wIt.second->AddInteractor( i );
+
+  } // fi
 }
 
 // -------------------------------------------------------------------------
@@ -227,6 +235,14 @@ _addWorkspace( const std::string& name )
     this->m_Workspaces[ name ] = TWorkspace::New( );
     if( this->m_Canvas != NULL )
       this->m_Canvas->setWorkspace( this->m_Workspaces[ name ] );
+    if( this->m_Viewer !=  NULL )
+    {
+      auto interactors = this->m_Viewer->GetInteractors( );
+      auto wIt = this->m_Workspaces.find( name );
+      for( auto i : interactors )
+        wIt->second->AddInteractor( i );
+
+    } // fi
     this->setWindowTitle( ( this->m_BaseWindowTitle + name ).c_str( ) );
 
   } // fi
index 4b0e9adcce1baa3aa741684be2637868c38ea126..c9f77b811b04a69303be9c517792a8987dfefe2d 100644 (file)
@@ -165,6 +165,7 @@ TARGET_LINK_LIBRARIES(
 TARGET_LINK_LIBRARIES(
   ${_pfx}ITKLevelSetFilters
   ${_pfx}ITKAnisotropicSmoothing
+  ${_pfx}UnaryFunctorFilters
   ${_pfx}Image
   ${_pfx}ImageIterators
   ${_pfx}NeighborhoodImageIterators
index 1031051b22dd76a14b3d2a802e50cbbe92148ba5..afed5feabbe1f4c4ffa1398d5f86540374d810a4 100644 (file)
@@ -1,9 +1,9 @@
 header #define ITK_MANUAL_INSTANTIATION
 
 define base=ZeroCrossingImageFilter;SparseFieldLevelSetImageFilter
-define filters=SegmentationLevelSetImageFilter;ThresholdSegmentationLevelSetImageFilter
+define filters=SegmentationLevelSetImageFilter;ThresholdSegmentationLevelSetImageFilter;LaplacianSegmentationLevelSetImageFilter
 define functions=LevelSetFunction
-define ls_functions=SegmentationLevelSetFunction;ThresholdSegmentationLevelSetFunction
+define ls_functions=SegmentationLevelSetFunction;ThresholdSegmentationLevelSetFunction;LaplacianSegmentationLevelSetFunction
 
 define i_reals=#real_types#
 define o_reals=#real_types#
diff --git a/plugins/ITKLevelSetFilters/LaplacianSegmentationLevelSetImageFilter.cxx b/plugins/ITKLevelSetFilters/LaplacianSegmentationLevelSetImageFilter.cxx
new file mode 100644 (file)
index 0000000..a5fe1f9
--- /dev/null
@@ -0,0 +1,72 @@
+#include <ITKLevelSetFilters/LaplacianSegmentationLevelSetImageFilter.h>
+#include <cpInstances/Image.h>
+
+#include <itkLaplacianSegmentationLevelSetImageFilter.h>
+
+// -------------------------------------------------------------------------
+cpPluginsITKLevelSetFilters::LaplacianSegmentationLevelSetImageFilter::
+LaplacianSegmentationLevelSetImageFilter( )
+  : Superclass( )
+{
+  this->_ConfigureInput< cpInstances::Image >( "Input", true, false );
+  this->_ConfigureInput< cpInstances::Image >( "Feature", true, false );
+  this->_ConfigureOutput< cpInstances::Image >( "Output" );
+
+  this->m_Parameters.ConfigureAsReal( "PropagationScaling", 1 );
+  this->m_Parameters.ConfigureAsReal( "CurvatureScaling", 1 );
+  this->m_Parameters.ConfigureAsReal( "MaximumRMSError", 0.02 );
+  this->m_Parameters.ConfigureAsReal( "IsoSurfaceValue", 0 );
+  this->m_Parameters.ConfigureAsUint( "NumberOfIterations", 100 );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsITKLevelSetFilters::LaplacianSegmentationLevelSetImageFilter::
+~LaplacianSegmentationLevelSetImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsITKLevelSetFilters::LaplacianSegmentationLevelSetImageFilter::
+_GenerateData( )
+{
+  auto o = this->GetInputData( "Input" );
+  cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
+    this->_Error( "Invalid input image dimension." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpPluginsITKLevelSetFilters::LaplacianSegmentationLevelSetImageFilter::
+_GD0( _TImage* image )
+{
+  auto f = this->GetInputData( "Feature" );
+  cpPlugins_Demangle_Image_RealPixels_2( f, _GD1, _TImage::ImageDimension, image )
+    this->_Error( "Invalid feature image." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TFeature, class _TImage >
+void cpPluginsITKLevelSetFilters::LaplacianSegmentationLevelSetImageFilter::
+_GD1( _TFeature* feature, _TImage* image )
+{
+  typedef typename _TFeature::PixelType _TScalar;
+  typedef
+    itk::LaplacianSegmentationLevelSetImageFilter< _TImage, _TFeature, _TScalar >
+    _TFilter;
+
+  // Configure filter
+  _TFilter* filter = this->_CreateITK< _TFilter >( );
+  filter->SetInput( image );
+  filter->SetFeatureImage( feature );
+  filter->SetPropagationScaling( this->m_Parameters.GetReal( "PropagationScaling" ) );
+  filter->SetCurvatureScaling( this->m_Parameters.GetReal( "CurvatureScaling" ) );
+  filter->SetMaximumRMSError( this->m_Parameters.GetReal( "MaximumRMSError" ) );
+  filter->SetIsoSurfaceValue( this->m_Parameters.GetReal( "IsoSurfaceValue" ) );
+  filter->SetNumberOfIterations( this->m_Parameters.GetUint( "NumberOfIterations" ) );
+  filter->Update( );
+
+  // Connect output
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
+}
+
+// eof - $RCSfile$
diff --git a/plugins/ITKLevelSetFilters/LaplacianSegmentationLevelSetImageFilter.h b/plugins/ITKLevelSetFilters/LaplacianSegmentationLevelSetImageFilter.h
new file mode 100644 (file)
index 0000000..0d4a131
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef __cpPluginsITKLevelSetFilters__LaplacianSegmentationLevelSetImageFilter__h__
+#define __cpPluginsITKLevelSetFilters__LaplacianSegmentationLevelSetImageFilter__h__
+
+#include <cpPluginsITKLevelSetFilters_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+namespace cpPluginsITKLevelSetFilters
+{
+  /**
+   */
+  class cpPluginsITKLevelSetFilters_EXPORT LaplacianSegmentationLevelSetImageFilter
+    : public cpPlugins::BaseObjects::ProcessObject
+  {
+    cpPluginsObject(
+      LaplacianSegmentationLevelSetImageFilter,
+      cpPlugins::BaseObjects::ProcessObject,
+      ImageLevelSetFilters
+      );
+
+  protected:
+    template< class _TImage >
+    inline void _GD0( _TImage* image );
+
+    template< class _TFeature, class _TImage >
+    inline void _GD1( _TFeature* feature, _TImage* image );
+  };
+
+} // ecapseman
+
+#endif // __cpPluginsITKLevelSetFilters__LaplacianSegmentationLevelSetImageFilter__h__
+
+// eof - $RCSfile$