]> Creatis software - cpPlugins.git/blobdiff - plugins/ImageMeshFilters/RasterMeshFilter.cxx
...
[cpPlugins.git] / plugins / ImageMeshFilters / RasterMeshFilter.cxx
index 4124cb1232db6b88ab851a75bedcbc062460f401..f2226db54b0927c919696a3e2d9e735fc454cc07 100644 (file)
@@ -1,12 +1,9 @@
-#include <plugins/ImageMeshFilters/RasterMeshFilter.h>
+#include <ImageMeshFilters/RasterMeshFilter.h>
 #include <cpPlugins/DataObjects/BoundingBox.h>
 #include <cpPlugins/DataObjects/Mesh.h>
-#include <cpPlugins_ImageIterators.h>
 
 #include <itkTriangleMeshToBinaryImageFilter.h>
 #include <cpExtensions/Algorithms/RasterContourFilter.h>
-#include <itkTriangleMeshToBinaryImageFilter.hxx>
-#include <cpExtensions/Algorithms/RasterContourFilter.hxx>
 
 // -------------------------------------------------------------------------
 cpPluginsImageMeshFilters::RasterMeshFilter::
@@ -21,13 +18,9 @@ RasterMeshFilter( )
   this->_ConfigureInput< _TDataObject >( "Template", false, false );
   this->_ConfigureOutput< _TImage >( "Output" );
 
-  this->m_Parameters.ConfigureAsUint( "InsideValue" );
-  this->m_Parameters.ConfigureAsUint( "OutsideValue" );
-  this->m_Parameters.ConfigureAsUint( "MinimumSize" );
-
-  this->m_Parameters.SetUint( "InsideValue", 1 );
-  this->m_Parameters.SetUint( "OutsideValue", 0 );
-  this->m_Parameters.SetUint( "MinimumSize", 100 );
+  this->m_Parameters.ConfigureAsUint( "InsideValue", 1 );
+  this->m_Parameters.ConfigureAsUint( "OutsideValue", 0 );
+  this->m_Parameters.ConfigureAsUint( "MinimumSize", 100 );
 }
 
 // -------------------------------------------------------------------------
@@ -81,7 +74,14 @@ _GD0_2D( _TMesh* mesh )
   _TPixel outside = _TPixel( this->m_Parameters.GetUint( "OutsideValue" ) );
 
   auto filter = this->_CreateITK< _TFilter >( );
-  filter->AddPoints( mesh->GetPoints( ) );
+  filter->ClearPoints( );
+  double pnt[ 3 ];
+  for( long i = 0; i < mesh->GetNumberOfPoints( ); ++i )
+  {
+    mesh->GetPoint( i, pnt );
+    filter->AddPoint( pnt[ 0 ], pnt[ 1 ] );
+
+  } // rof
   filter->SetTemplate( in_im );
   filter->SetInsideValue( inside );
   filter->SetOutsideValue( outside );