]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/QT/ImageWidget.cxx
Start contour tracer widget debugging: change interactor style.
[cpPlugins.git] / lib / cpExtensions / QT / ImageWidget.cxx
index 09788440c1bc6fd38931c32f166401932c0ccea1..af448c1bd53e987f295c67b3d2dd33e72301d8db 100644 (file)
@@ -2,25 +2,29 @@
 
 #ifdef cpExtensions_QT4
 
-#include <cpExtensions/Visualization/ImageViewerActors.h>
-#include <cpExtensions/Visualization/LUTImageActor.h>
-#include <cpExtensions/Visualization/WindowLevelImageActor.h>
 #include <cpExtensions/Interaction/ImageSliceStyle.h>
-#include <vtkCamera.h>
-#include <vtkImageData.h>
-#include <vtkImageProperty.h>
+#include <cpExtensions/Visualization/ImageOutlineActor.h>
+#include <cpExtensions/Visualization/WindowLevelImageActor.h>
+
 #include <vtkRenderer.h>
 
+/* TODO
+   #include <cpExtensions/Visualization/ImageViewerActors.h>
+   #include <cpExtensions/Visualization/LUTImageActor.h>
+   #include <vtkCamera.h>
+   #include <vtkImageData.h>
+   #include <vtkImageProperty.h>
+*/
+
 // -------------------------------------------------------------------------
 cpExtensions::QT::ImageWidget::
 ImageWidget( QWidget* parent, Qt::WindowFlags f )
   : Superclass( parent, f ),
     m_ImageName( "" )
 {
-  this->m_ImageSliceStyle =
-    vtkSmartPointer< cpExtensions::Interaction::ImageSliceStyle >::New( );
-  this->m_ImageSliceStyle->SetCurrentRenderer( this->m_Renderer );
-  this->SetStyle( this->m_ImageSliceStyle );
+  this->m_Style = vtkSmartPointer< TStyle >::New( );
+  this->m_Style->SetCurrentRenderer( this->m_Renderer );
+  this->SetStyle( this->m_Style );
 }
 
 // -------------------------------------------------------------------------
@@ -29,6 +33,42 @@ cpExtensions::QT::ImageWidget::
 {
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::QT::ImageWidget::
+Clear( )
+{
+  this->RemoveViewProps( );
+  this->m_ImageName = "";
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::ImageWidget::
+SetImage( vtkImageData* image, int orientation, const std::string& name )
+{
+  if( name == "" )
+    return;
+  if( this->m_ImageName != "" )
+    this->Clear( );
+  this->m_ImageName = name;
+
+  this->m_WLActor = vtkSmartPointer< TWLActor >::New( );
+  this->m_WLActor->SetImage( image );
+  this->m_WLActor->SetOrientation( orientation );
+
+  this->m_OLActor = vtkSmartPointer< TOLActor >::New( );
+  this->m_OLActor->SetBounds(
+    orientation,
+    this->m_WLActor->GetBounds( )[ orientation ],
+    this->m_WLActor->GetBounds( )
+    );
+
+  this->AddViewProp( this->m_WLActor, this->m_ImageName );
+  this->AddAuxViewProp( this->m_OLActor, this->m_ImageName );
+  this->ResetCamera( );
+}
+
+
+/* TODO
 // -------------------------------------------------------------------------
 vtkInteractorStyle* cpExtensions::QT::ImageWidget::
 GetInteractorStyle( )
@@ -78,12 +118,10 @@ Add( vtkDataSet* data, const std::string& name )
 
   if( image == NULL )
   {
-    /* TODO
        if( this->m_ImageName == "" )
        this->SetImage( data, name );
        {
        } // fi
-    */
     return;
 
   } // fi
@@ -302,6 +340,21 @@ SetImageInterpolation( unsigned char i )
   } // fi
 }
 
+// -------------------------------------------------------------------------
+vtkProp* cpExtensions::QT::ImageWidget::
+GetImageActor( )
+{
+  return( this->m_ImageViewerActors->GetWindowLevelImageActor( ) );
+}
+
+// -------------------------------------------------------------------------
+const vtkProp* cpExtensions::QT::ImageWidget::
+GetImageActor( ) const
+{
+  return( this->m_ImageViewerActors->GetWindowLevelImageActor( ) );
+}
+*/
+
 #endif // cpExtensions_QT4
 
 // eof - $RCSfile$