X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2Fexamples%2Fexample_MPR.cxx;h=dca90845c3d66fd245b4b3d4378d0f4e0d6ad8b5;hb=91f750d8a54e87cdd626566aad3d80940ae041fd;hp=502302c48b7f1d2dcda5173f1125b3ca8c2d67ab;hpb=62d056ccb528d63392d197552830460e980a5aba;p=cpPlugins.git diff --git a/appli/examples/example_MPR.cxx b/appli/examples/example_MPR.cxx index 502302c..dca9084 100644 --- a/appli/examples/example_MPR.cxx +++ b/appli/examples/example_MPR.cxx @@ -35,6 +35,7 @@ public: } virtual void Execute( vtkObject* caller, unsigned long eId , void* data ) { + /* vtkSliderWidget* wdg = reinterpret_cast< vtkSliderWidget* >( caller ); if( wdg == NULL ) @@ -53,9 +54,10 @@ public: else if( title == "Z" ) this->Actors->SetSlice( 2, int( rep->GetValue( ) ) ); else if( title == "Window" ) - this->Actors->SetWindow( rep->GetValue( ) ); + this->Actors->SetWindow( 0, rep->GetValue( ) ); else if( title == "Level" ) - this->Actors->SetLevel( rep->GetValue( ) ); + 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 @@ -178,14 +183,15 @@ int main( int argc, char* argv[] ) // Actors vtkSmartPointer< TMPRActors > mpr_actors = vtkSmartPointer< TMPRActors >::New( ); - mpr_actors->SetInputData( image ); - mpr_actors->PushDataInto( NULL, NULL, NULL, renderer ); + mpr_actors->AddInputData( image ); + 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 ), @@ -208,19 +214,20 @@ int main( int argc, char* argv[] ) 0.500, 0.15, 0.690, 0.15, cb ); Slider w_slider( - mpr_actors->GetMinWindow( ), - mpr_actors->GetMaxWindow( ), - mpr_actors->GetWindow( ), + mpr_actors->GetMinWindow( 0 ), + mpr_actors->GetMaxWindow( 0 ), + mpr_actors->GetWindow( 0 ), "Window", interactor, 0.100, 0.05, 0.290, 0.05, cb ); Slider l_slider( - mpr_actors->GetMinWindow( ), - mpr_actors->GetMaxWindow( ), - mpr_actors->GetWindow( ), + mpr_actors->GetMinWindow( 0 ), + mpr_actors->GetMaxWindow( 0 ), + mpr_actors->GetWindow( 0 ), "Level", interactor, 0.300, 0.05, 0.490, 0.05, cb ); + */ // Begin interaction renderer->ResetCamera( );