]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/VTK/Image3DObserver.hxx
...
[FrontAlgorithms.git] / lib / fpa / VTK / Image3DObserver.hxx
index c89bb4bd016b691289f9188970c567db87542118..b993928a90fd5db4dcb0fbbd0c8af73a3b10dabd 100644 (file)
@@ -9,6 +9,9 @@
 #include <vtkRenderer.h>
 #include <vtkRendererCollection.h>
 
+#include <vtkPolyDataWriter.h>
+
+
 // -------------------------------------------------------------------------
 template< class F, class R >
 void fpa::VTK::Image3DObserver< F, R >::
@@ -28,7 +31,6 @@ SetPixel(
   unsigned char alpha
   )
 {
-  std::cout << idx << std::endl;
   this->m_Stencil->SetScalarComponentFromDouble
     ( idx[ 0 ], idx[ 1 ], idx[ 2 ], 0, red );
   this->m_Stencil->SetScalarComponentFromDouble
@@ -47,7 +49,11 @@ SetPixel(
     dynamic_cast< vtkUnsignedCharArray* >(
       this->m_PolyData->GetPointData( )->GetScalars( )
       );
-  pd_data->SetTuple4( id, red, green, blue, alpha );
+  if( pd_data != NULL )
+  {
+    pd_data->SetTuple4( id, red, green, blue, alpha );
+
+  } // fi
   this->m_Stencil->Modified( );
   this->m_PolyData->Modified( );
   this->m_PolyDataMapper->Modified( );
@@ -164,7 +170,18 @@ Execute( const itk::Object* c, const itk::EventObject& e )
     } // rof
     this->m_PolyData->SetPoints( pd_points );
     this->m_PolyData->SetVerts( pd_verts );
-    this->m_PolyData->GetPointData( )->SetScalars( pd_data );
+    // this->m_PolyData->GetPointData( )->SetScalars( pd_data );
+
+
+    vtkSmartPointer< vtkPolyDataWriter > w =
+      vtkSmartPointer< vtkPolyDataWriter >::New( );
+    w->SetInputData( this->m_PolyData );
+    w->SetFileName( "fpa.vtk" );
+    w->Update( );
+
+    std::exit( 1 );
+
+
 
     this->m_PolyDataMapper->SetInputData( this->m_PolyData );
     this->m_PolyDataActor->SetMapper( this->m_PolyDataMapper );