]> Creatis software - cpPlugins.git/blobdiff - appli/examples/example_MPR.cxx
Widget integration (step 6/6): Interactive architecture finished. Needs to be tested...
[cpPlugins.git] / appli / examples / example_MPR.cxx
index 9f6e113151d5d0ed38b07a13ac998d3bf0a58e3a..dca90845c3d66fd245b4b3d4378d0f4e0d6ad8b5 100644 (file)
@@ -35,6 +35,7 @@ public:
     }
   virtual void Execute( vtkObject* caller, unsigned long eId , void* data )
     {
+      /*
       vtkSliderWidget* wdg =
         reinterpret_cast< vtkSliderWidget* >( caller );
       if( wdg == NULL )
@@ -56,6 +57,7 @@ public:
         this->Actors->SetWindow( 0, rep->GetValue( ) );
       else if( title == "Level" )
         this->Actors->SetLevel( 0, rep->GetValue( ) );
+      */
     }
   SliderCallback( )
     : vtkCommand( )
@@ -126,19 +128,20 @@ int main( int argc, char* argv[] )
 
   // Create reader
   TFilter::Pointer reader =
-    plugins.CreateProcessObject( "cpPlugins::ImageReader" );
+    plugins.CreateProcessObject( "cpPlugins::IO::ImageReader" );
   if( reader.IsNull( ) )
   {
-    std::cerr << "No suitable image reader found in plugins." << std::endl;
+    std::cerr
+      << "ERROR: No suitable image reader found in plugins."
+      << std::endl;
     return( 1 );
 
   } // fi
 
   // Configure reader
-  TParameters reader_params = reader->GetDefaultParameters( );
+  TParameters* reader_params = reader->GetParameters( );
   for( int i = 2; i < argc; ++i )
-    reader_params.AddValueToStringList( "FileNames", argv[ i ] );
-  reader->SetParameters( reader_params );
+    reader_params->AddToStringList( "FileNames", argv[ i ] );
 
   // Execute reader
   std::string msg = reader->Update( );
@@ -150,7 +153,8 @@ int main( int argc, char* argv[] )
   } // fi
 
   // Get input image's vtk representation
-  vtkImageData* image = reader->GetOutput< TImage >( 0 )->GetVTKImageData( );
+  vtkImageData* image =
+    reader->GetOutput< TImage >( "Output" )->GetVTK< vtkImageData >( );
   if( image == NULL )
   {
     std::cerr
@@ -168,6 +172,7 @@ int main( int argc, char* argv[] )
   // Renderers
   vtkSmartPointer< vtkRenderer > renderer =
     vtkSmartPointer< vtkRenderer >::New( );
+  renderer->SetBackground( 0, 0, 1 );
   window->AddRenderer( renderer );
 
   // Interactor
@@ -179,13 +184,14 @@ int main( int argc, char* argv[] )
   vtkSmartPointer< TMPRActors > mpr_actors =
     vtkSmartPointer< TMPRActors >::New( );
   mpr_actors->AddInputData( image );
-  mpr_actors->PushDataInto( NULL, NULL, NULL, renderer );
+  mpr_actors->PushActorsInto( NULL, NULL, NULL, window );
 
   // Callbacks
   vtkSmartPointer< SliderCallback > cb =
     vtkSmartPointer< SliderCallback >::New( );
   cb->Actors = mpr_actors;
 
+  /*
   Slider x_slider(
     mpr_actors->GetSliceNumberMinValue( 0 ),
     mpr_actors->GetSliceNumberMaxValue( 0 ),
@@ -221,6 +227,7 @@ int main( int argc, char* argv[] )
     "Level", interactor,
     0.300, 0.05, 0.490, 0.05, cb
     );
+    */
 
   // Begin interaction
   renderer->ResetCamera( );