]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/ImageSliceActors.cxx
...
[cpPlugins.git] / lib / cpExtensions / Visualization / ImageSliceActors.cxx
index be7efe304e83bbbed5911152a98d3e0f56673518..d6542efbd25152f0870fa8b2a2645827d67407c4 100644 (file)
@@ -4,6 +4,7 @@
 #include <vtkCamera.h>
 #include <vtkImageData.h>
 #include <vtkImageProperty.h>
+#include <vtkPlane.h>
 #include <vtkProperty.h>
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
@@ -81,6 +82,37 @@ SetInputData( vtkImageData* data, int orientation )
   this->_ConfigureInput( orientation );
 }
 
+// -------------------------------------------------------------------------
+vtkImageData* cpExtensions::Visualization::ImageSliceActors::
+GetInputData( )
+{
+  if( this->m_Mapper.GetPointer( ) != NULL )
+    return( this->m_Mapper->GetInput( ) );
+  else
+    return( NULL );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+AddMesh( vtkPolyData* mesh )
+{
+  SourceActor< vtkCutter > a;
+  a.Create( );
+  a.Source->SetInputData( mesh );
+  a.Source->SetCutFunction( this->m_Mapper->GetSlicePlane( ) );
+  a.Source->SetValue( 0, 0 );
+  a.Source->GenerateTrianglesOff( );
+  a.Source->Update( );
+  a.Modified( );
+  this->m_Meshes[ mesh ] = a;
+  this->AddItem( a.Actor );
+
+  auto ren = this->m_Style->GetCurrentRenderer( );
+  if( ren != NULL )
+    if( ren->HasViewProp( this->m_Actor ) )
+      ren->AddViewProp( a.Actor );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::Visualization::ImageSliceActors::
 AssociateSlice( Self* slice )
@@ -223,7 +255,7 @@ ShowPixelText( double* pos )
         );
 #else // defined(WIN32)
       std::sprintf(
-        this->m_TextBuffer, "Axis: %c (%d)\nPixel %s",
+        this->m_TextBuffer, "Axis: %c (%ld)\nPixel %s",
         axis, slice, str.str( ).c_str( )
         );
 #endif // defined(WIN32)