]> Creatis software - cpPlugins.git/commitdiff
MPR objects now support multiple images.
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Sat, 26 Sep 2015 09:17:41 +0000 (11:17 +0200)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Sat, 26 Sep 2015 09:17:41 +0000 (11:17 +0200)
appli/examples/example_MPR.cxx
lib/cpExtensions/Visualization/ImageInteractorStyle.cxx
lib/cpExtensions/Visualization/MPRActors.cxx
lib/cpExtensions/Visualization/MPRActors.h
lib/cpExtensions/Visualization/MPRObjects.cxx

index 502302c48b7f1d2dcda5173f1125b3ca8c2d67ab..9f6e113151d5d0ed38b07a13ac998d3bf0a58e3a 100644 (file)
@@ -53,9 +53,9 @@ 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( )
@@ -178,7 +178,7 @@ int main( int argc, char* argv[] )
   // Actors
   vtkSmartPointer< TMPRActors > mpr_actors =
     vtkSmartPointer< TMPRActors >::New( );
-  mpr_actors->SetInputData( image );
+  mpr_actors->AddInputData( image );
   mpr_actors->PushDataInto( NULL, NULL, NULL, renderer );
 
   // Callbacks
@@ -208,16 +208,16 @@ 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( ),
+    mpr_actors->GetMaxWindow( ),
+    mpr_actors->GetWindow( ),
     "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( ),
+    mpr_actors->GetMaxWindow( ),
+    mpr_actors->GetWindow( ),
     "Level", interactor,
     0.300, 0.05, 0.490, 0.05, cb
     );
index 9dec0321ce99ff83cbd02a1a5756a9473326f27b..ab3fee37ca5406985b43cb651b2b7c521002d90c 100644 (file)
@@ -42,7 +42,7 @@ Configure( ImageSliceActors* slice_actors, MPRActors* mpr_actors )
   this->m_SliceActors = slice_actors;
   this->m_MPRActors = mpr_actors;
   this->SetModeToNavigation( );
-  this->PropPicker->AddPickList( slice_actors->GetImageActor( ) );
+  this->PropPicker->AddPickList( slice_actors->GetImageActor( ) );
   this->Modified( );
 }
 
@@ -363,7 +363,7 @@ OnChar( )
   {
     if( this->m_MPRActors != NULL )
     {
-      this->m_MPRActors->ResetWindowLevel( );
+      this->m_MPRActors->ResetWindowLevel( );
       this->Interactor->Render( );
       this->_RenderAssociateInteractors( );
 
@@ -404,17 +404,18 @@ WindowLevel( )
 
     double w = this->WindowLevelInitial[ 0 ] * ( double( 1 ) + sw );
     double l = this->WindowLevelInitial[ 1 ] * ( double( 1 ) + sl );
-    double minw = this->m_MPRActors->GetMinWindow( );
-    double maxw = this->m_MPRActors->GetMaxWindow( );
-    double minl = this->m_MPRActors->GetMinLevel( );
-    double maxl = this->m_MPRActors->GetMaxLevel( );
+    double minw = this->m_MPRActors->GetMinWindow( );
+    double maxw = this->m_MPRActors->GetMaxWindow( );
+    double minl = this->m_MPRActors->GetMinLevel( );
+    double maxl = this->m_MPRActors->GetMaxLevel( );
 
     if( w < minw ) w = minw;
     if( maxw < w ) w = maxw;
     if( l < minl ) l = minl;
     if( maxl < l ) l = maxl;
 
-    this->m_MPRActors->SetWindowLevel( w, l );
+    this->m_MPRActors->SetWindow( 0, w );
+    this->m_MPRActors->SetLevel( 0, l );
     this->Interactor->Render( );
     this->_RenderAssociateInteractors( );
   }
@@ -435,8 +436,8 @@ StartWindowLevel( )
   {
     this->StartState( VTKIS_WINDOW_LEVEL );
 
-    this->WindowLevelInitial[ 0 ] = this->m_MPRActors->GetWindow( );
-    this->WindowLevelInitial[ 1 ] = this->m_MPRActors->GetLevel( );
+    this->WindowLevelInitial[ 0 ] = this->m_MPRActors->GetWindow( );
+    this->WindowLevelInitial[ 1 ] = this->m_MPRActors->GetLevel( );
   }
   else if( this->Mode == Self::DeformationMode )
   {
index eea3b64550154d4f11c77a276e9615924e57f4f7..4be68644800a8301c35262277d1b07be7b39654b 100644 (file)
@@ -14,6 +14,17 @@ New( )
   return( new Self( ) );
 }
 
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::
+ImageSliceActors* cpExtensions::Visualization::MPRActors::
+GetSliceActors( const int& i ) const
+{
+  if( i < 3 )
+    return( this->Slices[ 0 ][ i ] );
+  else
+    return( NULL );
+}
+
 // -------------------------------------------------------------------------
 int cpExtensions::Visualization::MPRActors::
 AddInputConnection( vtkAlgorithmOutput* aout )
index 2566c1dff8ede3c65b3a84dbe8613ef16b858be6..72389be28af55b86d94c96ddc11d503d2aee0103 100644 (file)
@@ -36,7 +36,7 @@ namespace cpExtensions
       // Creation
       static MPRActors* New( );
 
-      // TODO: ImageSliceActors* GetSliceActors( const int& i ) const;
+      ImageSliceActors* GetSliceActors( const int& i ) const;
 
       int AddInputConnection( vtkAlgorithmOutput* aout );
       int AddInputData( vtkImageData* image );
index 9c1432374264348fa495823a8f19103281bd1900..96e646a78f11bbf46c2e44991edb084c2934c266 100644 (file)
@@ -77,7 +77,7 @@ SetRenderWindows(
 void cpExtensions::Visualization::MPRObjects::
 SetImage( vtkImageData* image )
 {
-  this->m_MPRActors->SetInputData( image );
+  this->m_MPRActors->AddInputData( image );
   this->m_MPRActors->PushDataInto(
     this->m_Renderers[ 0 ],
     this->m_Renderers[ 1 ],