]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/LUTImageActor.cxx
Cast image filter added. ROI filter modified.
[cpPlugins.git] / lib / cpExtensions / Visualization / LUTImageActor.cxx
index 1c9f9fac49cfbdfa6628f99ee96747d9d6753794..d37721537d23ee9741fe145cad3d323a88bc829a 100644 (file)
@@ -86,7 +86,7 @@ GetLUTColor(
 void cpExtensions::Visualization::LUTImageActor::
 SetLUTColor( unsigned int id, double r, double g, double b, double a )
 {
-  if( id >= this->m_LUT->GetNumberOfTableValues( ) )
+  if( id >= ( unsigned int )( this->m_LUT->GetNumberOfTableValues( ) ) )
     this->m_LUT->SetNumberOfTableValues( id + 1 );
   this->m_LUT->SetTableValue( id, r, g, b, a );
   this->m_LUT->Modified( );
@@ -99,15 +99,26 @@ SetLUTColor( vtkImageData* image, double r, double g, double b, double a )
   this->SetLUTColor( this->GetImageId( image ), r, g, b, a );
 }
 
+// TODO: !!!!!
+#include <vtkImageCast.h>
+
 // -------------------------------------------------------------------------
 unsigned int cpExtensions::Visualization::LUTImageActor::
 AddImage( vtkImageData* image, double r, double g, double b, double a )
 {
+  static vtkSmartPointer< vtkImageCast > cast;
+  cast = vtkSmartPointer< vtkImageCast >::New( );
+
   if( image != NULL )
   {
+    cast->SetOutputScalarTypeToUnsignedChar( );
+    cast->SetInputData( image );
+    cast->Update( );
+
     this->m_Images.push_back( image );
     this->SetLUTColor( this->m_Images.size( ), r, g, b, a );
-    this->m_Blender->AddInputData( image );
+    this->m_Blender->AddInputData( cast->GetOutput( ) );
+    this->m_Blender->Update( );
 
     if( this->m_Images.size( ) == 1 )
     {
@@ -117,8 +128,6 @@ AddImage( vtkImageData* image, double r, double g, double b, double a )
         SetInputConnection( this->m_ImageMap->GetOutputPort( ) );
 
     } // fi
-    this->m_Blender->Modified( );
-    this->m_ImageMap->Modified( );
     this->Modified( );
 
     this->GetProperty( )->SetInterpolationTypeToNearest( );