]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Extensions/Visualization/MPRActors.cxx
Some bugs
[cpPlugins.git] / lib / cpPlugins / Extensions / Visualization / MPRActors.cxx
index b8332786b7ad36d2afcdfc381c1b594554bf559b..e16ba0ad9e76a839cb1191185739fedc157abf99 100644 (file)
@@ -1,6 +1,7 @@
 #include <cpPlugins/Extensions/Visualization/MPRActors.h>
 
 #include <vtkImageData.h>
+#include <vtkLookupTable.h>
 #include <vtkOutlineSource.h>
 #include <vtkPolyDataMapper.h>
 #include <vtkProperty.h>
@@ -40,10 +41,10 @@ SetInputData( vtkImageData* image )
 
   for( int i = 0; i < 3; ++i )
   {
-    Slices[ i ]->SetInputConnection(
+    this->Slices[ i ]->SetInputConnection(
       this->ImageToWindowLevel->GetOutputPort( ), i
       );
-    Slices[ i ]->UpdateText( this->GetWindow( ), this->GetLevel( ) );
+    this->Slices[ i ]->UpdateText( this->GetWindow( ), this->GetLevel( ) );
 
   } // rof
 
@@ -139,6 +140,25 @@ SetInputData( vtkImageData* image )
 void cpPlugins::Extensions::Visualization::MPRActors::
 SetSegmentationData( vtkImageData* segmentation )
 {
+  double range[ 2 ];
+  this->Segmentation = segmentation;
+  this->Segmentation->GetScalarRange( range );
+
+  vtkSmartPointer< vtkLookupTable > lut =
+    vtkSmartPointer< vtkLookupTable >::New( );
+  lut->SetNumberOfTableValues( 2 );
+  lut->SetTableRange( range );
+  lut->SetTableValue( 0, 0, 0, 0, 0 );
+  lut->SetTableValue( 1, 1, 0, 0, 0.4 );
+
+  this->SegmentationToColors->SetInputData( this->Segmentation );
+  this->SegmentationToColors->SetLookupTable( lut );
+  this->SegmentationToColors->Update( );
+
+  for( int i = 0; i < 3; ++i )
+    this->Slices[ i ]->SetSegmentationConnection(
+      this->SegmentationToColors->GetOutputPort( )
+      );
 }
 
 // -------------------------------------------------------------------------